MathCurvesSurfacesWallpaper GroupsGallerySoftwarePOV-Ray
ProgramingLinuxPerl PythonHTMLCSSJavaScriptPHPJavaLang DesignEmacsUnicode ♥

Linux: Keyboard Layout, Keymapping, Keybinding, Tools ⌨

, , …,

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.

xfce keyboard setting panel 2013-06-01
xfce keyboard setting panel
xfce window manager keys setup  2013-06-07
xfce window manager keys setup

For more advanced keyboarding, there are 2 steps to set keys in general:

Tool to Bind Key

if your desktop doesn't provide a way to bind a key to launch a script, then you can use xbindkeys.

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.

Tool for Key/Mouse Actions

Command Tool to Switch Windows: wmctrl

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:

Tool to Type Other Keys: xdotool

xdotool. «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

Tool to Expand Abbreviations: AutoKey

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)

Keyboard Layout Tools

• A Dvorak key layout with QWERTY layout for key shortcuts. https://code.google.com/p/dvorak-qwerty/

Swap Control & Alt

See: Linux: Swap Control and Alt Keys ⌨.

Misc

• Keycodes are described in /usr/include/X11/XF86keysym.h.

thanks to {Ci, meowcat}.

blog comments powered by Disqus