Begone Caps Lock and Other Great Keyboard Hacks
Begone, Vile Caps Lock!
Want to get rid of the evil caps lock key without mutilating your keyboard? Want to give those silly Windows keys useful jobs, or put all those extra multi-media keys to work? Want to become a powerhouse keyboarding commando? Then come along and join the fun, because Linux has all kinds of good tools for taming wayward keyboards and increasing your efficiency. In this two-part series we're going to use xmodmap, XBindKeys, and KeyTouch to create custom keybindings for launching applications and running commands.
Exorcising Caps Lock
This command reverses whatever position the caps lock key is in, so first make sure it is not on:
$ xmodmap -e "remove lock = Caps_Lock"
What if you do this when caps lock is on? One remedy is get used to typing like a dork: "dEAR jUPITERMEDIA, i WANT MORE STORIES ABOUT hp, ibm, AND dELL." Or you could fix it. First run this command:
$ xmodmap -e "add lock = Caps_Lock"
Then make sure it is not on, and re-run the "remove lock" command.
This won't survive a reboot, so put it in your ~/.bashrc file to make it permanent.
XBindKeys For Launching Applications
KDE and GNOME, window managers like IceWM and Fluxbox, and many applications come with their own set of prefab keybindings. You should investigate these before going on a customization spree, or you run the risk of creating conflicts.We're going to learn how to use XBindKeys. XBindKeys is not dependent on any particular desktop or window manager, and should run on pretty much any Linux or Unix system."
The easy way is to install xbindkeys-config along with xbindkeys, which gives you a typically plain GTK-based graphical configuration tool, as Figure 1 shows.
xbindkeys-config comes with Debian and all of its descendants. If you want an RPM and can't find one, get the source tarball from the Debian repository.
Launching graphical applications with root privileges is easy when you know a few slick tricks. In this example I have configured the left Windows key to launch a root file manager, and the right Windows key to launch a root text editor. Before you do anything else you must create a default configuration file with this command:
$ xbindkeys --defaults > $HOME/.xbindkeysrc
xbindkeys won't work without this. Take a look at it to get an idea of how to manually configure it; you might even make a copy to study, because xbindkeys-config will overwrite it.
Next, follow these steps to create a new keybinding:
- Hit the "New" button in xbindkeys-config
- Press "Get Key"
- Press a key or key combination on your keyboard
- On the "Action" line, type in your command
- Press "Run Action" to test it
- If it works, hit Apply and do more keybindings, or hit Save&Apply&Exit. Your changes will not be saved until you press the Save&Apply&Exit button
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.