You are not logged in.

#1 2023-03-12 17:32:13

LittleSandra
Member
Registered: 2021-01-25
Posts: 77

[SOLVED ]How to disable Caps Lock in Sway/Wayland?

Dear all smile

When I search for how to remap keys in Sway this comes up https://purisa.me/blog/remap-keys-on-sway/ , however modifying /usr/share/X11/xkb/* doesn't seam like a pretty solution.

This https://www.reddit.com/r/swaywm/comment … s_in_sway/ says xkb support is builtin Sway, and says this should work

input "type:keyboard" {
  xkb_options caps:swayescape
}

However when I open Vim, and press CapsLock it doesn't escape, as I would have expected.

Other that seam popular are

* https://pypi.org/project/wayremap/
* https://gdratp.medium.com/remapping-mod … 9c6e565468

Question

Does anyone know how to make Caps Lock dead in Sway?

Hugs,
Sandra smile

Last edited by LittleSandra (2023-03-12 21:56:32)

Offline

#2 2023-03-12 17:40:10

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,342
Website

Re: [SOLVED ]How to disable Caps Lock in Sway/Wayland?

The first link you post is for remapping keys in ways not already supported out of the box by xkb and would be suitable for those cases except for modifying the file in place.  The keymap file should be copied to under your home directory and modified there to be a new map which can be loaded.

But if you just want options supported by xkb it's much easier as noted in your second link in which you use sway's built in config or just set the environment variable XKB_DEFAULT_OPTIONS (my preferred approach).  Your sway config is not working due to a typo.  I assume you want caps:swapescape, caps:swayescape is not a valid option.

EDIT: for valid options see `man xkeyboard-config`.  If you don't actually want a caps lock key you most likely don't want to swap it with escape!  I suspect you may prefer caps:escape instead (which is what I use), or perhaps just caps:none.

Last edited by Trilby (2023-03-12 17:48:43)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2023-03-12 17:49:00

LittleSandra
Member
Registered: 2021-01-25
Posts: 77

Re: [SOLVED ]How to disable Caps Lock in Sway/Wayland?

Trilby wrote:

The first link you post is for remapping keys in ways not already supported out of the box by xkb and would be suitable for those cases except for modifying the file in place.  The keymap file should be copied to under your home directory and modified there to be a new map which can be loaded.

Ok, so when I have a local copy of /usr/share/X11/xkb/symbols/inet, how can I then load it?

Trilby wrote:

But if you just want options supported by xkb it's much easier as noted in your second link in which you use sway's built in config or just set the environment variable XKB_DEFAULT_OPTIONS (my preferred approach).  Your sway config is not working due to a typo.  I assume you want caps:swapescape, caps:swayescape is not a valid option.

Yes, this is also my preferred solution, but right now I can't get anything to work smile

Hmm. Even when I fix the typo, Caps Lock still works. caps:swapescape were just for testing. Does there exist a real disable/remove?

How can I tell xkb is installed?

Last edited by LittleSandra (2023-03-12 18:40:29)

Offline

#4 2023-03-12 19:03:19

dogknowsnx
Member
Registered: 2021-04-12
Posts: 652

Re: [SOLVED ]How to disable Caps Lock in Sway/Wayland?

Just chiming in... The links you posted in the OP are from all over the place (and you've got quite a few topics/issues going already) - why not start reading here yourself instead of expecting to be spoon-fed from these sources...

No offense but it makes me wonder how you installed Arch Linux in the first place...


RI - Rest your Eyes and Self

"We are eternal, all this pain is an illusion" - Maynard James Keenan

Offline

#5 2023-03-12 19:45:02

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,342
Website

Re: [SOLVED ]How to disable Caps Lock in Sway/Wayland?

LittleSandra wrote:

caps:swapescape were just for testing. Does there exist a real disable/remove?

Yes, there does.  I'll assume you may have been writing your post while I was editing mine - please go back and read the edits as I explicitly address this.

Have you tried the environment variable I mentioned?  What exactly did you set it to and how / where?  Have you tried the "*" instead of "type:keyboard" to get a better test with the sway config?  Also I do not see any quotes in the sway documentation.  Why do you have quotes around type:keyboard?  Have you tried without?

LittleSandra wrote:

How can I tell xkb is installed?

Ah ... you are using arch linux, right?  Exactly which instructions did you follow to install your system?  If you are using arch, please take some time familiarizing yourself with your package manager: read `man pacman`.

Last edited by Trilby (2023-03-12 20:11:12)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2023-03-12 21:56:00

LittleSandra
Member
Registered: 2021-01-25
Posts: 77

Re: [SOLVED ]How to disable Caps Lock in Sway/Wayland?

Trilby wrote:
LittleSandra wrote:

caps:swapescape were just for testing. Does there exist a real disable/remove?

Yes, there does.  I'll assume you may have been writing your post while I was editing mine - please go back and read the edits as I explicitly address this.

Have you tried the environment variable I mentioned?  What exactly did you set it to and how / where?  Have you tried the "*" instead of "type:keyboard" to get a better test with the sway config?  Also I do not see any quotes in the sway documentation.  Why do you have quotes around type:keyboard?  Have you tried without?

LittleSandra wrote:

How can I tell xkb is installed?

Ah ... you are using arch linux, right?  Exactly which instructions did you follow to install your system?  If you are using arch, please take some time familiarizing yourself with your package manager: read `man pacman`.

The quotes turned out to be the problem. Now Caps Lock is disabled with

input type:keyboard {
  xkb_layout dk
  xkb_options caps:none
}

I am running Arch. The reason I asked about how to tell if xkb were installed is because pacman -Ss xkb didn't give any exact matches. But my understanding now is, that xkb isn't a util, but a library. And extra/libxkbcommon is installed on my computer smile

Thanks a lot for the help smile

Hugs,
Sandra smile

Offline

#7 2023-03-12 22:08:07

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,342
Website

Re: [SOLVED ]How to disable Caps Lock in Sway/Wayland?

LittleSandra wrote:

The reason I asked about how to tell if xkb were installed is because pacman -Ss xkb didn't give any exact matches.

That's true - sorry about that.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB