The following script:
name='ILITEK ILITEK-TP'
echo 'running touchscreens' | systemd-cat
ids=$(xinput --list |awk -Fid= "/$name/"'{print $2+0}')
echo 'after xinput' | systemd-cat
for id in $ids
do event=$(xinput list-props "$id" | awk -F'"' '/Device Node/{print $2}')
path=$(udevadm info "$event" |
awk -F/ '/DEVPATH=/{printf "%s \n",$7}')
if [[ "$path" == *"1-5"* ]]; then
screen='HDMI-2'
#echo "$id $path $screen"
xinput map-to-output $id $screen
elif [[ "$path" == *"1-6"* ]]; then
screen='HDMI-3'
#echo "$id $path $screen"
xinput map-to-output $id $screen
fi
done
works perfectly fine if executed by a user. However, it is not run on login as an X session user, despite being in /etc/profile.d/, and ending in .sh. On the other hand, it is run if I log in by SSH, but that is the complete opposite of when I'd want it to run.
This must mean that perhaps /etc/profile isn't being called at all when an X session logs in? How would I be able to make it run? My window manager is Cinnamon.
UPDATE: I moved the script to /etc/X11/Xsession.d/ and now it runs, however it appears to be too early, as the xinput map-to-output does not work correctly yet, or is overwritten after script execution.
UPDATE 2: placing the script in ~/.bashrc works, however ONLY after starting up the Terminal. This is driving me nuts
profilescripts.