In xfce I would like to switch to a particular workplace by pressing two keys after each other. for example first F2 and than the letter A. Control-A together is hard to type for me.
This program, switches to screen 0-9 and a-z, (11 - 37). It needs to callable
chmod +x switcher.py and be called by a shortcut in key/shortcuts.
import subprocess import Tkinter as tk class App(object): def __init__(self, master, **kwargs): self.master = master master.geometry('200x200+0+0') master.bind('<KeyPress>', self.react_to_keypress) master.after(2500, quit) def react_to_keypress(self, event): key = event.char.lower() try: int(key) except ValueError: if ord(key) < 97 or ord(key) > 122: return False else: key = str(ord(key) - 97 + 10) print key subprocess.call(["/usr/bin/wmctrl", "-s " + key]) def quit(self): self.master.quit() root = tk.Tk() app = App(root) root.mainloop()