Topic: Aero Snap in Openbox

*edit to use the method described in post 2 by pvsage

If this is old new's then i'm sorry, but I've just found out how to set something up in open box that's been driving me insane for a while now. I personally enjoy windows "Aero Snap" features for web work, makes it easier to code and view, heres how to do it in openbox.
Steps

1) launch a terminal and place this code in it

gedit ~/.config/openbox/rc.xml

2) go down to the end of the key bindings section, right before the mouse binds begin. (this is where were going to declare the binds for the "Snap" feature.

3)paste these binds in after the last key bind, but before the </keyboard> tag.

    <keybind key="C-Tab">
       <action name="UnmaximizeFull"/>
       <action name="MaximizeVert"/>
       <action name="MoveResizeTo">
         <width>640</width>
       </action>
       <action name="MoveToEdgeWest"/>
    </keybind>
    <keybind key="W-Tab">
        <action name="UnmaximizeFull"/>
        <action name="MaximizeVert"/>
        <action name="MoveResizeTo">
         <width>640</width>
        </action>
        <action name="MoveToEdgeEast"/>
    </keybind>

4) Change the widths according to your resolution





Here is a few common resolutions that I've set up for copy and paste.



800xHeight

    <keybind key="C-Tab">
       <action name="UnmaximizeFull"/>
       <action name="MaximizeVert"/>
       <action name="MoveResizeTo">
         <width>300</width>
       </action>
       <action name="MoveToEdgeWest"/>
    </keybind>
    <keybind key="W-Tab">
        <action name="UnmaximizeFull"/>
        <action name="MaximizeVert"/>
        <action name="MoveResizeTo">
        <width>300</width>
        </action>
        <action name="MoveToEdgeEast"/>
    </keybind>

1024xHeight

   <keybind key="C-Tab">
       <action name="UnmaximizeFull"/>
       <action name="MaximizeVert"/>
       <action name="MoveResizeTo">
         <width>512</width>
       </action>
       <action name="MoveToEdgeWest"/>
    </keybind>
    <keybind key="W-Tab">
        <action name="UnmaximizeFull"/>
        <action name="MaximizeVert"/>
        <action name="MoveResizeTo">
        <width>512</width>
        </action>
        <action name="MoveToEdgeEast"/>
    </keybind>

1152xHeight

   <keybind key="C-Tab">
       <action name="UnmaximizeFull"/>
       <action name="MaximizeVert"/>
       <action name="MoveResizeTo">
         <width>576</width>
       </action>
       <action name="MoveToEdgeWest"/>
    </keybind>
    <keybind key="W-Tab">
        <action name="UnmaximizeFull"/>
        <action name="MaximizeVert"/>
        <action name="MoveResizeTo">
        <width>576</width>
        </action>
        <action name="MoveToEdgeEast"/>
    </keybind>

1280xHeight

    <keybind key="C-Tab">
       <action name="UnmaximizeFull"/>
       <action name="MaximizeVert"/>
       <action name="MoveResizeTo">
         <width>640</width>
       </action>
       <action name="MoveToEdgeWest"/>
    </keybind>
    <keybind key="W-Tab">
        <action name="UnmaximizeFull"/>
        <action name="MaximizeVert"/>
        <action name="MoveResizeTo">
        <width>640</width>
        </action>
        <action name="MoveToEdgeEast"/>
    </keybind>

1366xHeight

   <keybind key="C-Tab">
       <action name="UnmaximizeFull"/>
       <action name="MaximizeVert"/>
       <action name="MoveResizeTo">
         <width>683</width>
       </action>
       <action name="MoveToEdgeWest"/>
    </keybind>
    <keybind key="W-Tab">
        <action name="UnmaximizeFull"/>
        <action name="MaximizeVert"/>
        <action name="MoveResizeTo">
        <width>683</width>
        </action>
        <action name="MoveToEdgeEast"/>
    </keybind>

1440xHeight

   <keybind key="C-Tab">
       <action name="UnmaximizeFull"/>
       <action name="MaximizeVert"/>
       <action name="MoveResizeTo">
         <width>720</width>
       </action>
       <action name="MoveToEdgeWest"/>
    </keybind>
    <keybind key="W-Tab">
        <action name="UnmaximizeFull"/>
        <action name="MaximizeVert"/>
        <action name="MoveResizeTo">
        <width>720</width>
        </action>
        <action name="MoveToEdgeEast"/>
    </keybind>

1600xHeight

   <keybind key="C-Tab">
       <action name="UnmaximizeFull"/>
       <action name="MaximizeVert"/>
       <action name="MoveResizeTo">
         <width>800</width>
       </action>
       <action name="MoveToEdgeWest"/>
    </keybind>
    <keybind key="W-Tab">
        <action name="UnmaximizeFull"/>
        <action name="MaximizeVert"/>
        <action name="MoveResizeTo">
        <width>800</width>
        </action>
        <action name="MoveToEdgeEast"/>
    </keybind>

ill post up more resolutions later if people are interested. Its late here and i need some sleep.
*Edit. Thank you for telling me about the better method pvsage

Last edited by psyco430404 (2011-07-05 19:14:01)

"'If fighting is to result in victory, then you must fight'...Sun Tzu said that and id say he knows a little more about fighting then you do pal."

- TF2 Soldier

Re: Aero Snap in Openbox

You forgot netbook screen size 1024x600. tongue

Anyway, another way to do it without having to calculate everything involves MaximizeVert and MoveToEdgeEast/MoveToEdgeWest:
http://crunchbanglinux.org/forums/post/58722/#p58722
With this method, the only number you should need to change is the one for the windows' width. wink

while ( ! ( succeed = try() ) );

Re: Aero Snap in Openbox

Thank you for the better way of doing it, id just recently (1 week ago) started working with Openbox, and id wanted this function but couldn't find anyway on the internet for people to do it. (lots of wmctrl and compiz but no Openbox lol) So i thought id share my little method id discovered.

"'If fighting is to result in victory, then you must fight'...Sun Tzu said that and id say he knows a little more about fighting then you do pal."

- TF2 Soldier

Re: Aero Snap in Openbox

That's excellent. A nice way of getting rid of Compiz, I think I mainly use it because of the grid plugin (since cairo-compmgr works quite well now).

I'm so meta, even this acronym

Re: Aero Snap in Openbox

psyco430404 wrote:

3)paste these binds in after the last key bind, but before the </keyboard> tag.

    <keybind key="C-Tab">
       <action name="UnmaximizeFull"/>
       <action name="MaximizeVert"/>
       <action name="MoveResizeTo">
         <width>640</width>
       </action>
       <action name="MoveToEdgeWest"/>
    </keybind>
    <keybind key="W-Tab">
        <action name="UnmaximizeFull"/>
        <action name="MaximizeVert"/>
        <action name="MoveResizeTo">
         <width>640</width>
        </action>
        <action name="MoveToEdgeEast"/>
    </keybind>

4) Change the widths according to your resolution

As seen in this topic: http://crunchbanglinux.org/forums/topic … aero-snap/
wmctrl can be used… a liitle script could be easy to write to fetch screen size and openbox margins and finally execute wmctrl with right arguments depending on both margins and screen size…

Re: Aero Snap in Openbox

AeroSnap(position, tuning=(2, 24), width='50%')

small demo video: http://www.toofiles.com/fr/dl/audios/ogg/snap.html

Last edited by ~HP (2011-08-17 13:15:05)

Re: Aero Snap in Openbox

~HP wrote:
AeroSnap(position, tuning=(2, 24), width='50%')

small demo video: http://www.toofiles.com/fr/dl/audios/ogg/snap.html

The video looks nice. Where can i get the script?

Re: Aero Snap in Openbox

I just wrote something similar here: http://crunchbanglinux.org/forums/topic … osnapping/

My script gets screen resolution and moves/resizes windows according to it, it needs some tweaks though.

Last edited by slug45 (2011-09-08 16:03:56)

Re: Aero Snap in Openbox

Here is some simple parts that seem to be forgotten from aero snap. The maximize full and unmaximize.

    <keybind key="W-Up">
        <action name="MaximizeFull" />
    </keybind>
    <keybind key="W-Down">
        <action name="UnmaximizeFull" />
    </keybind>

Re: Aero Snap in Openbox

Hey guys, I am not a crunchbang user but I do use openbox. In fact, I registered here just to share this with you. I have taken this aero snap idea to a new level. Get the code in my blog post.

It is resolution-independent, currently supports:

(CWA is Ctrl+Win+Alt)

half and half horizontal division: CWA+Left, CWA+Right
horizontal divisions in thirds: CWA+z, CWA+x, CWA+c
maximize and iconify: CWA+Up, CWA+Down
horizontal/vertical quarter division: top left, top right, bottom left, bottom right: CWA+q, CWA+e, CWA+a, CWA+d

get the rc.xml code here:
http://rzdroid.com/blog/?itemid=12

Long live openbox!

Re: Aero Snap in Openbox

Thanks for that, @raidzero.
I don't suppose there's a way you could change those '&lt' into '<' so we can just copy the code? Maybe the semicolons got dropped somewhere? (should be &lt; &gt; etc)

John
------------------------
( a boring Japan blog , and idle twitterings )
“Good morning sir, which way up would you like your reality today?”  "As it comes, Jeeves, as it comes..."

Re: Aero Snap in Openbox

johnraff wrote:

Thanks for that, @raidzero.
I don't suppose there's a way you could change those '&lt' into '<' so we can just copy the code? Maybe the semicolons got dropped somewhere? (should be &lt; &gt; etc)


use a text editor or even sed to replace?

I formatted them like that so the blog post looked nice smile

under firefox I am able to copy the code just fine ...

Re: Aero Snap in Openbox

^but it doesn't look nice! Sure I can copy the code, but all the left hand tags are &lt instead of < . The right hand ones are fine. I think you left out the semicolon from the &lt; entities. Sure it's easily fixed...

John
------------------------
( a boring Japan blog , and idle twitterings )
“Good morning sir, which way up would you like your reality today?”  "As it comes, Jeeves, as it comes..."

Re: Aero Snap in Openbox

I have copied and pasted directly from the blog post:

    <!-- RZ divvy emulation -->

    <keybind key="C-W-A-Right">

      <action name="Unmaximize"/>

      <action name="MoveResizeTo">

        <!-- put the window on the right, maximized height -->

        <x>-0</x>

        <y>0</y>

        <height>99%</height>

        <width>50%</width>

      </action>

    </keybind>

    <keybind key="C-W-A-Left">

      <action name="Unmaximize"/>

      <action name="MoveResizeTo">

        <!-- put the window on the left, maximized height -->

        <x>0</x>

        <y>0</y>

        <height>99%</height>

        <width>50%</width>

      </action>

    </keybind>

    <keybind key="C-W-A-e">

      <action name="Unmaximize"/>

      <action name="MoveResizeTo">

        <!-- put the window in the top right corner -->

        <x>50%</x>

        <y>-50%</y>

        <height>49%</height>

        <width>50%</width>

      </action>

    </keybind>

    <keybind key="C-W-A-q">

      <action name="Unmaximize"/>

      <action name="MoveResizeTo">

        <!-- put the window in the top left corner -->

        <x>-50%</x>

        <y>-50%</y>

        <height>49%</height>

        <width>50%</width>

      </action>

    </keybind>

    <keybind key="C-W-A-a">

      <action name="Unmaximize"/>

      <action name="MoveResizeTo">

        <!-- put the window in the bottom left corner -->

        <x>-50%</x>

        <y>50%</y>

        <height>49%</height>

        <width>50%</width>

      </action>

    </keybind>

    <keybind key="C-W-A-d">

      <action name="Unmaximize"/>

      <action name="MoveResizeTo">

        <!-- put the window in the bottom right corner -->

        <x>50%</x>

        <y>50%</y>

        <height>49%</height>

        <width>50%</width>

      </action>

    </keybind>

    <keybind key="C-W-A-z">

      <action name="Unmaximize"/>

      <action name="MoveResizeTo">

        <!-- put the window in the right third, maximized height -->

        <x>0</x>

        <y>0</y>

        <height>99%</height>

        <width>33%</width>

      </action>

    </keybind>

    <keybind key="C-W-A-x">

      <action name="Unmaximize"/>

      <action name="MoveResizeTo">

        <!-- put the window in the middle third, maximized height -->

        <x>33%</x>

        <y>0</y>

        <height>99%</height>

        <width>33%</width>

      </action>

    </keybind>

     <keybind key="C-W-A-c">

      <action name="Unmaximize"/>

      <action name="MoveResizeTo">

        <!-- put the window in the left third, maximized height -->

        <x>66%</x>

        <y>0</y>

        <height>99%</height>

        <width>33%</width>

      </action>

    </keybind>

    <!-- Maximize window -->

     <keybind key="C-W-A-Up">

      <action name="Maximize"/>

    </keybind>

    <!-- Minmize window -->

     <keybind key="C-W-A-Down">

      <action name="Iconify"/>

    </keybind>

  <!-- end RZ divvy emulation -->

screenshot of the post: http://rzdroid.com/images/rc-xml.png

Last edited by raidzero (2012-01-13 16:11:09)

Re: Aero Snap in Openbox

Hmm...strange. Copy/paste on Iceweasel 3.5.24:

<!-- RZ divvy emulation -->

    &ltkeybind key="C-W-A-Right">

      &ltaction name="Unmaximize"/>

      &ltaction name="MoveResizeTo">

        <!-- put the window on the right, maximized height -->

        &ltx&gt-0</x>

        &lty&gt0</y>

        &ltheight&gt99%</height>

        &ltwidth&gt50%</width>

      </action>

    </keybind>

    &ltkeybind key="C-W-A-Left">

      &ltaction name="Unmaximize"/>

      &ltaction name="MoveResizeTo">

        <!-- put the window on the left, maximized height -->

        &ltx&gt0</x>

        &lty&gt0</y>

        &ltheight&gt99%</height>

        &ltwidth&gt50%</width>

      </action>

    </keybind>

    &ltkeybind key="C-W-A-e">

      &ltaction name="Unmaximize"/>

      &ltaction name="MoveResizeTo">

        <!-- put the window in the top right corner -->

        &ltx&gt50%</x>

        &lty&gt-50%</y>

        &ltheight&gt49%</height>

        &ltwidth&gt50%</width>

      </action>

    </keybind>

    &ltkeybind key="C-W-A-q">

      &ltaction name="Unmaximize"/>

      &ltaction name="MoveResizeTo">

        <!-- put the window in the top left corner -->

        &ltx&gt-50%</x>

        &lty&gt-50%</y>

        &ltheight&gt49%</height>

        &ltwidth&gt50%</width>

      </action>

    </keybind>

    &ltkeybind key="C-W-A-a">

      &ltaction name="Unmaximize"/>

      &ltaction name="MoveResizeTo">

        <!-- put the window in the bottom left corner -->

        &ltx&gt-50%</x>

        &lty&gt50%</y>

        &ltheight&gt49%</height>

        &ltwidth&gt50%</width>

      </action>

    </keybind>

    &ltkeybind key="C-W-A-d">

      &ltaction name="Unmaximize"/>

      &ltaction name="MoveResizeTo">

        <!-- put the window in the bottom right corner -->

        &ltx&gt50%</x>

        &lty&gt50%</y>

        &ltheight&gt49%</height>

        &ltwidth&gt50%</width>

      </action>

    </keybind>

    &ltkeybind key="C-W-A-z">

      &ltaction name="Unmaximize"/>

      &ltaction name="MoveResizeTo">

        <!-- put the window in the right third, maximized height -->

        &ltx&gt0</x>

        &lty&gt0</y>

        &ltheight&gt99%</height>

        &ltwidth&gt33%</width>

      </action>

    </keybind>

    &ltkeybind key="C-W-A-x">

      &ltaction name="Unmaximize"/>

      &ltaction name="MoveResizeTo">

        <!-- put the window in the middle third, maximized height -->

        &ltx&gt33%</x>

        &lty&gt0</y>

        &ltheight&gt99%</height>

        &ltwidth&gt33%</width>

      </action>

    </keybind>

     &ltkeybind key="C-W-A-c">

      &ltaction name="Unmaximize"/>

      &ltaction name="MoveResizeTo">

        <!-- put the window in the left third, maximized height -->

        &ltx&gt66%</x>

        &lty&gt0</y>

        &ltheight&gt99%</height>

        &ltwidth&gt33%</width>

      </action>

    </keybind>

    <!-- Maximize window -->

     &ltkeybind key="C-W-A-Up">

      &ltaction name="Maximize"/>

    </keybind>

    <!-- Minmize window -->

     &ltkeybind key="C-W-A-Down">

      &ltaction name="Iconify"/>

    </keybind>

  <!-- end RZ divvy emulation -->
John
------------------------
( a boring Japan blog , and idle twitterings )
“Good morning sir, which way up would you like your reality today?”  "As it comes, Jeeves, as it comes..."

Re: Aero Snap in Openbox

johnraff wrote:

Hmm...strange. Copy/paste on Iceweasel 3.5.24

ok save that stuff to a temp file

then run

sed -i 's/&lt/\</g' FILENAME

gives this:

<!-- RZ divvy emulation -->

    <keybind key="C-W-A-Right">

      <action name="Unmaximize"/>

      <action name="MoveResizeTo">

        <!-- put the window on the right, maximized height -->

        <x&gt-0</x>

        <y&gt0</y>

        <height&gt99%</height>

        <width&gt50%</width>

      </action>

    </keybind>

    <keybind key="C-W-A-Left">

      <action name="Unmaximize"/>

      <action name="MoveResizeTo">

        <!-- put the window on the left, maximized height -->

        <x&gt0</x>

        <y&gt0</y>

        <height&gt99%</height>

        <width&gt50%</width>

      </action>

    </keybind>

    <keybind key="C-W-A-e">

      <action name="Unmaximize"/>

      <action name="MoveResizeTo">

        <!-- put the window in the top right corner -->

        <x&gt50%</x>

        <y&gt-50%</y>

        <height&gt49%</height>

        <width&gt50%</width>

      </action>

    </keybind>

    <keybind key="C-W-A-q">

      <action name="Unmaximize"/>

      <action name="MoveResizeTo">

        <!-- put the window in the top left corner -->

        <x&gt-50%</x>

        <y&gt-50%</y>

        <height&gt49%</height>

        <width&gt50%</width>

      </action>

    </keybind>

    <keybind key="C-W-A-a">

      <action name="Unmaximize"/>

      <action name="MoveResizeTo">

        <!-- put the window in the bottom left corner -->

        <x&gt-50%</x>

        <y&gt50%</y>

        <height&gt49%</height>

        <width&gt50%</width>

      </action>

    </keybind>

    <keybind key="C-W-A-d">

      <action name="Unmaximize"/>

      <action name="MoveResizeTo">

        <!-- put the window in the bottom right corner -->

        <x&gt50%</x>

        <y&gt50%</y>

        <height&gt49%</height>

        <width&gt50%</width>

      </action>

    </keybind>

    <keybind key="C-W-A-z">

      <action name="Unmaximize"/>

      <action name="MoveResizeTo">

        <!-- put the window in the right third, maximized height -->

        <x&gt0</x>

        <y&gt0</y>

        <height&gt99%</height>

        <width&gt33%</width>

      </action>

    </keybind>

    <keybind key="C-W-A-x">

      <action name="Unmaximize"/>

      <action name="MoveResizeTo">

        <!-- put the window in the middle third, maximized height -->

        <x&gt33%</x>

        <y&gt0</y>

        <height&gt99%</height>

        <width&gt33%</width>

      </action>

    </keybind>

     <keybind key="C-W-A-c">

      <action name="Unmaximize"/>

      <action name="MoveResizeTo">

        <!-- put the window in the left third, maximized height -->

        <x&gt66%</x>

        <y&gt0</y>

        <height&gt99%</height>

        <width&gt33%</width>

      </action>

    </keybind>

    <!-- Maximize window -->

     <keybind key="C-W-A-Up">

      <action name="Maximize"/>

    </keybind>

    <!-- Minmize window -->

     <keybind key="C-W-A-Down">

      <action name="Iconify"/>

    </keybind>

  <!-- end RZ divvy emulation -->

edit: note, that usage of sed requires GNU sed, which I am sure crunchbang is already using big_smile

Last edited by raidzero (2012-01-13 19:18:51)