# # X hotkeys with xbindkeys
APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

X hotkeys with xbindkeys

I've removed advertising from most of this site and will eventually clean up the few pages where it remains.

While not terribly expensive to maintain, this does cost me something. If I don't get enough donations to cover that expense, I will be shutting the site down in early 2020.

If you found something useful today, please consider a small donation.



Some material is very old and may be incorrect today

© September 2009 Girish Venkatachalam
by Girish Venkatachalam

Girish Venkatachalam is a UNIX hacker with more than a decade of networking and crypto programming experience. His hobbies include yoga,cycling, cooking and he runs his own business. Details here:

http://gayatri-hitech.com
http://spam-cheetah.com

xbindkeys is very easy to use when you wish to bind hotkey presses on X sessions. Either when you are on a xterm or otherwise. You have be within the Xwindow session, that is all. Typical Xwindow sessions span multiple virtual displays or workspaces and typically on linux you have Xwindow running on virtual terminal Alt + Ctrl + F7. Anyway I think you know what I mean.

I created a default keybindings file with

$ xbindkeys --defaults > $HOME/.xbindkeysrc

The syntax is braindead simple.

"pidgin"
  Control + b2 + Release
 

If you want to invoke pidgin when you press Ctrl key on the keyboard with the second mouse button.

But things get complicated. You have to know keycodes. You can easily find that by running

$ xbindkeys -k
 

It throws up a small white screen a la xev and you will know which keycode corresponds to which key.

After that just start the xbindkeys daemon with

$ xbindkeys
 

Every time you change a binding you have to restart this daemon or send the HUP signal.

$ pkill -HUP xbindkeys
 

I find that you can create a long command as a shell script and then bind it. That is more useful to me from a practical point of view.

For instance,

I create a /bin/playaudio file like this.

   #!/bin/sh
   mplayer /home/music/file1.mp3

And then chmod it.

# chmod +x /bin/playaudio
 

Then configure xkeybindings file like this.

"playaudio"

 Mod_M + b1
 

This will play a song when I press the useless Windows key along with mouse button 1.

Please refer to the command I gave above to figure out keycodes and keynames. It is very useful.

running cheetah
SpamCheetah
Stop spam dead in its tracks!

If you found something useful today, please consider a small donation.



Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

->
-> X hotkeys with xbindkeys


Inexpensive and informative Apple related e-books:

Sierra: A Take Control Crash Course

El Capitan: A Take Control Crash Course

Take Control of iCloud

iOS 10: A Take Control Crash Course

Take Control of the Mac Command Line with Terminal, Second Edition





More Articles by © Girish Venkatachalam





Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us


Printer Friendly Version





When someone says: "I want a programming language in which I need only say what I wish done", give him a lollipop. (Alan J. Perlis)




Linux posts

Troubleshooting posts


This post tagged:

Basics

GUI

Girish

Linux



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode