toggle mouse buttons by script

Steven W. Orr steveo at syslang.net
Fri Jul 21 21:12:53 BST 2006


On Friday, Jul 21st 2006 at 22:07 +0200, quoth Stephan Kahnt:

=>Just to finish ths thread here is my new script:
=>
=><<< snip-here >>>
=>#!/bin/sh
=># script for toggling mouse buttons and save the settings for kde
=>
=># what is the current setting, or better where to switch to ?
=>mouse_what_to_set() {
=>  xmodmap -pp | cut -c 9,24 | grep -q 11 && echo "Left" || echo "Right"
=>}
=>
=># switch to Left or Right
=>switch_mouse() {
=>  if [ "$1" == "Right" ]; then
=>    list="1 2 3"
=>  else
=>   list="3 2 1"
=>  fi
=>  xmodmap -e "pointer = $list" && kwriteconfig --file kcminputrc --group Mouse --key MouseButtonMapping "${like}Handed"
=>}
=>
=># do the job
=>switch_mouse `mouse_what_to_set`
=>
=><<< snip-here >>>

FYI, the correct equal operator is = not ==. Bash does support both but 
the correct choice is =.  Also, if you're using bash, use [[ instead of [.

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.




More information about the kde mailing list