#!/bin/bash
# Version 0.1 Tuesday, 07 May 2013
# Comments and complaints http://www.nicknorton.net
# GUI for mouse wheel speed using imwheel in Gnome
# imwheel needs to be installed for this script to work
# sudo apt-get install imwheel
# Pretty much hard wired to only use a mouse with
# left, right and wheel in the middle.
# If you have a mouse with complications or special needs,
# use the command xev to find what your wheel does.
#
### see if imwheel config exists, if not create it ###
if [ ! -f ~/.imwheelrc ]
then
cat >~/.imwheelrc<<EOF
".*"
None, Up, Button4, 1
None, Down, Button5, 1
Control_L, Up, Control_L|Button4
Control_L, Down, Control_L|Button5
Shift_L, Up, Shift_L|Button4
Shift_L, Down, Shift_L|Button5
EOF
fi
##########################################################
CURRENT_VALUE=$(awk -F 'Button4,' '{print $2}' ~/.imwheelrc)
NEW_VALUE=$(zenity --scale --window-icon=info --ok-label=Apply --title="Wheelies" --text "Mouse wheel speed:" --min-value=1 --max-value=100 --value="$CURRENT_VALUE" --step 1)
if [ "$NEW_VALUE" == "" ];
then exit 0
fi
sed -i "s/\($TARGET_KEY *Button4, *\).*/\1$NEW_VALUE/" ~/.imwheelrc # find the string Button4, and write new value.
sed -i "s/\($TARGET_KEY *Button5, *\).*/\1$NEW_VALUE/" ~/.imwheelrc # find the string Button5, and write new value.
cat ~/.imwheelrc
imwheel -kill
it contain this code
i executed using sudo because ./ is not working i don’t know why.
i started it using CLI because manually it is not opening .
i only have admin user still.
Those are wrong. The file should be readable, writable and executable to yourself.
You obviously don’t understand the principle, so I’ll explain.
In UNIX systems, the current working directory is not in your $PATH, which is a variable that holds a list of directories where the system looks for executable files that can be run as commands.
Therefore, if you want to execute a file that has execute permission but that is not in the list of directories in the $PATH, then you must provide the correct path to this executable as part of the filename. This path to the file can be absolute — i.e. the complete path starting from the root directory — or it can be relative. ./ is a relative path which means “in this directory where I am now”.
As such, prefixing the command with ./ means “the file in my current working directory”. Only, in your case…
The file is not in your current working directory, because your current working directory is your home directory, while the file lives in your ~/Desktop directory; and
Just came across this thread, you can put this file in ~/.config/autostart directory to start imwheel on startup in Xfce. To check if it’s running or not, use pgrep imwheel, if it returns something then it’s running or else it isn’t.
here 7 is the speed i set it for myself you can choose between 1 to 100 according to your needs.
remember it is global and applied throughout the system.
paste the above code in ~/.imwheelrc file
here gedit is the editor i use
gedit ~/.imwheelrc
then save it .
3. Now go to the startup settings in your distro it might look like this after u create imwheel program to autostart
Glad it is working but you do realize that in your last post the * in your config file means for all applications? Never mind i didn’t notice you already know that…
If that is your intention it is fine of course, but you can also make specific configs for different programs, just copy the config and paste it in de same file with a blank line in between and alter the copy for your needs.
the --kill in my example is to ensure there are no running instances of imwheel.