Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 2 down vote accepted

This program, switches to screen 0-9 and a-z, (11 - 37). It needs to callable chmod +x 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.bind('<KeyPress>', self.react_to_keypress)
        master.after(2500, quit)

    def react_to_keypress(self, event):
        key = event.char.lower()
        except ValueError:
            if ord(key) < 97 or ord(key) > 122:
                return False
                key = str(ord(key) - 97 + 10)
                print key["/usr/bin/wmctrl", "-s " + key])

    def quit(self):

root = tk.Tk()
app = App(root)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.