I have a script which I would love to run after xserver has started. This file is located at /home/karl/.scripts/startup/sensei-raw-startup.sh.

How to I invoke this file after xserver has started?


Depends on what you want to do. All DEs (KDE, Gnome,...) provide ways to run programs at start, for instance in KDE you can put an executable into /home/YourName/.kde/Autostart. This is good enough for me, the details for you depend on your DE.


As suggested by @grawity in the following comment, there is a method valid for all DEs, which is to place the executable in /home/YourName/.config/autostart.

Alternatively, you can place an executable file in /etc/X11/Xsession.d, and this will be executed for all users of your system; for most people this is just as good as the above solutions since they are the only users of their laptop/desktop/whatever... Just remember to give this file a name starting with 99z, so that it is executed last: the other files in the directory need to be executed before custom scripts.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.