Saturday 9 June 2012

Light alternative to compiz grid effect


Implementing the

  • unity - window placement half-screen (ctrl+alt+numpad 4/5)
  • compiz - grid
  • windows 7 - window half screen (Super + Left/RightArrow)

effect on a 'naked system', without install heavy window management tools like Compiz.

Problem:
Okay, So I like being efficient with my working environment, especially with my window management, as I don't like wasting space on my 13" laptop screen.

I'm running LXDE with OpenBox and Anders is running gnome2 with Metacity.


PyWO - Python Window Organizer

The solution is too use the small python script provided by PyWo which can be downloaded from http://code.google.com/p/pywo/ written by http://kosciak.blox.pl/html.
In writing I'm using the 0.2 version.

Implementation (really easy!):

  1. Download version 0.2 from google code, and put in a folder. I put it in ~/settings/pywo-2.0/
  2. Run the downloaded script (/home/charnley/settings/pywo-2.0/pywo.py) 
  3. DONE


Default keyboard shortcuts:



Alt-Ctrl-Shift-Q    - exit PyWO
Alt-Ctrl-Shift-R    - reload configuration fileAlt-Ctrl-Shift-I    - print debug information about window manager and current window
Alt-KP_Divide       - switch windows (change position of the window)
Alt-Shift-KP_Divide - cycle windows (change contents of the window)
Alt-KP_1-9          - move window in a direction (KP_1-9 - numpad keys)
Shift-KP_1-9        - expand window in a direction (5 works as maximumize compiz plugin)
Alt-Shift-KP_1-9    - shrink windowAlt-Ctrl-KP_1-9     - put window to predefined positionCtrl_KP_1-9         - put and resize (grid), and cycle widthsCtrl-Shift_KP_1-9   - put and resize (grid), and cycle heights

Note, the default configuration is to use the numpad as the control, but being a laptop user this is not an option. So my setup is:

Laptop configuration:

Create ~/.pyworc and fill in:


[SETTINGS]
; 1/on/yes/true - work only when NumLock is on
; ignore - ignore NumLock state (works when on and off)
; 0/off/no/false - work only when NumLock is off
numlock = ignore

; invert window gravity if it needs resizing (eg terminals with incremental
; size change), works only for grid
invert_on_resize = yes

; if true try expandig in vertical axis first
vertical_first = yes

; grid_2x2, grid_3x2, grid_3x3, custom
layout = grid_2x2

;ignore_actions = grid_height

[KEYS]
; section/point-name =  key
top-left = KP_7
top = KP_8
top-right = KP_9
left = Left
middle = Up
right = Right
bottom-right = KP_3
bottom = KP_2
bottom-left = KP_1

switch = Alt-KP_Divide
cycle = Alt-Shift-KP_Divide

; key modifiers (Alt, Shift, Ctrl, Super) for actions
float = Alt-Shift
expand = Alt-Shift
shrink = Alt-Shift
put = Super-Ctrl
; cycle widths
grid_width = Super
; cycle heights
grid_height = Ctrl-Shift

; exit PyWo
exit = Ctrl-Shift-Alt-Q
; reload configuration file
reload = Ctrl-Shift-Alt-R
; print info for current window
debug = Ctrl-Shift-Alt-I


I changed the configuration so it works almost like the windows alternative, with arrow and super key.

Grid: 2x2

Shortcuts:
Super+Left Arrow  = fill left half of screen
Super+Right Arrow = fill right half of screen
Super+Arrow Up = fill full screen


For list of shortcut/keys available check:
http://python-xlib.svn.sourceforge.net/viewvc/python-xlib/trunk/Xlib/keysymdef/miscellany.py?revision=151&view=markup&pathrev=151
http://python-xlib.svn.sourceforge.net/viewvc/python-xlib/trunk/Xlib/keysymdef/latin1.py?revision=151&view=markup&pathrev=151



Autostart the script:

LXDE:

To autostart a script in LXDE you create a .desktop file in ~/.config/autostart/.
If you are a awesome LXDE user, create ~/.config/autostart/pywo.desktop and fill in the following:


[Desktop Entry]
Encoding=UTF-8
Name=PyWo
Comment=Python Window Organizer
Exec=/home/charnley/settings/pywo-0.2/pywo.py
X-GNOME-Autostart-enabled=true

Where you substitute the Exec with the path to where you downloaded pywo too.



And that is it! Happy windowing!





No comments:

Post a Comment