Monday, May 16, 2011

Send key stroke to any running applications

Use wmctrl to find the windows id or name
Ex:
# wmctrl -l
0x00e00009  0 dara-K42JB root@dara-K42JB: ~/tips
0x01200003  0 dara-K42JB Snapshots - File Manager
0x01a0013a  0 dara-K42JB Oracle VM VirtualBox Manager
0x01c00118  0 dara-K42JB nokia (nokia) [Running] - Oracle VM VirtualBox
0x02200071  0 dara-K42JB wmctrl focus the current windows - Google - Mozilla Firefox
0x02800003  0 dara-K42JB Net Activity Viewer
0x01201c4a  0 dara-K42JB util - File Manager
0x02a00006  0 dara-K42JB Unknown Artist - Track 1 - VLC media player
0x02e00003  0 dara-K42JB john_wiley_&_sons_-_linux_timesaving_techniques_for_dummies.zip
0x03000008  0 dara-K42JB John Wiley & Sons - Linux Timesaving Techniques For Dummies.pdf - KPDF
0x03600081  0 dara-K42JB Synaptic Package Manager
0x03800009  0 dara-K42JB root@dara-K42JB: /home/dara

I will send "n" key to vlc to change to next song. then return to my current working shells.

#xvkbd -window vlc -text "n"; wmctrl -a tips




NOTE: vlc and tips can replace with with hex value
vlc:0x02a00006
tips:0x00e00009

---you have to install xvkbd and wmctrl to archive this task ---

No comments:

Post a Comment