1

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

2
  • Do you use a graphical login manager? Which one? They don't all read the profile scripts. Commented May 4, 2023 at 8:35
  • Hey, I will update to mark as solved. I use lightdm, and in order to get this work I had to create a .xsession file in the home directory of the user logging in. Commented May 4, 2023 at 17:54

1 Answer 1

0

On debian systems, create a custom .xsession file and place it in the home directory of the user logging in, with your custom X commands followed by exec {yourwindowmanager}.

EDIT upon request, i.e.

xinput map-to-output 12 HDMI-1
exec gnome-session
1
  • Thanks for posting the answer! Could you please show the actual file so others can repeat your solution? Commented May 5, 2023 at 8:24

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.