Easy mouse settings changing from right- to left-handed

Tobias Leupold tl at stonemx.de
Fri Feb 24 06:50:24 GMT 2023


Am Freitag, 24. Februar 2023, 01:33:17 CET schrieb David Hurka:
> On Saturday, February 18, 2023 1:09:22 PM 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.
> 
> Hi, just want to add:
> 
> There is a systray icon for the keyboard that appears automatically when you
> configure more than one keyboard layout.
> 
> Now you need the same for the “mouse layout”, right?
> That seems perfectly reasonable to me, and I support this wish! :)

Hi David and all!

I actually managed to get it to work, you can check it out at
https://invent.kde.org/tleupold/mousetoggler

It's a very simple plasmoid, consisting only of an icon. Either a "left-click" 
icon if the mouse is configured for right-handed use, or a "right-click" icon 
if it's left-handed use. When you click on it, either with the left or the 
right mouse button, the layout is toggled. Also, it watches if the layout is 
changed via the systemsettings. What actually doesn't work at the moment is 
that if the systemsettings' mouse settings widget is notified when it's opened 
and the toggling is done via the plasmoid. I'm not sure if this is possible at 
all ... maybe one could connect to some DBUS signal that to check if the 
systemsettings are opened and disable the plasmoid for this time or so.

However, the plasmoid can be placed in the window bar and gets the job done.

The problems I wrote about (when trying to add it to the desktop or the window 
bar, nothing happens and I have no idea how to debug it) were -- at least I 
think so -- caused by some caching that QML/Plasma stuff does: I played around 
with the "Hello world" plasmoid from the wiki. Worked. I changed the text to 
"foo bar" -- still got "Hello world" (with an installed instance). After 
having uninstalled it, having logged out, having deleted ~/.cache/plasma*, 
loggin in again and installing it again, I got the changed text. I still have 
no idea how to debug this though, as e.g. plasmaconsole --replace started in a 
console window didn't show any errors, ~/.xsession-errors was empty, and the 
syslog as well as X's log also didn't contain anything about this :-(

However: Most probably, some non-functional state was cached somewhere, and I 
could change what I wanted without getting another result. Problem was that, 
with a C++ library, that one has to be installed (system-wide?! At least, I 
couldn't get it to work after setting my install prefix to ~/.local) even to 
test the plasmoid with plasmoidviever. I ended up doing a partial install 
(only the library) and messing with the plasmoid via plasmoidviever before 
also installing it.

Maybe, someone with a deeper insight of Plasma/QML's internals can clarify 
this and maybe add some hint to the basic plasmoid howto to prevent such 
headache?!

And if someone knows how to talk to the systemsettings mouse widget if it's 
opened, let me know ;-)

Cheers, Tobias




More information about the kde-devel mailing list