That would only work on a known operating system and window manager with known keyboard shortcuts, unless a terminal is already focused.
Great bit of example code, but opens a world of possibilities for what you could do with, say, a HID + Mass Storage composite device.
I type the above SO often every day, it should be on my gravestone. :D