System doesn't run a shell script at startup. Manjaro 20.2.1 KDE

Hi,

I added a simple login shell script to “System Settings - Startup and Shutdown - Autostart” that enables locked by default “tap-to-click” option via xinput (not available at all in input settings).

#!/bin/sh
xinput set-prop 14 332 1

But it doesn’t work. I have to run my sh file every time I reboot my laptop.

Could anyone help me, please?

Where is your script?
What is it called (it’s filename)?
Is it executable?
How did you add it to the autostarted apps?

Of course, it’s executable sh file named .startup.sh :grin:

Here’s the code:

#!/bin/sh
xinput set-prop 14 332 1

I added it to startup in system settings as I did with some applications: startup section - add login script.

I can see this script in “~/.config/autostart-scripts” directory. My OS seems to run it, but every time something goes wrong.

Hi,
I just checked and I have the option to set the tap to click on the main tab of the touchpad settings.

Did you try to put the command in your .xinitrc ?

The same result. Anyway, thx.

You have two other options:

  • udev rule
  • systemd script

The first one might be more reliable as you can ensure your script is run just right after the touchpad is available and registered. The second one can also quite reliable by targeting an event that happens way later, like graphical.target as opposed to multi-user.target, for instance.

But before that, you might want to ensure that your script is really executed by logging something to a file in your home directory, like the command output and probably timestamp.

1 Like

Hi @xix-xx,

Just saw this, and it looked remarkably like what I’m doing with my PC. Although, I don’t to it globally, only for my user, seeing as I’m the only one that uses my computer. But I’m guessing that doing it globally would be very much the same. That being said, the way I did it, is as follows:

  1. Create the file where the contains the command to run:
nano ~/.config/plasma-workspace/env/<filename>.sh

Replace <filename> with an appropriate name for your purpose. Something like set_touchpad_tap-to-click would work.

This will create the file file ~/.config/plasma-workspace/env/<filename>.sh in your home directory for running when (in my case) KDE logs in. I’m guessing the directory would only be slightly different if you do not use KDE.

  1. Populate the newly created file with your contents. Mine has an export statement chained by an and and an OR:
#!/bin/env bash
export RCLONE_CONFIG_PASS='<password_hidden>' && echo 'rClone configuration password set!' || echo 'Problem setting rClone configuration password'

Yours will probably be your script you posted in the beginning:

#!/bin/sh
xinput set-prop 14 332 1

Save the file and exit.

  1. Ensure the file ownership and permissions are correct. Mine’s permissions are 0644 and the both ownership and group is my user, mirdarthos:mirdarthos:
chmod 0644 ~/.config/plasma-workspace/env/<filename>.sh
chown $USER:$USER ~/.config/plasma-workspace/env/<filename>.sh

This will ensure that ownership is the current user and the file is not globally writable and/or executable.

(The next part is KDE-only, I think. It’ll have to be adjusted for any other Desktop Environment.)

  1. In KDE, open the launcher, and go to System SettingWorkspaceStartup and shudownAutostart.
  2. Click on Add in the bottom left corner and select Add Login script.
  3. Browse to and select the file you’ve just created.
  4. Accept, Apply and close everything.
  5. Cross you heart, hold your thumbs and reboot.

In theory it should work. Or, well, that’s how I did it anyway.

Hope it helps!

1 Like

OP has confirmed that after reinstalling, everything works as desired.