1

I need to force my KDE Plasma installed on ubuntu 18.04 to run the following script on startup (after login):

xinput --map-to-output "Wacom HID 48DE Finger touch" eDP-1-1
xinput --map-to-output "Wacom HID 48DE Pen stylus" eDP-1-1
xinput --map-to-output "Wacom HID 48DE Pen eraser" eDP-1-1

So I've put it in

/etc/X11/xinit/xinitrc
crontab -e
~/.bashrc
~/.profile
maybe some other places that I forgot

I've also created a *.sh with these 3 lines and put it in the settings->autostart in the "desktop file" section and in the "script file" section. In the latter one I put it twice: under "startup" option and under "before session start-up" option. I put it in the settings->login screen (sddm) "advanced" tab -> commands -> "reboot command" section. I have also tried to create a *.desktop file in 'cd ~/.config/autostart/' and put the following content in it:

[Desktop Entry]
Type=Application
Exec="/usr/bin/xinput_autostart.sh"
Name=Xinput

I put it with and without the "root" and "sudo" prescriptions, I put it everywhere I could where I could only find on the internet and it does not work. But when I execute exactly the same lines in the terminal manually or if I simply double click the *.sh file then it works!!! I am out of ideas, please help!

2
  • This might be better as a systemd service, this answer goes in how to set that up. But I think your script "/usr/bin/xinput_autostart.sh" may be the problem. Make sure it has a shebang at the top, e.g. #!/bin/sh. And make sure to make it executable, something like sudo chmod 660 or whatever you prefer. Nov 24, 2019 at 14:15
  • I have this line in the beginning of the script, if fact I've tried both "#!/bin/sh" and "#!/bin/bash", dunno the difference tho, just seen them somewhere. And ye the script was set to be executable with "chmod" command, if I now simple double click it it will be executed
    – arty
    Nov 24, 2019 at 19:32

2 Answers 2

1

Thanks @bac0n in helping me tracking the issue. As it turned out, the script was executed all along, but due to some reason, default xinput settings were overwriting it every time on startup. The solution might be not the most elegant, but it is the only solution I was able to come up with and it works for me:

sleep 1; xinput --map-to-output "Wacom HID 48DE Finger touch" eDP-1-1
xinput --map-to-output "Wacom HID 48DE Pen stylus" eDP-1-1
xinput --map-to-output "Wacom HID 48DE Pen eraser" eDP-1-1
1
  • i was about to suggest that :)=
    – user986805
    Nov 26, 2019 at 15:01
0

You can put shell scripts in:

~/.config/plasma-workspace/env/

(these will execute at login before launching Plasma, make sure they have execute bit and ends with *.sh)

5
  • I will try this, but I think I have explained it in a wrong way - I need the script to be executed after I login to plasma, not before. In fact, before I login, on the sddm login screen my touchscreen mapped correctly, it is mismapped after I login, so thats why I need to remap the xinput after I login to plasma.
    – arty
    Nov 24, 2019 at 19:43
  • Autostart directories recognized by plasma
    – user986805
    Nov 25, 2019 at 2:52
  • try redirecting output to a log file: xinput --map-to-output "Wacom HID 48DE Finger touch" eDP-1-1 > ~/wacom.log 2>&1 this redirect any messages to wacom.log in your home directory.
    – user986805
    Nov 25, 2019 at 4:22
  • As it turned out I already had the script in the '~/.config/plasma-workspace/env/'. As I mentioned I forgot some of the places I had put it in. I have also put it in the "~/.config/autostart-scripts" and I have added the " > ~/wacom.log 2>&1" Now there is an empty wacom.log file in my home directory indeed. So does it mean that the script is executed? But I still experience the xinput mapping mismatch, does it mean that the script is executed but the xinput settings are overwritten afterwards once again? Any idea I can track this somehow?
    – arty
    Nov 26, 2019 at 13:59
  • Yes, I double checked it, it seems that the script is executed (wacom.log is created) but the xinput settings being rewritten afterwards... Maybe I can add sort of 'wait x seconds' function into the script to fix the issue, is there such a command?
    – arty
    Nov 26, 2019 at 14:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .