#!/bin/bash
ids=$(xinput list | awk '/SteelSeries Sensei Raw Gaming Mouse .*pointer/ {print $8}' | sed 's/id=\(.*\)/\1/')
if [ -z "$ids" ]; then
exit 0;
fi
read -a ids_array <<< $ids
echo fixing id ${ids_array[0]}
xinput set-prop ${ids_array[0]} 'Device Accel Profile' -1
xinput set-prop ${ids_array[0]} 'Device Accel Constant Deceleration' 2.5
xinput set-prop ${ids_array[0]} 'Device Accel Adaptive Deceleration' 1
xinput set-prop ${ids_array[0]} 'Device Accel Velocity Scaling' 1
echo fixing id ${ids_array[1]}
xinput set-prop ${ids_array[1]} 'Device Accel Profile' -1
xinput set-prop ${ids_array[1]} 'Device Accel Constant Deceleration' 1.5
xinput set-prop ${ids_array[1]} 'Device Accel Adaptive Deceleration' 1
xinput set-prop ${ids_array[1]} 'Device Accel Velocity Scaling' 1
sudo sensei-raw-ctl --show
sudo sensei-raw-ctl --polling 500
sudo sensei-raw-ctl --cpi-on 450
sudo sensei-raw-ctl --cpi-off 5670
unset ids
unset ids_array
I wish for the following script to run once when I login or when the computer starts up. The above script is located in /home/karl/.scripts/startup/sensei-raw-startup.sh
.
I DO NOT wish to use the GUI to add the script. I wish to learn a bit more about how to do it manually.
What files do I need to create, what must be in them and where should they be located to be able to run my script which is located in the said directory.
1. Using /etc/profile.d
You can run the script on login by placing the script in /etc/profile.d/
These files are executed upon login.
To create a symbolic link to the file you want to execute, use
2. Using upstart
Another possibility is to use upstart
and place your script there.