Skip to content

Instantly share code, notes, and snippets.

@AeroNotix
Created February 4, 2012 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AeroNotix/1737379 to your computer and use it in GitHub Desktop.
Save AeroNotix/1737379 to your computer and use it in GitHub Desktop.
@hook.subscribe.client_new
def dialogs(window):
program_dict = {'firefox-aurora': 'Home',
'emacs': 'emacs',
'thunderbird': 'mail',
'urxvt': 'terminal',
'skype': 'skype'}
with open('/home/xeno/file', 'wb') as fname:
fname.write(window.window.get_wm_class()[0])
def closure(*args):
windowtype = window.window.get_wm_class()
with open('/home/xeno/file', 'wb') as fname:
fname.write(windowtype[0])
if windowtype:
try:
window.togroup(program_dict.pop(windowtype[0]))
except KeyError:
pass
return closure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment