Xfce Forum

Sub domains
 

You are not logged in.

#1 2024-09-11 14:44:50

Sipos
Member
Registered: 2024-09-11
Posts: 1

Lock keyboard

Apologies if the DE isn't the best way to achieve this, but I'd like to create a shortcut key combination that locks the keyboard, so that all input is ignored until a key combination (possibly the same one) is entered. For example, Ctrl-Alt-L is pressed, all input except Ctrl-Alt-L is ignored until Ctrl-Alt-L is pressed again.

Does anyone know how this can be best achieved? Ideas would be appreciated.

I am setting up a laptop for someone with a significant brain injury to watch things on. Carers (family) need to be able to use the keyboard, but the person sitting at the laptop most of the time cannot use it intentionally, and accidentally pressed things sometimes causing issues, so I'd like to minimise this.

If I can't do this, I'll look to disable the internal keyboard in software after boot, and use a wireless one for carers.

Offline

#2 2024-09-11 17:53:40

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,482

Re: Lock keyboard

Hello and welcome.

Based on this thread, you can use the xfce4-genmon-plugin to toggle the enabling and disabling of the keyboard.

If you are interested, here is the toggling script:

#!/bin/sh
# https://askubuntu.com/questions/160945/is-there-a-way-to-disable-a-laptops-internal-keyboard/178741#178741

ID=7
MASTER=3

OUT="$(xinput -list | grep $ID | grep $MASTER)"

if [ -z "${OUT}" ]
then
    notify-send -i indicator-keyboard "Keyboard Lock" "Enabling keyboard"
    xinput reattach $ID $MASTER
else
    notify-send -i indicator-keyboard "Keyboard Lock" "Disabling keyboard"
    xinput float $ID
fi

exit 0

...adjust your ID and MASTER values as per the instructions in the link, and make sure the script is executable.

Then add the genmon plugin to the panel and set the following configuration:

  • Command = echo "<icon>indicator-keyboard</icon><iconclick>/home/toz/kybdlock.sh</iconclick><tool>Lock/Unlock Keyboard Toggle</tool>"
    (make sure to change the path and name of the script to match on your system)

  • Label = unchecked

  • Period = 86400


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.012 seconds, 9 queries executed - Memory usage: 523.51 KiB (Peak: 524.35 KiB) ]