Easy mouse settings changing from right- to left-handed

Konstantin Kharlamov hi-angel at yandex.ru
Sat Feb 18 14:01:37 GMT 2023


On Sat, 2023-02-18 at 14:37 +0100, Juraj Oravec wrote:
> On sobota 18. februára 2023 13:09:22 CET Tobias Leupold wrote:
> > Hi all!
> > 
> > My little son starts to use a computer for school, so I currently
> > share my notebook with him. He's left-handed (and I'm right-handed),
> > so I searched for a convenient way to switch the mouse settings from
> > right-handed to left-handed and vice versa, like with a small systray
> > icon and just one click to do.
> > 
> > The only thing I found was "mouseswap-kf5" (
> > https://www.pling.com/p/998954/ ) which seems to do this exact thing.
> > But it seems to be outdated and unmaintained -- I could not build it.
> > 
> > I then looked into the sources and thought it could not be that hard
> > to re- write or update the thing, but after messing a bit with it, I
> > have to admit that I have no idea how to do it properly ;-) I could
> > not even connect to some DBUS signal telling me that any
> > systemsettings setting has been changed (I never worked with this
> > before) ...
> > 
> > So: Is there anything comparable we have in "official" KDE? And if
> > not, can anybody point me to docs about how to do it, so that I can
> > try to implement this myself?
> > 
> > This would imo be a nice addition to the default mouse system
> > settings, like "show a systray icon to switch between left- and
> > right-handed" or such. I think this would be a nice extra for a lot
> > of people sharing their computer with others.
> > 
> > Thanks for all help and all hints :-)
> > 
> > Cheers, Tobias
> 
> Hello Tobias,
> 
> Have you considered using libinput and undex Xorg xinput tool and some 
> scripts around (create script and bind to keyboard shortcut, create some 
> icon...)?
> 
> Example from my machine (mouse can have multiple entries here):
> $ xinput list
> ⎡ Virtual core pointer          id=2    [master pointer  (3)]
> ⎜   ↳ Razer Razer Basilisk V3   id=17   [slave  pointer  (2)]
> 
> 
> $ xinput --list-props 17
> Device 'Razer Razer Basilisk V3':
> .....
> libinput Left Handed Enabled (294):     0
> libinput Left Handed Enabled Default (295):     0
> ...
> 
> 
> Probably:
> $ xinput --set-prop 17 "libinput Left Handed Enabled" 1

If you make use of X11 and `xinput`, please don't use numeric IDs, they will change on reboot. Instead use the actual string, so in the example above that would be:

xinput --set-prop "Razer Razer Basilisk V3" "libinput Left Handed Enabled" 1


More information about the kde-devel mailing list