[openbox] Windows Positioning

Brian Mattern rephorm at rephorm.com
Wed Jan 2 13:46:00 EST 2013


The "MoveResizeTo" action that is described in laertis' original email
should work for getting the window onto the left half of the screen (and
a similar one for the right half wouldn't be too hard to write).
Although he doesn't say explicitly, it sounds like his concern was about
the problem of undoing the behavior. In Win7, IIRC, when you drag away from
the edge, the window returns to its original size (while its position is
determined by the drag). This would not be possible with openbox actions
directly since you can't store the state.

But, it shouldn't be hard to do in a WM agnostic way using something
like xdotool and bash.

e.g.:

    # get active window's id and geometry (this sets vars WINDOW X Y
    # WIDTH HEIGHT and SCREEN)
    eval $(xdotool getactivewindow getwindowgeometry --shell)

    # store current geometry as properties
    xprop -id $WINDOW -format _FOO_PREVIOUS_X 8i -set _FOO_PREVIOUS_X $X
    xprop -id $WINDOW -format _FOO_PREVIOUS_Y 8i -set _FOO_PREVIOUS_Y $Y

On Tue, 01 Jan 2013, Das wrote:

> Hi guys,
> 
> Did anyone see this, can this be done?
> 
> THANKS
> 
> 
> On Tue, Dec 18, 2012 at 2:35 PM, Das <dasfox at gmail.com> wrote:
> 
> > Ahhh snap a Window to the left then snap a Window to the right, having
> > them side by side like Windows 7, hmm I never thought about this
> > before...
> >
> > So are we saying this is do able? This would be a nice feature...
> >
> >
> >
> > On Tue, Dec 18, 2012 at 9:43 AM, Mathias Dufresne
> > <mathias.dufresne at gmail.com> wrote:
> > >
> > > Hi,
> > >
> > > You can use middle mouse button to resize vertically and right button to
> > > resize window horizontally in place of left button which resize in full
> > > screen...
> > > It almost remember previous position even if sometimes I had strange
> > > behaviour when clicking to get back to previous state. No idea if it was
> > old
> > > version, my mistake or whatever... Anyway, I use that for years and that
> > > miss me so much under Windows...
> > >
> > > That does not answer to your question but perhaps it would help : )
> > >
> > > Cheers,
> > >
> > > Mat
> > >
> > >
> > > 2012/12/18 laertis <loutsis at csd.uoc.gr>
> > >>
> > >> Hello,
> > >>
> > >> first of all i'd like to say how much i love this WM and how
> > configurable
> > >> it is.
> > >>
> > >> What is troubling me for the past of the week is how to get openbox to
> > >> simulate Win7 aero snapping behavior which i find really comforting and
> > >> productive btw. I assumed that in order to achieve so, given the current
> > >> configuration actions, i would need to know the variables holding the
> > >> window's position so i could "MoveResizeTo" those!
> > >>
> > >> I think this guy describes the same thing with me except that he is
> > >> talking about mousebinds while i'm talking about keybinds.
> > >>
> > >>
> > >> And this is the nearest i could get to Win7 snapping :
> > >> http://www.jasoncavett.com/2012/05/better-aero-snap-with-openbox.html
> > >>
> > >> I've tried a work around leveraging the if statements of the openbox
> > >> configuration file and the result was something like this :
> > >>
> > >> <keybind key='W-Right">
> > >>
> > >>
> > >>
> > >>   <action name="If">
> > >>
> > >>
> > >>
> > >>     <maximized>yes</maximized>
> > >>
> > >>
> > >>
> > >>     <then>
> > >>
> > >>
> > >>
> > >>       <action name="Unmaximize"/>
> > >>
> > >>
> > >>
> > >>       <action name="Unmaximize"/>
> > >>
> > >>
> > >>
> > >>         <direction>vertical</direction>
> > >>
> > >>
> > >>
> > >>       </action>
> > >>
> > >>
> > >>
> > >>       <action name="MoveResizeTo">
> > >>
> > >>
> > >>
> > >>         <x>0</x>
> > >>
> > >>
> > >>
> > >>         <y>0</y>
> > >>
> > >>
> > >>
> > >>         <width>50%</width>
> > >>
> > >>
> > >>
> > >>       </action>
> > >>
> > >>
> > >>
> > >>     </then>
> > >>
> > >>
> > >>
> > >>     <else>
> > >>
> > >>
> > >>
> > >>       <action name="If">
> > >>
> > >>
> > >>
> > >>        ..........
> > >>
> > >>
> > >>
> > >>        ..........
> > >>
> > >>
> > >>
> > >>        ..........
> > >>
> > >>
> > >>
> > >>        ..........
> > >>
> > >>   but i figured out but it can't be done without knowing the window's
> > >> position.
> > >>
> > >> So i think writing a wmctrl script holding the windows position and
> > >> combining it with the above would give me what i want.
> > >>
> > >> Is there any chance this is implemented somewhere out there?
> > >>
> > >> I think i'm gonna write down a script either way but if there is
> > >> something out there getting the job done it would help for now.
> > >>
> > >> However there are some issues i'm thinking right now, such as, how is
> > >> each windows going to hold it's previous state ?
> > >>
> > >> Anyway, that's about it. Thank you for the support.
> > >>
> > >>
> > >> _______________________________________________
> > >> openbox mailing list
> > >> openbox at icculus.org
> > >> http://icculus.org/mailman/listinfo/openbox
> > >>
> > >
> > >
> > > _______________________________________________
> > > openbox mailing list
> > > openbox at icculus.org
> > > http://icculus.org/mailman/listinfo/openbox
> > >
> >

> _______________________________________________
> openbox mailing list
> openbox at icculus.org
> http://icculus.org/mailman/listinfo/openbox



More information about the openbox mailing list