You are not logged in.

#1 2023-08-31 07:54:59

ryukk
Member
Registered: 2023-08-31
Posts: 1

how can I elegently map <ctrl-hjkl> to array key in any program

I want to map <Ctrl+hjkl> to behave as arrow keys (just like how I've set it up using the Karabiner software on macOS). At the same time, I don't want to change the combination of ctrl with other keys (for example, <Ctrl+c> should still send a terminate signal to applications). I tried using xmodmap, but I found that I couldn't map <Ctrl+hjkl> to arrow keys without affecting the ctrl combination with other keys. As a compromise, I attempted to map <Caps+hjkl> to arrow keys (since I never use the Caps key), but when I use i3wm to resize windows using the arrow keys, the <Caps+hjkl> mapping doesn't work (while the native arrow keys for resizing work fine). It seems like this compromise approach isn't effective. I just want a simple way to remap my keyboard without having to read lengthy documentation. Is there a better way to achieve this?

follow is some info in  ~/.xmodmap and ~/.config/i3/config

keycode  37 = Mode_switch
keycode  43 = h H Left Left
keycode  44 = j J Down Down
keycode  45 = k K Up Up
keycode  46 = l L Right Right

bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt

many thanks

Last edited by ryukk (2023-08-31 09:31:55)

Offline

#2 2023-08-31 11:58:14

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,104

Re: how can I elegently map <ctrl-hjkl> to array key in any program

ctrl is not one of the iso level shifts, if you want to map eg. ctrl+h to ctrl+leftarrow you'll have to create a global shortcut that invokes eg. xdotool
Depending on your shortcut daemon, it might already be able to simulate key events.

Offline

Board footer

Powered by FluxBB