Skip to main content
2 of 5
added 164 characters in body
Cheetaiean
  • 372
  • 1
  • 5
  • 19

Script in /etc/profile.d/ is not being run on login (debian)

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.

Cheetaiean
  • 372
  • 1
  • 5
  • 19