Score:1

How can I disable CapsLock during user login?

in flag

On my computer running Xubuntu 20.04 I block the key CapsLock by issuing

setxkbmap -option caps:none

through xfce4-settings-settings on login.

I would like to have this key disabled even before, i.e. during the login phase.

CapsLock is not enabled in the BIOS by default.

I support a user who often accidentally presses CapsLock and then he can't log in himself. I would like to help him, as I have already helped him after logging into the system. - The Insert key is also a candidate that often causes avoidable confusion by causing the overwrite mode. This key is also easily pressed accidentally or even just pressed along.

Is this possible? How can I achieve this goal?

lightdm --show-config gives me this:

a@W:~$ lightdm  --show-config
[Seat:*]
J  allow-guest=false
L  greeter-wrapper=/usr/lib/lightdm/lightdm-greeter-session
M  guest-wrapper=/usr/lib/lightdm/lightdm-guest-session
N  xserver-command=X -core
O  greeter-setup-script=xubuntu-numlockx
P  greeter-session=lightdm-gtk-greeter
Q  user-session=xubuntu
R  type=xlocal
R  display-setup-script=/sbin/prime-offload
R  display-stopped-script=/sbin/prime-switch

   [LightDM]
K  backup-logs=false

Sources:
J  /usr/share/lightdm/lightdm.conf.d/50-disable-guest.conf
K  /usr/share/lightdm/lightdm.conf.d/50-disable-log-backup.conf
L  /usr/share/lightdm/lightdm.conf.d/50-greeter-wrapper.conf
M  /usr/share/lightdm/lightdm.conf.d/50-guest-wrapper.conf
N  /usr/share/lightdm/lightdm.conf.d/50-xserver-command.conf
O  /usr/share/lightdm/lightdm.conf.d/50-xubuntu-numlock.conf
P  /usr/share/lightdm/lightdm.conf.d/60-lightdm-gtk-greeter.conf
Q  /usr/share/lightdm/lightdm.conf.d/60-xubuntu.conf
R  /usr/share/lightdm/lightdm.conf.d/90-nvidia.conf
J  /usr/share/lightdm/lightdm.conf.d/50-disable-guest.conf
K  /usr/share/lightdm/lightdm.conf.d/50-disable-log-backup.conf
L  /usr/share/lightdm/lightdm.conf.d/50-greeter-wrapper.conf
M  /usr/share/lightdm/lightdm.conf.d/50-guest-wrapper.conf
N  /usr/share/lightdm/lightdm.conf.d/50-xserver-command.conf
O  /usr/share/lightdm/lightdm.conf.d/50-xubuntu-numlock.conf
P  /usr/share/lightdm/lightdm.conf.d/60-lightdm-gtk-greeter.conf
Q  /usr/share/lightdm/lightdm.conf.d/60-xubuntu.conf
R  /usr/share/lightdm/lightdm.conf.d/90-nvidia.conf
a@W:~$

I first asked for a hook for commands to be carried out before the login procedure. One comment suggested to set up a crontab with

sudo crontab -e

and add the line

@reboot /usr/bin/setxkbmap -option caps:none

Unfortunately this does not do the job. I could verify that the crontab actually is carried out (see my own comment below), but the invoked command /usr/bin/setxkbmap -option caps:none might be overwritten by the login procedure before it actually asks for the password. (Does it first reset all keyboard-configuration to some default?)

What is the login procedure in Xubuntu 20.04? Is it lightdm or is it lightdm-gtk-greeter?

Would it be possible to issue the command setxkbmap -option caps:none from within some of the lightdm-configuration files such that it is effective when the password is input?

David avatar
cn flag
To be clear on your computer caps lock is on by default? If so this is very unusual. Is there some BIOS setting that controls this?
in flag
No, it is not enabled by default. But I support a user who often accidentally presses this button and then can't log in by himself. I would like to help him, she as I have already helped him after logging into the system. - The Insert key is also a candidate that often causes avoidable confusion by causing an overwrite mode. This key is also easily pressed accidentally or even just pressed along.
David avatar
cn flag
Please add this info to the question with the edit feature.
ar flag
One thing to try is to disable caplock as the computer starts. Try setting up a crontab as root using the command `sudo crontab -e`. Then add the line: `@reboot /usr/bin/setxkbmap -option caps:none`. Save the file and exit. Then restart the computer to test. I have no idea if it will work, but it is worth a shot. If it works let me know. I will write a full answer for you to accept.
in flag
Unfortunately this did not work. When I pressed CapsLock, a fat upward arrow appeared at the right end of the password entry field. When I pressed it again, the fat upward arrow disappeared. When I typed my password with the upward arrow being on, the password was wrong. When I pressed Shift in addition during the characters in the password, it became right (for the non-alphabetic characters I had to press CapsLock again to make the upward arrow vanish. Unfortunately, this trick does not work.
in flag
Adding another command `@reboot date > /tmp/start.txt` I found out that on each start of the system, the command is executed. However, the part `@reboot /usr/bin/setxkbmap -option caps:none` has no effect on the keyboard during log in!
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.