Created
November 4, 2024 04:20
-
-
Save koron/3ca6013baa14b5e9431f1e308858e088 to your computer and use it in GitHub Desktop.
A shell script to set mouse resolution for Logi using https://github.com/cvuchener/hidpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu | |
device="MX Anywhere 3" | |
get=0 | |
resolution=1500 | |
verbose=0 | |
while getopts d:gr:v OPT ; do | |
case $OPT in | |
d) device="$OPTARG" ;; | |
g) get=1 ;; | |
r) resolution="$OPTARG" ;; | |
v) verbose=1 ;; | |
esac | |
done | |
rawid=$(hidpp-list-devices | grep "$device" | head -1) | |
#echo "raw_id=$rawid" | |
path=$(echo "$rawid" | awk "{print \$1}") | |
devid=$(echo "$rawid" | awk "{print \$3}" | sed -e 's/)://') | |
if (( $verbose )) ; then | |
echo "device=$device" | |
echo "path=$path" | |
echo "devid=$devid" | |
echo "resolution=$resolution" | |
fi | |
if [ -z "$path" -o -z "$devid" ] ; then | |
echo "can't find the device: $device" | |
exit 1 | |
fi | |
if (( $get )) ; then | |
hidpp-mouse-resolution -d "$devid" "$path" get | |
else | |
hidpp-mouse-resolution -d "$devid" "$path" set "$resolution" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment