You are not logged in.

#1 2021-09-11 21:45:33

thiagowfx
Member
Registered: 2013-07-09
Posts: 586

[SOLVED] Xorg: Mapping Ctrl+Alt+Up to Home, Ctrl+Alt+Down to End

TL:DR; I am looking for a way to map Ctrl+Alt+Up to Home and Ctrl+Alt+Down to End in X.

There's only one pre-requisite: The simpler and more native it is, the better. For example, I could probably achieve that with autokey, but that's out of scope because it requires a daemon.

Rationale / Why: Chromebooks somehow to that by default and I have a lot of muscle memory for it. It would be nice to replicate it to my Arch desktop.

What have I tried? The natural solution, of course: Xmodmap. The closest I came up with was this ~/.Xmodmap:

keycode  64 = Mode_switch Meta_L Alt_L Meta_L
keycode 111 = Up NoSymbol Home
keycode 116 = Down NoSymbol End

It takes advantage of Mode_switch by mapping Left Alt to it. With this setup, Alt+Up and Alt+Down are mapped to Home and End, but that's not what I want; I'd like to have to press Ctrl+ as well. It also seems to mess up Left Alt for everything else - for example, Alt + Return won't open a terminal anymore.

Is it possible to do such a keymap natively with Xmodmap alone? If it isn't, which I am almost concluding to be the case, and if there's another tool that can do so that isn't much bloated and that isn't a daemon I am all ears. I am also open up for Wayland suggestions - if it's somehow possible to do this natively with wayland that's a compelling reason to switch to it - although ideally let's stick to X11 for now, I'll open up a separate thread for Wayland another time.

Last edited by thiagowfx (2021-09-15 14:45:34)

Offline

#2 2021-09-12 06:30:39

seth
Member
Registered: 2012-09-03
Posts: 51,319

Re: [SOLVED] Xorg: Mapping Ctrl+Alt+Up to Home, Ctrl+Alt+Down to End

ctrl & alt are modifiers, not level shifts.
You'll have to use a shortcut daemon that binds "xdotool key Home"

If you reallyreallyreally wanted to do this on xmodmap/xkbmap and are already willing to sacrifice the alt key, you could probably map alt to ISO_Level3_Shift and the 3rd level of ctrl to ISO_Level5_Shift
Then the 5th level of up and down to Home and End

Offline

#3 2021-09-15 14:45:23

thiagowfx
Member
Registered: 2013-07-09
Posts: 586

Re: [SOLVED] Xorg: Mapping Ctrl+Alt+Up to Home, Ctrl+Alt+Down to End

seth wrote:

ctrl & alt are modifiers, not level shifts.
You'll have to use a shortcut daemon that binds "xdotool key Home"

Thanks for confirming what I suspected - I guess I'll just flex my requirements a bit and look for a daemon then. sxhkd + xdotool sounds promising and probably don't add a terrible overhead.

seth wrote:

If you reallyreallyreally wanted to do this on xmodmap/xkbmap and are already willing to sacrifice the alt key, you could probably map alt to ISO_Level3_Shift and the 3rd level of ctrl to ISO_Level5_Shift
Then the 5th level of up and down to Home and End

Thinking better about this, it's probably not worth it, I am more reliant on Alt than I had thought.

Marking as SOLVED for the purposes of the original question.

Offline

Board footer

Powered by FluxBB