More Mouse Madness
Tragically, a strange incident with a power supply has rendered my MX518 useless to my desktop. There is no damage to anything, just strange behavior.
I've switched to an MX300 mouse for the time being... which has a tilt wheel, and I was thinking how I wanted to utilize the tilting ability. Honestly, how often does a user with a widescreen resolution need to scroll horizontally? So I came up with two options -- zoom (mapped to Ctrl+= and Ctrl+-) or Page Up/Page Down keys. I couldn't make up my mind.
In my previous article about mouse setup, I explained the xbindkeys program and how it operates off of a configuration file. Instead of settling for one function, I decided to write a small script that changes configurations on the fly. Here it is:
#!/bin/bash
# switchbindkeys
# Changes between two mouse button binding configurations
if [ -e "/home/john/.xbindkeys/mouse-zoom" ]; then
echo "Switching to 'page' behavior"
cp ~/.xbindkeys/xbindkeysrc-pg ~/.xbindkeysrc
rm -f ~/.xbindkeys/mouse-zoom
else
echo "Switching to 'zoom' behavior"
cp ~/.xbindkeys/xbindkeysrc-zoom ~/.xbindkeysrc
touch ~/.xbindkeys/mouse-zoom
fi
killall -HUP xbindkeys
I created the .xbindkeys directory and added the two slightly different configuration files, xbindkeysrc-pg and xbindkeys-zoom. The script alternates between the two configurations on each run using a file as a flag, and then tells xbindkeys to read the config file and refresh by sending it the hangup signal.
I made it executable then can map the script to a keyboard shortcut or make a button for it on the panel. I'm thinking about creating a KDE panel applet that allows switching, as well as showing the current configuration used.
Now if I only had an extra mouse button to assign this script to...
I've switched to an MX300 mouse for the time being... which has a tilt wheel, and I was thinking how I wanted to utilize the tilting ability. Honestly, how often does a user with a widescreen resolution need to scroll horizontally? So I came up with two options -- zoom (mapped to Ctrl+= and Ctrl+-) or Page Up/Page Down keys. I couldn't make up my mind.
In my previous article about mouse setup, I explained the xbindkeys program and how it operates off of a configuration file. Instead of settling for one function, I decided to write a small script that changes configurations on the fly. Here it is:
#!/bin/bash
# switchbindkeys
# Changes between two mouse button binding configurations
if [ -e "/home/john/.xbindkeys/mouse-zoom" ]; then
echo "Switching to 'page' behavior"
cp ~/.xbindkeys/xbindkeysrc-pg ~/.xbindkeysrc
rm -f ~/.xbindkeys/mouse-zoom
else
echo "Switching to 'zoom' behavior"
cp ~/.xbindkeys/xbindkeysrc-zoom ~/.xbindkeysrc
touch ~/.xbindkeys/mouse-zoom
fi
killall -HUP xbindkeys
I created the .xbindkeys directory and added the two slightly different configuration files, xbindkeysrc-pg and xbindkeys-zoom. The script alternates between the two configurations on each run using a file as a flag, and then tells xbindkeys to read the config file and refresh by sending it the hangup signal.
I made it executable then can map the script to a keyboard shortcut or make a button for it on the panel. I'm thinking about creating a KDE panel applet that allows switching, as well as showing the current configuration used.
Now if I only had an extra mouse button to assign this script to...
View/Post Comments (0)
Blog
Photoblog
Links
Projects
About





