I'm trying left handed mousing, and I want to be able to easily switch between right handed mode and left handed mode. There is a utility for Windows called SwapMouseButtons that allows to bind a key for that switch - both swapping the buttons and changing the pointer's direction.

I would like to do something similar for KDE in a shell script.

Swapping the buttons is easy with xinput, but I'm having a hard time changing the mouse theme to a left handed theme from the command line. I also prefer to find a KDE solution for the button swapping, as changes made via xinput are session-bound and KDE settings are saved. I wouldn't like to have a left handed theme with right handed buttons after a reset...

The problem is, I can't find much documentation on KDE's command line utilities. I found this post that suggests using kapplymousetheme, which seems promising, but I can't figure out how to use it(no man page, no --help flag...)

I've also found that kcmshell4 cursortheme opens the mouse theme dialog, and that kcmshell4 accepts the --args flag for sending arguments to the module, but I couldn't find nor figure out what arguments I need to send to just change the mouse theme without opening the dialog(if that's even supported).

I should also note that I want these changes to take effect immediately. Changing a configuration file and having to restart the system(or even just X or KDM) won't do, though if I can reload that configuration file(with a command line utility, of course) so that the changes will take effect immediately that will be fine.

Thanks in advance!

  • I'm fairly sure that changing KDE system settings from the command line isn't possible generally.
    – Sparhawk
    Jun 16, 2014 at 2:12
  • currently i am scripting my shortcuts and mouse settings for kde neon, which seems to work
    – sjas
    Apr 28, 2018 at 17:56

3 Answers 3


Two years late but I just re-solved this for Plasma 5. Maybe this will help the next person who comes along for this answer.

Here is a KDE method I use for swapping the mouse buttons around. Maybe the same thinking can be applied to altering the theme too.

Essentially, all you have to do is change MouseButtonMapping in $HOME/.config/kcminputrc between LeftHanded and RightHanded and then call kcminit mouse. Here is a script to do just this:


CURRENT=`kreadconfig --file $CONFIG --group Mouse --key MouseButtonMapping`

if [ $CURRENT = "LeftHanded" ]; then
  kwriteconfig --file $CONFIG --group Mouse --key MouseButtonMapping RightHanded
elif [ $CURRENT = "RightHanded" ]; then
  kwriteconfig --file $CONFIG --group Mouse --key MouseButtonMapping LeftHanded

kcminit mouse

Note that the file in KDE Plasma 4 is $HOME/.kde/share/config/kcminputrc and in Plasma 5 it is $HOME/.config/kcminputrc so you may have to edit the script to suit.

I then add this script to my main KDE apps menu so that I can assign a global hotkey for it.

UPDATE 2018:

Due to KDE config file changes the script now looks like this:


CURRENT=`kreadconfig --file $CONFIG --group Mouse --key XLbInptLeftHanded`

if [ $CURRENT = "true" ]; then
  kwriteconfig --file $CONFIG --group Mouse --key XLbInptLeftHanded false
elif [ $CURRENT = "false" ]; then
  kwriteconfig --file $CONFIG --group Mouse --key XLbInptLeftHanded true

kcminit mouse

UPDATE 2022:

kreadconfig and kwriteconfig are now kreadconfig5 and kwriteconfig5.

The kcminit command line has changed slightly.


CURRENT=`kreadconfig5 --file $CONFIG --group Mouse --key XLbInptLeftHanded`


if [ $CURRENT = "true" ]; then
  kwriteconfig5 --file $CONFIG --group Mouse --key XLbInptLeftHanded false
  #/usr/bin/kdialog --title "Leftyswitch" --passivepopup "Right handed mouse" 3
elif [ $CURRENT = "false" ]; then
  kwriteconfig5 --file $CONFIG --group Mouse --key XLbInptLeftHanded true
  #/usr/bin/kdialog --title "Leftyswitch" --passivepopup "Left handed mouse" 3

kcminit kcm_mouse
  • kcminit kcm_mouse does update the value in ~/.config/kcminputrc, but doesn't actually switch the mouse buttons (USB-attached mouse - don't know if that's relevant). So I tried just kcminit, and that works for me (even though it looks like it's reinitializing some other things too) Aug 28, 2022 at 16:49
  • As I understand it there have been bugs around kcminit recently. I believe kcminit kcm_mouse will eventually work again when the fixes trickle down into distros. Aug 29, 2022 at 19:05

You can easily change to left-handed as follows:

 xmodmap -e "pointer = 3 2 1"

You can find the documentation on https://help.ubuntu.com/community/MouseCustomizations


actual names for the configuration can only be found in the source code it seems, i.e. https://github.com/KDE/plasma-desktop/tree/d3c40a0582edbfa2674006e5a15e991a65f8f409/kcms/mouse/backends/x11

i was searching for what to do with the settings from ~/.config/kcminputrc

if you use libinput (instead of libevdev) then you probably want to check x11_libinput_dummydevice.h, the last line of the 3-line-paragraphs (not the ones with 'supports' or 'default' in their property names) at the bottom will tell you what you want, if you're after mouse settings

apply these via running kcminit, which gives such output:

Initializing  "/usr/lib/x86_64-linux-gnu/qt5/plugins/plasma/kcms/systemsettings/kcm_mouse.so"
Initializing  "/usr/lib/x86_64-linux-gnu/qt5/plugins/plasma/kcms/systemsettings/kcm_style.so"
Initializing  "/usr/lib/x86_64-linux-gnu/qt5/plugins/plasma/kcms/systemsettings/kcm_fonts.so"
Initializing  "/usr/lib/x86_64-linux-gnu/qt5/plugins/plasma/kcms/systemsettings/kcm_touchpad.so"
kcm_touchpad: Using X11 backend
Initializing  "/usr/lib/x86_64-linux-gnu/qt5/plugins/plasma/kcms/systemsettings/kcm_kgamma.so"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .