pop-os / cosmic-epoch

Next generation Cosmic desktop environment
2.78k stars 78 forks source link

Keyboard: Swapping CAPSLOCK with ESCAPE #501

Open theduke opened 1 month ago

theduke commented 1 month ago

Is there any way to swap the CAPSLOCK with the ESCAPE key?

This is a very common setup/requirement for Vim users.

The classic XOrg approach is: setxkbmap -option capslock:swapescape.

exstntlmsnthrp commented 1 month ago

I'd love to see this as well. I'm not a vim user, but just years, and years, and years of muscle memory to having them swapped.

Drakulix commented 1 month ago

You can configure that in ~/.config/cosmic/com.system76.CosmicComp/v1/xkb_config

jpttrssn commented 1 month ago

More specifically you'll want to add options: Some("caps:swapescape") to the config file. Example:

// ~/.config/cosmic/com.system76.CosmicComp/v1/xkb_config
(
    rules: "",
    model: "",
    layout: "us",
    variant: "",
    options: Some("caps:swapescape"),
    repeat_delay: 600,
    repeat_rate: 25,
)
theduke commented 3 weeks ago

Yeah, I did try that.

This config seems to be overwritten on each login. Might be something happening in the greeter.

jpttrssn commented 3 weeks ago

My config was being overwritten when I had errors in my config file. Could that be the case for you? Are you seeing any errors such as errors loading cosmic-comp config logs in your /var/log/syslog?

A-Walrus commented 2 weeks ago

Thanks @jpttrssn! Any way to rebind so that Caps -> Esc Esc -> Esc (esc still works) Shift + Caps -> Caps

jpttrssn commented 2 weeks ago

Thanks @jpttrssn! Any way to rebind so that Caps -> Esc Esc -> Esc (esc still works) Shift + Caps -> Caps

You can use caps:escape_shifted_capslock. See man xkeyboard-config for all available options under Caps Lock behavior.

t56k commented 1 day ago

Kinda related--is there a way to remap caps:escape_shifted_capslock and swapping left alt with meta in the Some(..,) args? Should it be a vec or a string?