You are not logged in.

#1 2022-01-07 16:15:57

lugge
Member
Registered: 2017-03-17
Posts: 38

SOLVED Catch and react to hardware event

Hi there,

I'm running Arch with Gnome on a Microsoft Surface Go3 2in1, but my question is not device nor DE dependent.
Basically, the experience is good with the keyboard/touchpad attached and OK without it, but in both cases some tinkering is required.

At the moment, I'm playing around with the on-screen-keyboard shipped with Gnome.
It can only be configured to activated or deactivated.
Activated means, it shows up every time the cursor is set to a text field, no matter if the keyboard is attached or not.
Deactivated means, well, it never shows up.
I want to have the OSK only to show up when there is no keyboard attached.

At the moment I'm able change the config without need of any GUI, using "gsettings set org.gnome.desktop.a11y.applications.screen-keyboard-enabled False".
Now I want to write a script which executes above command everytime the keyboard is attached or removed.

I guess udev is the way to go but I'm lost here.
I first need to find out which device my keyboard is, then I need a way to react to a plug event.
Any ideas?

Last edited by lugge (2022-01-08 10:00:01)

Offline

#2 2022-01-07 17:06:14

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,999
Website

Re: SOLVED Catch and react to hardware event


Jin, Jîyan, Azadî

Offline

#3 2022-01-08 09:59:43

lugge
Member
Registered: 2017-03-17
Posts: 38

Re: SOLVED Catch and react to hardware event

Was able to solve it using udev ules:

Rule:
ACTION=="add", SUBSYSTEM=="usb", ENV{ID_VENDOR_ID}=="045e", ENV{ID_MODEL_ID}=="09b5", RUN+="/home/lugge/surface/scripts/keyboard-attach.sh"

Script:
gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false

Offline

Board footer

Powered by FluxBB