Skip to main content
added 122 characters in body
Source Link
Cheetaiean
  • 372
  • 1
  • 5
  • 19

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

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.

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

added 42 characters in body
Source Link
Cheetaiean
  • 372
  • 1
  • 5
  • 19

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.

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.

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.

edited tags; edited title
Source Link
Hauke Laging
  • 94.6k
  • 21
  • 132
  • 185

Script in /etc/profile.d/ is not being run on X 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//etc/profile.d/, and ending in '.sh'.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/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//etc/X11/Xsession.d/ and now it runs, however it appears to be too early, as the xinput map-to-outputxinput map-to-output does not work correctly yet.

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.

Script in /etc/profile.d/ is not being run on X 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.

added 164 characters in body
Source Link
Cheetaiean
  • 372
  • 1
  • 5
  • 19
Loading
Source Link
Cheetaiean
  • 372
  • 1
  • 5
  • 19
Loading