Skip to content

Instantly share code, notes, and snippets.

@tranduydat
Created April 21, 2022 14:38
Show Gist options
  • Save tranduydat/1a903076ec1dd2fdc307a582696e02d6 to your computer and use it in GitHub Desktop.
Save tranduydat/1a903076ec1dd2fdc307a582696e02d6 to your computer and use it in GitHub Desktop.
imwheel-gui.sh
#!/bin/bash
# GUI for Imwheel
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
@eralvarez
Copy link

working as expected in linux mint! THANK YOU!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment