Take a look at localectl, especially following options:
localectl list-x11-keymap-layouts - gives you layouts
localectl list-x11-keymap-variants de gives you variants for this layout (or all variants if no layout specified)
localectl list-x11-keymap-options | grep grp: - gives you all layout switching options
Keypresses in X have 8 modifier bits:
Any key can be bound to any of these modifiers, but (as you might imagine) typically the left/right Shift keys are bound to Shift, Caps Lock is bound to Lock, and left/right Ctrl are bound to Control. Conspicuously missing from the list is Alt, which is usually bound to Mod1. ...
Okay, got it: this line in my /etc/default/keyboard
.. should not contain grp:alt_shift_toggle, which is the relevant xkb option according to this post.
In addition, Gnome overrides xkb options according to this other post. As a consequence, this output:
$ dconf read /org/gnome/desktop/input-sources/xkb-...
xmodmap is obsolete; so indeed it should be done with the xkb tools.
The swap you want seems not to be included by default with X11 files; so you have to write it yourself.
The page https://web.archive.org/web/20170825051821/http://madduck.net/docs/extending-xkb/ helped me to understand and find a way to do it.
Create a file ~/.xkb/keymap/mykbd where you ...
You need to add 0 or 2 into /sys/module/hid_apple/parameters/fnmode.
echo 2 > /sys/module/hid_apple/parameters/fnmode
There seems to be some confusion regarding what the difference between the two values might be. Quoting the Ubuntu documentation:
0 = disabled : Disable the 'fn' key. Pressing 'fn'+'F8' will behave
like you only press 'F8'
If you're wanting to do this on an Apple keyboard, try this out:
echo 1|sudo tee /sys/module/hid_apple/parameters/swap_opt_cmd
To get this to work for a lower version of Linux you can try this out:
Yes, Wayland uses XKB for keyboard layouts. But it's not quite the right question, because things work different than in X. Remember that Wayland is only a protocol (plus a wrapper library).
At the protocol level, wayland has a wl_keyboard.keymap event. This event contains a file descriptor to the keymap and a format classifier. Right now, only one format ...
One way to achieve that is via xmodmap. You can run xev to get key events. On running xev a box should appear and you can focus it and press the keys you want to swap. It should output details similar to for the Alt key:
KeyPress event, serial 28, synthetic NO, window 0x8800001,
root 0x25, subw 0x0, time 2213877115, (126,91), root:(1639,475),
state 0x0, ...
I often switch between English and Greek layouts and this has been a minor annoyance for a while. Your question pushed me to solve it, so thanks!
I found a program that can do this: xbindkeys. The proceedure I followed (adapted from here) was:
Install xbindkeys. On my Debian this is done with
sudo apt-get install xbindkeys
You should also be able to ...
An easy way would be to add the command to your $HOME/.profile file (you can create it if it doesn't exist):
That should make it run every time you log in.
Note that you should use $HOME/.profile rather than $HOME/.bash_profile, $HOME/.bashrc or some other similar file. This is because this setting should be read by your login manager.
You could set the corresponding xkb option via dconf-editor.
Navigate to org > gnome > desktop > input-sources and add grp:caps_toggle to your xkb-options:
Note each option is enclosed in single quotes, options are separated by comma+space.
On older gnome3 releases you could do that also via System Settings > Keyboard (or gnome-control-center keyboard in ...
If you only want to swap left alt and super key execute the command in your terminal:
setxkbmap -option altwin:swap_alt_win
To restore the default behavior just use:
Note: This is temporary. If you want the effects permanently add it to your startup file.
If you're looking for a way to visually edit configuration as in other answer, there's dconf-editor supplied with dconf-tools:
sudo aptitude install dconf-tools
If you fancy batch editing needed value, here's how you can read it:
dconf read /org/gnome/desktop/input-sources/xkb-options
And here's how to update it:
dconf write /org/gnome/desktop/input-...
The following commands should work:
xmodmap -e 'keycode 0x42 = Caps_Lock'
The commands above work just fine to restore the default behaviour, which I hardly ever need, luckily.
I normally remap the capslock to Control (luckily VI/VIM supports CTRL-C instead of ESC) with the following command:
setxkbmap -option ctrl:nocaps -layout ...
Try looking in /usr/share/X11/xkb/symbols as described on the setxkbmap man page. The options can be found in various files, try doing a grep -rinH alts_toggle /usr/share/X11/xkb. /usr/share/X11/xkb/rules/xorg.xml looks like a good choice.
At least for Arch, you have two types of configuration: via console and Xorg.
The easiest way without configuring Xorg:
$ sudo setxkbmap -layout us
You can see the current configuration with this:
$ setxkbmap -print -verbose 10
$ localectl status
To list all the available key maps or layouts:
$ localectl list-keymaps
You could use xkb-switch (-n switches to next layout):
or xkblayout-state (with set +1 to wrap around, in your case) :
xkblayout-state set +1
or xte from xautomation to simulate Control_L+Shift_L key press/release:
xte 'keydown Control_L' 'keydown Shift_L' 'keyup Shift_L' 'keyup Control_L'
Create a file containing your keycode changes, and save it as (for example) ~/.xkb/keycodes/local. (The keycodes directory is hard-coded; the base directory can be something else, and the filename too.) This will contain in your case
<PGUP> = 110;
<PGDN> = 112;
<DELE> = 115;
<INS> = 117;
<HOME> = 118;
Most laptops require pressing Fn to get the SysRq key. Pressing Fn usually doesn't affect the Alt key (at least the left one) but may affect the letter that you press after SysRq. Fortunately, you don't need to press SysRq and the third key together, it's enough to hold Alt down. The following sequence works on all the laptops I've seen:
Press and hold Alt.
as others remark, there are no standard compose rules in X for π, so if you want to use compose to make the π symbol (as I just did), you could:
put there the rules you need
do not forget to start the file with include "%L"
mine looks like this:
<Multi_key> <l> <l> : "ℓ" ...
You're almost there: the file is indeed ~/.XCompose. You can specify an alternate location with the XCOMPOSEFILE environment variable. See the Compose manual page.
The missing piece of the puzzle is that the file is read by each application when it starts. The Compose key is not handled by the X11 server, but by the X11 library. In theory, an application ...
Grub uses Emacs-like key bindings:
Ctrl+B = Left, Ctrl+F = Right (mnemonic: backward/forward)
Ctrl+P = Up, Ctrl+N = Down (mnemonic: up/down)
Ctrl+A = Home, Ctrl+E = End (mnemonic: A=beginning/end)
See the manual for other key bindings.
You can also define your own key layout and load it with the keymap command. This is not documented in the manual; the ...
On newer Debian and Ubuntu systems, your keyboard settings are put in /etc/default/keyboard and shared between X and the console. Just run
sudo dpkg-reconfigure keyboard-configuration
and select Compose key: Right Alt (AltGr) on the appropriate screen.
You could also put XKBOPTIONS=compose:ralt in /etc/default/keyboard and run
sudo dpkg-reconfigure ...
Don't use showkey or xev -- use udev and evtest instead.
Look at the output of evtest
No device specified, trying to scan all of /dev/input/event*
/dev/input/event0: Logitech Logitech USB Keyboard
/dev/input/event1: Logitech Logitech USB Keyboard
/dev/input/event2: Power Button
/dev/input/event3: Power Button
First, find the keysym which corresponds to Insert
$ xmodmap -pke | grep -i insert
This is probably key 118. To disable it globally run
$ xmodmap -e "keycode 118 ="
which causes that key to map to nothing at all.
Running this command every time your Xserver starts is very dependent upon which distribution and session manager you are using.
To get system where your locale is en_US.UTF-8 (assuming you want utf-8, which is recommended) and keyboard layout in both X.Org and virtual consoles is de-latin1-nodeadkeys, do these steps:
uncomment line "en_US.UTF-8" from /etc/locale.gen
(e.g. sed -i 's/#en_US.UTF-8/en-US.UTF-8/' /etc/locale.gen)
echo LANG=en_US.UTF-8 > /etc/locale.conf
There are a methods to do this. After installing the keyboard configuration package:
$ sudo yum install system-config-keyboard
2 packages will get installed.
From here you can then invoke system-config-...
Run the program xev from a terminal to see the keycode sent by the CapsLock key. That's the number just after keycode on the third line from the KeyPress event line corresponding to pressing the key. On a PC, the keycode is 66.
Create a file called .Xmodmap in your home directory and add the line
keycode 66 = Mode_switch