This page is a collection of keyboarding tools for Linux and a basic tutorial on how to use them.
If you are using a popular desktop such as Gnome, KDE, Ubuntu, Xfce, LXDE, your first stop is the Control Panel (aka Settings Manager, Preference Pane). There, usually there's apps named {Window Manager, keyboard}. The Window Manager is for all keys that control windows, such as {next/prev window, close window, max window, hide window, move window, cycle workspace, …}. The Keyboard one lets you set keys to launch apps, or swap modifiers. You can change keys for many default actions there. Also, you can create new keys to run a terminal command.
For more advanced keyboarding, there are 2 steps to set keys in general:
if your desktop doesn't provide a way to bind a key to launch a script, then you can use xbindkeys.
«xbindkeys is a program that allows you to launch shell commands with your keyboard or your mouse under X Window. It links commands to keys or mouse buttons, using a configuration file. It's independent of the window manager and can capture all keyboard keys (ex: Power, Wake…).»
xbindkeys home page: http://www.nongnu.org/xbindkeys/xbindkeys.html
xbindkeys can bind almost any key or key combination. Example: Caps Lock, ScrLk, Pause, F2, number pad keys, multimedia keys, and special app launch buttons, and also standard modifier key combinations such as ▤ Menu, 【Ctrl+3】, 【❖ Super+3】, etc.
Install: sudo apt-get install xbindkeys.
There's also a GUI wrapper: sudo apt-get install xbindkeys-config
You must first create the config file yourself. Do:
xbindkeys -d > ~/.xbindkeysrc
The xbindkeys -d will print out a default config sample file.
Then, either manually modify the config file, when done, sent it a HUP signal to apply your change, like this killall -HUP xbindkeys.
Or, launch the GUI tool to set keys by xbindkeys-config &.
The hard part is the action part. You need to find write a shell command. Basically, call command that do what you want, ⁖ switch to a specific app, or press some other key such as 【Ctrl+w】 for close tab. The hard part is figuring out the syntax of this action command.
wmctrl is a command line util to manipulate windows. ⁖ {switch, close, move, resize, set title, list, … }.
To install: sudo apt-get install wmctrl
Example use:
wmctrl -xa emacs switch to the window class name that contains “emacs”. (use this to switch apps. Use xprop to get the name of a app's window class name.)wmctrl -a emacs switch to the window whose name contains “emacs”wmctrl -c firefox Close a window whose name contains “firefox”wmctrl -l list all windowsxdotool. «programatically simulate keyboard input and mouse activity. It does this using X11's XTEST extension and other Xlib functions.»
Install: sudo apt-get install xdotool
Example. Send 【Ctrl+w】 to close tab.
xdotool key --delay 40 Control_L+w
Example. Click on upper left corner, (90, 10) pixels.
xdotool mousemove 90 10 click 1
AutoKey. For expanding abbrev to full words/text.
Install:
sudo apt-get install autokey-gtk (for Gnome) or
sudo apt-get install autokey-qt (for KDE)
man setxkbmapman xmodmap (Sample xmodmap file: dvorakKeymap.txt 、
xmodmap_dump_2013-01-11.txt)man xev to find keycodes and scancodesman xset Set mouse speed, etc.• A Dvorak key layout with QWERTY layout for key shortcuts. https://code.google.com/p/dvorak-qwerty/
See: Linux: Swap Control and Alt Keys ⌨.
• Keycodes are described in /usr/include/X11/XF86keysym.h.
thanks to {Ci, meowcat}.