Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
20
votes
9
answers
30198
views
Map Caps Lock to Control in Linux Mint
I am running the latest version of Linux Mint with Cinnamon. I'm trying to map Caps Lock to Ctrl , but I cannot figure out how to do it. All web searches I've done have led me to older versions of Linux Mint (there is no keyboard layout option in my settings). How can I do this?
I am running the latest version of Linux Mint with Cinnamon. I'm trying to map Caps Lock to Ctrl, but I cannot figure out how to do it. All web searches I've done have led me to older versions of Linux Mint (there is no keyboard layout option in my settings). How can I do this?
Zach Russell
(1127 rep)
Feb 7, 2014, 11:59 AM
• Last activity: Jul 11, 2025, 07:02 PM
1
votes
1
answers
2508
views
How can I bind "modifier + arrow" keys to home/end/pageup/pagedown under X?
I have a new 60% keyboard (NuPhy Air60), but it does not have any way to trigger pageup/pagedown or home/end keys. My goal is to recover these commands with a custom keybinding, using a modifier key like `hyper` or `alt`, in combination with the arrow keys. For my preference, something like: - alt +...
I have a new 60% keyboard (NuPhy Air60), but it does not have any way to trigger pageup/pagedown or home/end keys.
My goal is to recover these commands with a custom keybinding, using a modifier key like
hyper
or alt
, in combination with the arrow keys. For my preference, something like:
- alt + arrowup = pageup
- alt + arrowdown = pagedown
- alt + arrowleft = home
- alt + arrowright = end
I tried to use xmodmap
to make the bindings -- but unfortunately due to a years-old known chromium bug, my bindings there did not work in Chrome or VSCode.
What else can be done?
ChaseMoskal
(111 rep)
Mar 13, 2023, 12:08 AM
• Last activity: Jul 6, 2025, 07:08 AM
0
votes
0
answers
17
views
Keys behaving differently when copying Xmodmap from Arch to Kali
I have copied my keyboard config(.Xmodmap file) from arch to kali. It is sourced in .xsessions and some keys work fine. However some keys are not good, for example I use the first letter row of the keyboard with AltGr to write numbers. But Now using AltGr with a does not write 1 however using it wit...
I have copied my keyboard config(.Xmodmap file) from arch to kali. It is sourced in .xsessions and some keys work fine.
However some keys are not good, for example I use the first letter row of the keyboard with AltGr to write numbers. But Now using AltGr with a does not write 1 however using it with e writes 3. Also when I press the alt-space it is intended to swap the languages of input however it takes 3 presses to get to the language and in between is either random characters or the layout that I want when I press AltGr ( the first letter line becomes numbers but without me pressing AltGr)
Here for example why is 3 working and 1 not:
keycode 24 = a A Arabic_dad Arabic_fatha 1 AE NoSymbol U2066
keycode 25 = z Z Arabic_sad Arabic_fathatan 2 less NoSymbol U2067
keycode 26 = e E Arabic_theh Arabic_damma 3 cent NoSymbol U2068
N0tus3r
(43 rep)
Jun 30, 2025, 06:38 PM
8
votes
5
answers
2624
views
xmodmap lost after sleep
In Ubuntu 18.04 I use the following autostart script: ``` [Desktop Entry] Type=Application Exec=/home/user/.xinitrc Version=1.0 X-GNOME-Autostart-enabled=true Name=xmodmap Comment=xmodmap script ``` which just `xmodmap /path/.Xmodmap &`. When the system boots up, it works. When the system awakes fro...
In Ubuntu 18.04 I use the following autostart script:
[Desktop Entry]
Type=Application
Exec=/home/user/.xinitrc
Version=1.0
X-GNOME-Autostart-enabled=true
Name=xmodmap
Comment=xmodmap script
which just xmodmap /path/.Xmodmap &
.
When the system boots up, it works. When the system awakes from sleep, the remapping no longer works. How can I fix this?
EDIT: (reply to a comment)
This also does not fix the issue:
$ cat /etc/systemd/system/xmodmapbindings.service
[Unit]
Description=xmodmap bindings
Before=sleep.target
StopWhenUnneeded=yes
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStop=-/home/norake/.xinitrc
[Install]
WantedBy=sleep.target
$ cat ~/.xinitrc
#!/bin/bash
if [ "$USER" != norake ]; then
su norake -c 'sleep 5; /usr/bin/xmodmap /home/norake/.Xmodmap' &
# without su, without sleep, without fork (&): doesn't work either
else
(sleep 5; /usr/bin/xmodmap /home/norake/.Xmodmap) &
fi
sleep 30
doesn't work either. Of course the script run manually works.
norake
(135 rep)
Mar 9, 2019, 06:10 PM
• Last activity: May 7, 2025, 05:31 PM
0
votes
0
answers
45
views
How can I use xmodmap to remap keys when I have language layouts interfering?
I want to remap my "Alt+ijkl" keys to "up,left,down,right", but when I look for my key mappings with `xmodmap -pke` I get : keycode 31 = i I Cyrillic_sha Cyrillic_SHA rightarrow idotless Arabic_ha division NoSymbol U202C keycode 44 = j J Cyrillic_o Cyrillic_O dead_hook dead_horn Arabic_teh Arabic_ta...
I want to remap my "Alt+ijkl" keys to "up,left,down,right", but when I look for my key mappings with
xmodmap -pke
I get :
keycode 31 = i I Cyrillic_sha Cyrillic_SHA rightarrow idotless Arabic_ha division NoSymbol U202C
keycode 44 = j J Cyrillic_o Cyrillic_O dead_hook dead_horn Arabic_teh Arabic_tatweel
keycode 45 = k K Cyrillic_el Cyrillic_EL kra ampersand Arabic_noon Arabic_comma U066B
keycode 46 = l L Cyrillic_de Cyrillic_DE lstroke Lstroke Arabic_meem slash Arabic_kaf colon Arabic_gaf
The xmodmap docu on arch wiki seems to contradict this, as the arabic is to the right of the ISO_Level3_Shift which I assume is AlrGr :
Each keysym column in the table corresponds to a particular combination of modifier keys:
1. Key
2. Shift+Key
3. Mode_switch+Key
4. Mode_switch+Shift+Key
5. ISO_Level3_Shift+Key
6. ISO_Level3_Shift+Shift+Key
Alt_L doesn't seem to be reflected anywhere in my config and actually the rows can have more or less columns too.
I had been using KDE's own remapping and later input-remapper when they changed but after all the tutorials who seem to show this remapping as trivial with xmodmap (eg `xmodmap -e "keycode 44 = j J Left"
`), I can't find how to solve my problem. I've tried reading the links in this answer about these virtual modifiers but it's not helping.
sinekonata
(141 rep)
Feb 6, 2025, 03:14 AM
2
votes
0
answers
47
views
Problem when remapping caps lock to escape using xmodmap
I am using arch linux.I made some key modifications and one of them is caps lock to escape (this is why i used xmodmap instead of the setxkbmap one line swap escape) the problem is when adding "clear lock" to .Xmodmap for some reason special keys that are written using AltGr for example brackets (i...
I am using arch linux.I made some key modifications and one of them is caps lock to escape (this is why i used xmodmap instead of the setxkbmap one line swap escape) the problem is when adding "clear lock" to .Xmodmap for some reason special keys that are written using AltGr for example brackets (i am using a french keyboard) stop working.
the part where the keys are swapped :
clear lock
keycode 66 = Escape NoSymbol Escape
keycode 9 = Caps_Lock NoSymbol Caps_Lock
add lock = Caps_Lock
the contents of 00-keyboard.conf
Section "Input Class"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "fr,ara"
Option "XkbModel" "pc102"
Option "XkbVariant" "azerty,azerty"
Option "XkbOptions" "grp:win_space_toggle,caps:escape"
EndSection
and my xinitrc has xmodmap.
is there a solution to this or can you use both setxkbmap (for swapping caps:escape) and xmodmap(for other changes) at the same time(is there a way to disable setxkbmap setting all changes to default and only use the option specified)
N0tus3r
(43 rep)
Sep 10, 2024, 04:54 PM
0
votes
0
answers
51
views
Why does xmodmap does not work in some native Linux games?
Something that has been annoying me for a bit is that my `caps:escape` xmodmap option does not work in some games including Minecraft and Team Fortress 2. When pressing the capslock/escape button, nothing happens; it triggers neither an escape key event nor letter capitalisation toggle. This is cons...
Something that has been annoying me for a bit is that my
caps:escape
xmodmap option does not work in some games including Minecraft and Team Fortress 2.
When pressing the capslock/escape button, nothing happens; it triggers neither an escape key event nor letter capitalisation toggle. This is consistent across Xorg (i3) and Wayland/xwayland (Hyprland).
I can't find a determining factor that is consistent across all scenarios because it does work in Cities:Skylines. Looking at libraries/APIs used, all games use OGL, C:S and TF2 use SDL2 and the bug is present in MC eventhough it uses the LWJGL/GLFW middleware and generally has very little in common with the other two games.
What could be the cause and how can I make it use my xmodmap options?
(I'm not interested in alternatives to using xmodmap, I'm aware you could achieve a capslock remap through different means.)
Atemu
(857 rep)
Aug 10, 2024, 08:12 AM
1
votes
0
answers
95
views
Remapping keypad keys with xkb
``` TL;DR I have a configuration for remapping keys in xkb, which I think should work. setxkbmap reads it without error, but there's no effect.``` I'm trying to remap my numpad keys to navigation keys. I used to use `xmodmap` with the following configuration: ``` keycode 79 = Insert NoSymbol Insert...
TL;DR I have a configuration for remapping keys in xkb, which I think should work. setxkbmap reads it without error, but there's no effect.
I'm trying to remap my numpad keys to navigation keys. I used to use xmodmap
with the following configuration:
keycode 79 = Insert NoSymbol Insert
keycode 80 = Home NoSymbol Home
keycode 81 = Prior NoSymbol Prior
keycode 83 = Delete NoSymbol Delete
keycode 84 = End NoSymbol End
keycode 85 = Next NoSymbol Next
But after switching to a new system (Fedora 40) I noticed that it doesn't work. A quick search gave m the reason why: the new systems are using xkb
and while I might still use xmodmap
, it's config will be overwritten by xkb
.
After some trying I came up with the following config:
partial keypad_keys xkb_symbols "num_independent" {
key { [ KP_Insert, KP_Insert ] };
key { [ KP_Home, KP_Home ] };
key { [ KP_Prior, KP_Prior ] };
key { [ KP_Delete, KP_Delete ] };
key { [ KP_End, KP_End ] };
key { [ KP_Next, KP_Next ] };
};
Saved it to /usr/share/X11/xkb/symbols/numnav
, then added numnav:num_independent = +numnav(num_independent)
to /usr/share/X11/xkb/rules/evdev
uder ! option = symbols
. Also added the following to /usr/share/X11/xkb/rules/evdev.lst
under ! option
:
numnav Using NumPad keys as navigation keys
numnav:num_independent NumPad keys behaving as navigation keys regardless of NumLock status
Finally setxkbmap -v 10 -option 'numnav:num_independent'
confirmed that the new config was read without error. Here's the output:
Setting verbose level to 10
WARNING: Running setxkbmap against an Xwayland server
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules: evdev
model: pc105
layout: us
options: numnav:num_independent
Trying to build keymap using the following components:
keycodes: evdev+aliases(qwerty)
types: complete
compat: complete
symbols: pc+us+inet(evdev)+numnav(num_independent)
geometry: pc(pc105)
Sadly, the changes made no effect.
So I tried another possibility for /usr/share/X11/xkb/symbols/numnav
:
partial keypad_keys xkb_symbols "num_independent" {
replace key { [ KP_Insert], type[group1] = "ONE_LEVEL" };
replace key { [ KP_Home], type[group1] = "ONE_LEVEL" };
replace key { [ KP_Prior], type[group1] = "ONE_LEVEL" };
replace key { [ KP_Delete], type[group1] = "ONE_LEVEL" };
replace key { [ KP_End], type[group1] = "ONE_LEVEL" };
replace key { [ KP_Next], type[group1] = "ONE_LEVEL" };
};
here also setxkbmap
doesn't retur any error, but there's no effect. What I'm doing wrong?
Peter C
(11 rep)
Jul 14, 2024, 02:20 PM
0
votes
1
answers
872
views
How to find the keycodes for remapping Control and Super keys using xmodmap on X11
I am trying to swap my Super_L and Control_L keys on my keyboard. I determine the keycodes for remapping these keys using `xev`, `showkey`, and `xmodmap` itself. They provide me different keycodes but none of them works when I use them to swap the functionality. I have gone through other posts (e.g....
I am trying to swap my Super_L and Control_L keys on my keyboard. I determine the keycodes for remapping these keys using
xev
, showkey
, and xmodmap
itself. They provide me different keycodes but none of them works when I use them to swap the functionality.
I have gone through other posts (e.g. this ) and have tried what has been suggested already. But, nothing has worked out for me. Please help me determine why my key swap is not working.
Things to note -
* key swap is working fine for other standard keys.
* key code are swapped when inspected after remap in xev
or xmodmap
but their function do not change.
* I have installed i3wm on Ubuntu 24.04.
* I have a Logitech MX Keys Mini keyboard connected to my system over bluetooth.
Keycodes without any remapping:
$ xmodmap -pke | grep -i super
keycode 133 = Super_L NoSymbol Super_L
keycode 134 = Super_R NoSymbol Super_R
keycode 206 = NoSymbol Super_L NoSymbol Super_L
$ xmodmap -pke | grep -i control
keycode 37 = Control_L NoSymbol Control_L
keycode 105 = Control_R NoSymbol Control_R
$ xev | awk -F'[ )]+' '/^KeyPress/ { a[NR+2] } NR in a { printf "%-3s %s\n", $5, $8 }'
37 Control_L
133 Super_L
$ sudo showkey kb mode was ?UNKNOWN?
[ if you are trying this under X, it might not work
since the X server is also reading /dev/console ]
press any key (program terminates 10s after last keypress)...
keycode 28 release
keycode 29 press --------- corresponds to Control_L
keycode 29 release --------- corresponds to Control_L
keycode 125 press --------- corresponds to Super_L
keycode 125 release --------- corresponds to Super_L
Lone Wolf
(31 rep)
Jul 10, 2024, 03:33 AM
• Last activity: Jul 11, 2024, 03:14 AM
2
votes
0
answers
56
views
Setting modifier using xmodmap
I am using GNU/Linux (Devuan) with the mate desktop and with i3wm. I would like to assign `mod1` to `Meta_L`. If I show the current assignment with $ xmodmap I get mod1 Alt_L (0x40), Meta_L (0xcd) So I tried the following: $ xmodmap -e "clear mod1" $ xmodmap xmodmap: up to 4 keys per modifier, (keyc...
I am using GNU/Linux (Devuan) with the mate desktop and with i3wm.
I would like to assign
mod1
to Meta_L
. If I show the current assignment with
$ xmodmap
I get
mod1 Alt_L (0x40), Meta_L (0xcd)
So I tried the following:
$ xmodmap -e "clear mod1"
$ xmodmap
xmodmap: up to 4 keys per modifier, (keycodes in parentheses):
...
mod1
and then
$ xmodmap -e "add mod1 = Meta_L"
$ xmodmap
...
mod1 Alt_L (0x40), Meta_L (0xcd)
So, I am getting the old assignment back.
I am not sure what is happening. Am I doing something wrong or is xmodmap
or some other program ignoring / overriding my assignment?
Giorgio
(847 rep)
Mar 15, 2024, 11:30 AM
2
votes
2
answers
2447
views
How to remap a regular key into a modifier key (Shift...) in Linux
On my new laptop keyboard, there's a strange key next to my shift key. Frankly it's useless to me and having a shorter shift key doesn't let me reach some of the combinations that I was used to. I'd like to turn it that key into a left shift as well so that I have one long left shift again. [
henry_the_brave
(23 rep)
Jul 1, 2023, 12:17 PM
• Last activity: Mar 3, 2024, 08:58 PM
4
votes
3
answers
4954
views
Map Right Alt to Alt instead of AltGr
I have a Kinesis Advantage keyboard and I'm trying to make it so that my right and left Alt keys do the same thing. Currently the left Alt key works as expected but the right Alt key just allows me to type foreign characters. I found the [following answer to another question][1] to be very helpful,...
I have a Kinesis Advantage keyboard and I'm trying to make it so that my right and left Alt keys do the same thing. Currently the left Alt key works as expected but the right Alt key just allows me to type foreign characters.
I found the following answer to another question to be very helpful, but I can't get similar results. Here's what I see when I type
xmodmap
:
$ xmodmap
xmodmap: up to 4 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x32), Shift_R (0x3e)
lock
control Control_L (0x25), Control_R (0x69)
mod1 Alt_L (0x40), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
In my case I don't have an Alt_R
key mapped to any of my mod keys. When that's the case what should I do?
Tom Purl
(455 rep)
Apr 29, 2015, 03:27 AM
• Last activity: Jan 26, 2024, 04:37 PM
11
votes
4
answers
8660
views
Remapping caps-lock to escape, and menu to compose, on the linux console
When running X I use a .xmodmaprc to remap certain keys thusly: ! Make it so that both Caps Lock and Escape do Escape clear Lock keysym Caps_Lock = Escape ! Remap the menu key as Compose keysym Menu = Multi_key How can I accomplish the same things on the console? ## update In addition to the partial...
When running X I use a .xmodmaprc to remap certain keys thusly:
! Make it so that both Caps Lock and Escape do Escape
clear Lock
keysym Caps_Lock = Escape
! Remap the menu key as Compose
keysym Menu = Multi_key
How can I accomplish the same things on the console?
## update
In addition to the partial solution given in my answer, I've learned that the console maps CTRL-
.
to Compose. So I may be able to get used to that. Setting up the Menu key as Compose is not so easily done, as there are a ton of nul-assigned keycodes and no obvious contender for an alternate name for Menu.
I've also realized that the compose bindings themselves are much more limited than what I'm used to under X, and that most of the special characters I use frequently are not there. Perhaps there is a utility that will translate X-syntax compose bindings into something that loadkeys
can read?
intuited
(3578 rep)
Feb 19, 2011, 01:35 PM
• Last activity: Jan 24, 2024, 01:10 PM
1
votes
0
answers
84
views
keyboard FN keys send ctrl+a, ctrl+c, ctrl+v instead of unique events
I have a keyboard whose F2, F3, F4 keys send `ctrl+a`, `ctrl+c`, `ctrl+v` events respectively instead of a unique keycode which could be remapped easily using xmodmap keycode mapping. My goal is to use the keyboard's function keys as function keys instead of media keys, without having to press the k...
I have a keyboard whose F2, F3, F4 keys send
ctrl+a
, ctrl+c
, ctrl+v
events respectively instead of a unique keycode which could be remapped easily using xmodmap keycode mapping.
My goal is to use the keyboard's function keys as function keys instead of media keys, without having to press the keyboard's Fn modifier. The keyboard doesn't appear to support a built-in FN-switch to send FN keys by default.
How can I achieve this mapping?
Looking at the xev logs, the events appear indistinguishable:
Real ctrl+a
keypress:
KeyPress event, serial 33, synthetic NO, window 0x2a00001,
root 0x79a, subw 0x0, time 59266583, (648,900), root:(648,900),
state 0x0, keycode 66 (keysym 0xffe3, Control_L), same_screen YES,
XKeysymToKeycode returns keycode: 37
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 36, synthetic NO, window 0x2a00001,
root 0x79a, subw 0x0, time 59266869, (647,899), root:(648,900),
state 0x4, keycode 38 (keysym 0x61, a), same_screen YES,
XLookupString gives 1 bytes: (01) ""
XmbLookupString gives 1 bytes: (01) ""
XFilterEvent returns: False
KeyRelease event, serial 36, synthetic NO, window 0x2a00001,
root 0x79a, subw 0x0, time 59266989, (647,899), root:(648,900),
state 0x4, keycode 38 (keysym 0x61, a), same_screen YES,
XLookupString gives 1 bytes: (01) ""
XFilterEvent returns: False
KeyRelease event, serial 36, synthetic NO, window 0x2a00001,
root 0x79a, subw 0x0, time 59266989, (647,899), root:(648,900),
state 0x4, keycode 66 (keysym 0xffe3, Control_L), same_screen YES,
XKeysymToKeycode returns keycode: 37
XLookupString gives 0 bytes:
XFilterEvent returns: False
Pressing the F2 key:
KeyPress event, serial 33, synthetic NO, window 0x2a00001,
root 0x79a, subw 0x0, time 59337346, (648,900), root:(648,900),
state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 33, synthetic NO, window 0x2a00001,
root 0x79a, subw 0x0, time 59337346, (648,900), root:(648,900),
state 0x4, keycode 38 (keysym 0x61, a), same_screen YES,
XLookupString gives 1 bytes: (01) ""
XmbLookupString gives 1 bytes: (01) ""
XFilterEvent returns: False
KeyRelease event, serial 36, synthetic NO, window 0x2a00001,
root 0x79a, subw 0x0, time 59337451, (648,900), root:(648,900),
state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 36, synthetic NO, window 0x2a00001,
root 0x79a, subw 0x0, time 59337451, (648,900), root:(648,900),
state 0x0, keycode 38 (keysym 0x61, a), same_screen YES,
XLookupString gives 1 bytes: (61) "a"
XFilterEvent returns: False
The keyboard's brand is listed as EOENKK.
Output of bluetoothctl info
:
[Bluetooth Keyboard]# info 15:10:40:4F:00:07
Device 15:10:40:4F:00:07 (public)
Name: Bluetooth Keyboard
Alias: Bluetooth Keyboard
Appearance: 0x03c1
Icon: input-keyboard
Paired: yes
Bonded: yes
Trusted: no
Blocked: no
Connected: yes
WakeAllowed: yes
LegacyPairing: no
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
UUID: Human Interface Device (00001812-0000-1000-8000-00805f9b34fb)
UUID: Unknown (0000ff50-0000-1000-8000-00805f9b34fb)
Modalias: usb:v04E8p7021d0300
ManufacturerData Key: 0x4b51
ManufacturerData Value:
49 45 IE
[Bluetooth Keyboard]#
A picture of the keyboard: 
ealfonso
(993 rep)
Oct 8, 2023, 09:55 PM
• Last activity: Oct 9, 2023, 04:44 PM
25
votes
9
answers
32182
views
How to permanently swap esc and caps lock in xfce / xubuntu?
I followed some post a while ago, and it said to make an `~/.xmodmap` file like so: ! Swap caps lock and escape remove Lock = Caps_Lock keysym Escape = Caps_Lock keysym Caps_Lock = Escape add Lock = Caps_Lock I did, and it now I can swap `esc` and `caps lock` by doing `xmodmap ~/.xmodmap`. I wanted...
I followed some post a while ago, and it said to make an
~/.xmodmap
file like so:
! Swap caps lock and escape
remove Lock = Caps_Lock
keysym Escape = Caps_Lock
keysym Caps_Lock = Escape
add Lock = Caps_Lock
I did, and it now I can swap esc
and caps lock
by doing xmodmap ~/.xmodmap
. I wanted this to be permanent, so I added that command to my ~/.bash_profile
, but it doesn't seem to work; I still have to manually xmodmap
. As an EEng dropout, I am tempted to just rewire my keyboard }:-) but I know there must be a better way. How can I make this work, permanently?
Dan Ross
(655 rep)
Mar 4, 2013, 05:45 AM
• Last activity: Sep 16, 2023, 01:29 PM
3
votes
2
answers
4512
views
Bind CapsLock+hjkl to arrow keys
I want to bind Caps Lock + H / J / K / L to arrow keys.  I found two ways that each have some issues: **Solution 1** Using `xkb`: Edit `/usr/share/X11/xkb/symbols/us` first block. ``` # replace Caps with AltGr key { [ ISO_Level3_Shift ] }; # Add vim cursor keys to be accessed with AltGr ke...
I want to bind Caps Lock + H / J / K / L to arrow keys.
I found two ways that each have some issues:
**Solution 1**
Using
xkb
: Edit /usr/share/X11/xkb/symbols/us
first block.
# replace Caps with AltGr
key { [ ISO_Level3_Shift ] };
# Add vim cursor keys to be accessed with AltGr
key { [ x, X, Delete, Delete ] };
key { [ s, S, KP_Enter, KP_Enter ] };
key { [ d, D, Next, Next ] };
key { [ f, F, BackSpace, BackSpace ] };
key { [ h, H , Left, Left ] };
key { [ j, J, Down, Down ] };
key { [ k, K, Up, Up ] };
key { [ l, L, Right, Right ] };
key { [ u, U, Prior, Prior ] };
key { [ 3, section, Home, Home ] };
key { [ 4, dollar, End, End ] };
but this answer doesn't work in Java programs (e.g., IntelliJ),
so I should use solution 2.
**Solution 2**
Using xmodmap
: Create ~/.xmodmap
file with following content:
keycode 66 = Mode_switch
keysym h = h H Left
keysym l = l L Right
keysym k = k K Up
keysym j = j J Down
keysym u = u U Prior
keysym i = i I Home
keysym o = o O End
keysym p = p P Next
and then run xmodmap ~/.xmodmap
command.
**Problem:** This solution breaks other layouts. It works in English, but when I switch other layout, e.g., to Russian, I cannot type letters on these keys and Caps + H / J / K / L also don't work
until I switch back to English. How can I solve this problem?
Mehran Prs
(141 rep)
Aug 1, 2019, 08:35 AM
• Last activity: Sep 1, 2023, 07:02 AM
0
votes
0
answers
73
views
Mapping upper left esc key to fn
Is it possible to map the upper left `esc` key to `fn`? How? Apparently `xmodmap` is deprecated and you should use something like `setxkbmap` instead. I tried something like: ``` xmodmap -e "keycode 1 = 464" ``` where `esc` has keycode 1 and `fn` has keycode 464, but I got the error: ``` xmodmap: co...
Is it possible to map the upper left
esc
key to fn
? How?
Apparently xmodmap
is deprecated and you should use something like setxkbmap
instead.
I tried something like:
xmodmap -e "keycode 1 = 464"
where esc
has keycode 1 and fn
has keycode 464, but I got the error:
xmodmap: commandline:1: bad keycode value (out of range)
xmodmap: 1 error encountered, aborting.
System information:
Linux 5.19.0-46-generic #47~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Jun 21 15:35:31 UTC 2 x86_64
(Kde Neon on a Macbook Pro 2015).
justsome631
(163 rep)
Aug 13, 2023, 05:09 PM
1
votes
1
answers
639
views
How to remap keys to work with KVM switch
I have a KVM switch for which the hot-key is ` ` ` `. The hot key lets me switch the keyboard, video and mouse from a Windows machine to a Linux machine, but not vice-versa. My recollection is that I used to have it working with an xmodmap remapping, but I no longer have the remapping in my profile...
I have a KVM switch for which the hot-key is `
`. The hot key lets me switch the keyboard, video and mouse from a Windows machine to a Linux machine, but not vice-versa. My recollection is that I used to have it working with an xmodmap remapping, but I no longer have the remapping in my profile and I don't recall what I mapped to what.
I feel like my question is asking how do I remap the ` key to the
key but somehow get a different result. Normally I would say that is stupid, but the keysym columns, the modN keys and the key notation in xmodmap are all black magic to me and I have no idea what I should be looking for. The fact that I do not see
scroll lock` in the list makes me think that something can be done.
$ xmodmap -pm
xmodmap: up to 4 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69)
mod1 Alt_L (0x40), Alt_R (0x6c), Alt_L (0xcc), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3 ISO_Level5_Shift (0xcb)
mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c)
StrongBad
(5491 rep)
Jul 13, 2023, 04:23 PM
• Last activity: Jul 26, 2023, 06:37 PM
1
votes
1
answers
594
views
Map <C-S-A-hjkl> to Arrow Keys with XKB Map
I'm trying to also have access to my arrow keys from the default Vim h j k l . Since Ctrl Shift Alt seems to be a rare key combo, I was thinking about using that. How would I do that using `setxkbmap` (or another equivalent tool)?
I'm trying to also have access to my arrow keys from the default Vim hjkl.
Since CtrlShiftAlt seems to be a rare key combo, I was thinking about using that.
How would I do that using
setxkbmap
(or another equivalent tool)?
psygo
(233 rep)
Jun 1, 2023, 05:17 PM
• Last activity: Jun 13, 2023, 11:31 AM
0
votes
1
answers
51
views
Is it possible to change Alt_R+8 = bracketleft to Alt_L+8 = bracketleft
When pressing Alt_R + 8 it prints `XKeysymToKeycode returns keycode: 34` and I started to wonder if it's possible to emulate this with different key combo. It's a pain to output brackets using right alt and I'm looking to fix this.
When pressing Alt_R+8 it prints
XKeysymToKeycode returns keycode: 34
and I started to wonder if it's possible to emulate this with different key combo.
It's a pain to output brackets using right alt and I'm looking to fix this.
geesebeater
(3 rep)
Jun 8, 2023, 07:40 AM
• Last activity: Jun 8, 2023, 09:27 AM
Showing page 1 of 20 total questions