Schurger.org

29 mai 2008

Setup usefull key bindings for metacity with python

Filed under: Code,Python — Jean Schurger @ 3:51

 As you will read the following script configure metacity to let you move your windows to the edges of your screen pressing the keys <Alt> + <Shift> + <the direction key of your choice>

Also it bind <Ctrl> + <Shift> + Up and <Ctrl> + <Shift> + Right to respectivly toggle vertical and horizontal window maximization.

#!/usr/bin/python

from gconf import Client

bindings = dict(
    move_to_side_e='<Alt><Shift>Right',
    move_to_side_w= '<Alt><Shift>Left',
    move_to_side_s= '<Alt><Shift>Down',
    move_to_side_n= '<Alt><Shift>Up',
    maximize_vertically= '<Ctrl><Shift>Up',
    maximize_horizontally= '<Ctrl><Shift>Right')

root = "/apps/metacity/window_keybindings"
c = Client()
for key in bindings.keys():
    c.set_value("%s/%s" % (root, key),
                bindings[key])

Laisser un commentaire

Powered by WordPress