I have an issue with my dual monitor setup: one is touchscreen and the other is not - the touch input correlates across both displays instead of just one. I can resolve the issue by mapping the input to the correct display using the following command:

xinput map-to-output 11 DP-1

I would like this command to fire up on startup automatically. I've tried adding it as a cron job in both my user and root crontabs as follows:

@reboot xinput map-to-output 11 DP-1

and I've also added it as a script:

@reboot /home/imperial/.scripts/map_touchscreen.sh

Neither option worked. I also tried both options (without the @reboot) in Ubuntu's startup applications gui.

Why isn't my command firing - where should I be looking to find the problem?

  • Maybe try adding in a small delay for when they start. I was having an issue similar so I added maybe a 5 to 10 second delay. I think it was trying to start it too soon and couldn't do it, so it just passed it over. So maybe try one of yours like @reboot bash -c 'sleep 10 && /home/imperial/.scripts/map_touchscreen.sh' – Terrance Jan 8 at 5:36
  • Good idea but no luck! I pushed the sleep all the way to 60 and came back to it after a while, still hadn't fired. – raicho Jan 8 at 12:21
  • As a further piece of info, I just tried launching the script from a .desktop file as an interim solution and the command also did not execute. However if I execute the script from bash it works.....?! – raicho Jan 8 at 14:20
  • If you look at the /etc/crontab file which does start up, you will see that there is SHELL and PATH before it runs the commands in the crontab file. You can try adding the full paths in your script to like /usr/bin/xinput so it knows where the file is. – Terrance Jan 8 at 22:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.