By
on CrunchBang, Linux, #!

Reposition windows in CrunchBang(#!)

One of the features that I missed quite a bit in Ubuntu were the shortcut keys for repositioning windows.

The shortcut keys were all located on the numpad and were quite intuitive.

  • CTR+ALT + 1 = Lower left quadrant
  • CTR+ALT + 3 = Lower right quadrant
  • CTR+ALT + 7 = Top left quadrant
  • CTR+ALT + 8 = Top right quadrant
  • CTR+ALT + 4 = Left half
  • CTR+ALT + 6 = Right half
  • CTR+ALT + 5 = Full screen

After getting annoyed by repeatedly having to reposition my windows using the mouse, I searched over the internet for a possible solution and quickly found a solution(Thank you!).

The solution works great however the positioning values are configured by pixel values. Users with resolutions different to the author(which happens to be the case for me) will face issues trying to reposition.

I tweaked the underlying values to use percentage values instead and extended the functionality to mimic that in Ubuntu.

<keybind key="C-A-W-KP_7">  
  <action name="UnmaximizeFull"/>
  <action name="MoveResizeTo">
    <x>0</x>
    <y>0</y>
    <width>50%</width>
    <height>50%</height>
  </action>
</keybind>  
<keybind key="C-A-W-KP_5">  
  <action name="ToggleMaximizeFull"/>
</keybind>  
<keybind key="C-A-W-KP_8">  
  <action name="UnmaximizeFull"/>
  <action name="MoveResizeTo">
    <x>0</x>
    <y>0</y>
    <width>100%</width>
    <height>50%</height>
  </action>
</keybind>  
<keybind key="C-A-W-KP_9">  
  <action name="UnmaximizeFull"/>
  <action name="MoveResizeTo">
    <x>-1</x>
    <y>0</y>
    <width>50%</width>
    <height>50%</height>
  </action>
</keybind>  
<keybind key="C-A-W-KP_4">  
  <action name="UnmaximizeFull"/>
  <action name="MoveResizeTo">
    <x>0</x>
    <y>0</y>
    <width>50%</width>
    <height>100%</height>
  </action>
</keybind>  
<keybind key="C-A-W-KP_6">  
  <action name="UnmaximizeFull"/>
  <action name="MoveResizeTo">
    <x>-1</x>
    <y>0</y>
    <width>50%</width>
    <height>100%</height>
  </action>
</keybind>  
<keybind key="C-A-W-KP_3">  
  <action name="UnmaximizeFull"/>
  <action name="MoveResizeTo">
    <x>-1</x>
    <y>-1</y>
    <width>50%</width>
    <height>50%</height>
  </action>
</keybind>  
<keybind key="C-A-W-KP_2">  
  <action name="UnmaximizeFull"/>
  <action name="MoveResizeTo">
    <x>0</x>
    <y>-1</y>
    <width>100%</width>
    <height>50%</height>
  </action>
</keybind>  
<keybind key="C-A-W-KP_1">  
  <action name="UnmaximizeFull"/>
  <action name="MoveResizeTo">
    <x>0</x>
    <y>-1</y>
    <width>50%</width>
    <height>50%</height>
  </action>
</keybind  

After throwing the xml above in the keyboard tag in the ~/.config/openbox/rc.xml file, I restarted openbox. Worked like a charm! :)

Note: In order to prevent any possible shortcut key clashes, the ctr+alt+win combination is being used along with the numeric value for positioning.

comments powered by Disqus