Changing KDE's mouse theme and buttons settings from a shell script

Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
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!
shell-script command-line kde mouse settings
add a comment |
up vote
2
down vote
favorite
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!
shell-script command-line kde mouse settings
I'm fairly sure that changing KDE system settings from the command line isn't possible generally.
– Sparhawk
Jun 16 '14 at 2:12
currently i am scripting my shortcuts and mouse settings for kde neon, which seems to work
– sjas
Apr 28 at 17:56
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
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!
shell-script command-line kde mouse settings
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!
shell-script command-line kde mouse settings
shell-script command-line kde mouse settings
asked May 28 '14 at 5:40
Idan Arye
293216
293216
I'm fairly sure that changing KDE system settings from the command line isn't possible generally.
– Sparhawk
Jun 16 '14 at 2:12
currently i am scripting my shortcuts and mouse settings for kde neon, which seems to work
– sjas
Apr 28 at 17:56
add a comment |
I'm fairly sure that changing KDE system settings from the command line isn't possible generally.
– Sparhawk
Jun 16 '14 at 2:12
currently i am scripting my shortcuts and mouse settings for kde neon, which seems to work
– sjas
Apr 28 at 17:56
I'm fairly sure that changing KDE system settings from the command line isn't possible generally.
– Sparhawk
Jun 16 '14 at 2:12
I'm fairly sure that changing KDE system settings from the command line isn't possible generally.
– Sparhawk
Jun 16 '14 at 2:12
currently i am scripting my shortcuts and mouse settings for kde neon, which seems to work
– sjas
Apr 28 at 17:56
currently i am scripting my shortcuts and mouse settings for kde neon, which seems to work
– sjas
Apr 28 at 17:56
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
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:
#!/bin/bash
CONFIG=$HOME/.config/kcminputrc
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
fi
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:
#!/bin/bash
CONFIG=$HOME/.config/kcminputrc
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
fi
kcminit mouse
add a comment |
up vote
0
down vote
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
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f132308%2fchanging-kdes-mouse-theme-and-buttons-settings-from-a-shell-script%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
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:
#!/bin/bash
CONFIG=$HOME/.config/kcminputrc
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
fi
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:
#!/bin/bash
CONFIG=$HOME/.config/kcminputrc
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
fi
kcminit mouse
add a comment |
up vote
1
down vote
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:
#!/bin/bash
CONFIG=$HOME/.config/kcminputrc
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
fi
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:
#!/bin/bash
CONFIG=$HOME/.config/kcminputrc
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
fi
kcminit mouse
add a comment |
up vote
1
down vote
up vote
1
down vote
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:
#!/bin/bash
CONFIG=$HOME/.config/kcminputrc
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
fi
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:
#!/bin/bash
CONFIG=$HOME/.config/kcminputrc
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
fi
kcminit mouse
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:
#!/bin/bash
CONFIG=$HOME/.config/kcminputrc
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
fi
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:
#!/bin/bash
CONFIG=$HOME/.config/kcminputrc
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
fi
kcminit mouse
edited Dec 6 at 22:23
answered Sep 6 '16 at 11:49
Horatio Gerblatim
113
113
add a comment |
add a comment |
up vote
0
down vote
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
add a comment |
up vote
0
down vote
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
add a comment |
up vote
0
down vote
up vote
0
down vote
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
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
answered Jun 17 at 10:56
Akshar Patel
1011
1011
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f132308%2fchanging-kdes-mouse-theme-and-buttons-settings-from-a-shell-script%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I'm fairly sure that changing KDE system settings from the command line isn't possible generally.
– Sparhawk
Jun 16 '14 at 2:12
currently i am scripting my shortcuts and mouse settings for kde neon, which seems to work
– sjas
Apr 28 at 17:56