hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
20.03k stars 853 forks source link

libinput send events configuration #4454

Open pavelxdd opened 8 months ago

pavelxdd commented 8 months ago

Description

Hello. I'm currently looking into Sway alternatives, and find that all other WMs out there do not support the libinput Send Events Mode setting.

It allows to automatically disable the touchpad when external mouse is connected, and enable it again when mouse is disconnected. I find it very useful, instead of manually disabling and enabling touchpad via hotkeys.

The example of this setting configuration in Sway: https://github.com/swaywm/sway/blob/master/sway/input/libinput.c#L222 https://github.com/swaywm/sway/blob/master/sway/input/libinput.c#L19

From sway-input man:

input <identifier> events enabled|disabled|disabled_on_external_mouse|toggle [<toggle-modes>]

Enables or disables send_events for specified input device.
Disabling send_events disables the input device.
The toggle option cannot be used in the config.
If no toggle modes are listed, all supported modes for the device will be toggled through in the order: 
enabled, disabled_on_external_mouse, disabled, (loop back). 
If toggle modes are listed, they will be cycled through, 
defaulting to the first mode listed if the current mode is not in the list. 
They will also not be checked to see if they are supported for the device and may fail.

Is it possible to support this libinput setting in hyprland?

earboxer commented 8 months ago

It seems to me that it would be useful to have a general purpose command line tool to set libinput settings.

something like swaymsg -- input type:"$TOUCH_POINTER_ID" events disabled or xinput --disable $ID

(that would at least solve half of the problem, the problem of triggering it could be done with a udev rule, though probably would be good to have a Hyprland way of triggering it, but I don't care about that half of the problem right now...)

With a quick search, the closest thing I could find is libinput-config, which uses a config file and doesn't provide any command line tools to change settings.

(Honestly, I'm kind of surprised that libinput itself doesn't have any cli tool to set the properties... They closed a ticket asking for a xinput set-prop command, noting configs should be managed by the compositor, though that doesn't address run-time settings)...

vaxerski commented 8 months ago

can't you just do it manually? per-device enabled exists iirc

earboxer commented 8 months ago

@vaxerski Yeah, it seems to work with my keyboards and mice, but doesn't work on my touchscreen

hyprctl -i 0 keyword device:synaptics-s3706b:enabled false (and the touchscreen still works)

REALERvolker1 commented 8 months ago

I would like to see this implemented directly in Hyprland. It would make my current solution obsolete.

JonasNapierski commented 5 months ago

I experience similar issues using the surface pro 6, the ipts-stylus and ipts-045e:001f-touchscreen are both responding with ok but still working after deactivating them.

hyprctl keyword "device[ipts-045e:001f-touchscreen]:enabled" false hyprctl keyword "device[ipts-stylus]:enabled" false

vaxerski commented 5 months ago

you need to use the -r flag in hyprctl to force an update to device properties