1

I'm running KDE Manjaro. I have a background changer script which I want to run on login, but the thing is it doesn't do that. What I want it to do is run it every time I login doesn't matter how, whether I login in on boot or login in after sleeping the pc and waking it. I tried adding the script to:

Settings > Startup and Shutdown > Autostart > Script File

but that doesn't really work anyone got any ideas

1

I wanted to ask questions before I post a possible answer but I don't have enough rep for that so here goes many assumptions and few possibilities.

I assume you are using X11 and not Wayland. Look for a Xsession or a xinitrc file in /etc/X11/xinit/. If you have one edit it using nano or whatever floats your boat using:

sudo nano /etc/X11/xinit/xinitrc

for example and either add the content of your script there if it is concise enough or execute your script from there by adding:

source path/to/your/script.sh

Ensure that #!/bin/sh is at the top of both your script and xinitrc or Xsession file and that the file is executable by doing sudo chmod +x xinitrc, if you have xinitrc for example.

I have xinitrc in my home directory which I use so maybe you also have one or can create one(?) But then I'm not using KDE so it might not work for you. I also have one at /etc/X11/xinit/ which I don't edit.

Then edit or create the file at /etc/sddm.conf if it does not exist and add the following to it:

[X11]
SessionCommand=/etc/X11/xinit/xinitrc

for xinitrc. Maybe you could rather point it to one in your home directory? I'm not knowledgeable enough to be 100% sure. If there is already an [X11] block just add the line to it, don't add a second [X11] block.

This should run your script after logging in using SDDM which is usually KDE's display manager (the thing with your username and password when logging in). You could also use DisplayCommand instead of SessionCommand and then point it to /etc/sddm/Xsetup but it might not run after just logging out and back in, it will run after starting the display manager(i.e. a system restart), but I don't know if it actually restarts after logging back in.

If this was not helpful, I am sorry, here are the documentation I read which lead me to the solutions I provided which you can also use and I am very sure that you will find a solution out of them:

4
  • I'm going to try this out and I'll let you know if this works then, Thanks – rodude123 Aug 13 '20 at 11:11
  • That broke my desktop environment hat to reset it. – rodude123 Aug 15 '20 at 10:15
  • 1
    What happened? Were you able to login through sddm? Can you get to a tty session? I would try doing the same but in the different files I have mentioned until something worked, i.e. try the xinitrc file instead of the Xsession file and try creating ones in the home directory instead of changing the ones in /etc/. Also if you were able to get a tty session and login, what do you get when you type startx? I am still sure that the links I provided can help you reach your goal, otherwise we can just wait until some expert comes along here. – Zander Labuschagne Aug 17 '20 at 9:57
  • I didn't get time to look at this sorry. I just gave up really, lol. I'll have look at those links. They seem useuful thanks – rodude123 Aug 21 '20 at 22:13

Your Answer

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

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