3

I've updated to Fedora 26 and now my Capslock key behaves strangely (or not at all). In Fedora 25 the xkb setting worked perfectly for both my Ctrl and Caps changes. I've selected "Caps as Ctrl" in Gnome Tweak Tools, but Caps just does nothing at all! Using xev I get the following output for the caps key:

KeyRelease event, serial 36, synthetic NO, window 0x2600001,
    root 0x273, subw 0x0, time 2293119, (164,-21), root:(271,94),
    state 0x10, keycode 66 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

the bracket after keycode should contain LCtrl instead of NoSymbol. I've also tried deactivating and or activating Caps. As well as that I've tried to modify /usr/share/X11/xkb/keycodes/evdev and use Caps = 37; which would make Caps similar to Left Control - but this as well has no effect whatsoever. Please help me - since wayland I'm kinda lost here!

I've also changed Left Control and Alt by:

<LALT> = 37; //64;
<LCTL> = 64; //37;

In the previously stated file -> this still works like a charm!

1
  • IIRC Wayland relies on XKB for keyboard modifications. I've no idea what Gnome Tweak Tools does, but possibly the wrong thing. Tinkering with /usr/share/X11/xkb will likely not do what you want it to do. A good intro is here. I don't know details how Wayland handles this, as I don't run Wayland, but there should be a generic way to tell it which XKB configuration to use ...
    – dirkt
    Jul 13, 2017 at 9:19

4 Answers 4

3

I temporarily (hopefully this will get some love) fixed it: In gnome tweak tools under Typing I deselected every entry, but "Capslock is also Control". No idea why the program lists many options as duplicates like "Capslock - Disabled" and "Capslock is disabled" and most of them are ambiguously labeled, such that capslock-control is modified by many options.

0

Gnome Tweaks Keyboard & Mouse Addition Layout Option This is were you will find Caps Lock option.

0

I am leaving this reply for the completeness sake, since there are not many resources dealing with non-Gnome, or KDE environments and Wayland.

I am on Debian Buster and run Fluxbox as a WM on top of XWayland (which means it might not work for non-XWayland WMs). Doing the usual, ie setting the mappings in .xmodmaprc actually did the job:

remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Caps_Lock
add Control = Control_L

Updated to reflect the comment by Mark rightly pointing out that the solution probably only works on XWayland based WMs.

2
  • XModMap is part of X11, not Wayland. I believe this only works because you are running XWayland-- an X11 server run as a Wayland client. This is not a native Wayland solution. Jul 24, 2020 at 1:45
  • @MarkStosberg do you have any suggestion how to do this in a universal way? Jul 27, 2020 at 9:12
0

Another solution to achieve the mapping of caps lock to ctrl uses caps2esc and interception_tools.

Follow these steps have been taken from How To Map Caps Lock To Escape And Control On Fedora Via Caps2esc, whihc provides additional details, should you need them.

Install both caps2esc and interception_tools

cd ~/your/code/directory
git clone https://gitlab.com/interception/linux/tools interception_tools
git clone https://gitlab.com/interception/linux/plugins/caps2esc

Install the libraries that inception_tools is dependant upon

sudo dnf install cmake yaml-cpp-devel libevdev-devel systemd-devel -y

Build, and install, both caps2esc and inception_tools by running sudo make install in their respective directories and verify their installation with

which udevmon
which caps2esc

Configure inception_tools to specify the keys that you wish to intercept in /etc/caps2esc.yaml. In this case the keys are KEY_CAPSLOCK and KEY_ESC:

- JOB: "intercept -g $DEVNODE | caps2esc | uinput -d $DEVNODE"
  DEVICE:
    EVENTS:
      EV_KEY: [KEY_CAPSLOCK, KEY_ESC]

Now create a daemon (see this answer to How do you make a process a service under systemd? for more details on systemd), by creating /etc/systemd/system/caps2esc.service, which should contain the following:

[Unit]
Description=caps2esc

[Service]
ExecStart=/usr/bin/nice -n -20 /usr/local/bin/udevmon -c /etc/caps2esc.yaml

[Install]
WantedBy=multi-user.target

Now use systemctl to manage the service

sudo systemctl daemon-reload
sudo systemctl enable caps2esc # Start on bootup
sudo systemctl start caps2esc # Start now too

Now caps+C should perform a ctrl+C, which can be verified within a terminal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.