Run command at startup

In terminal I use the following command to change my laptop screen settings:

xrandr --output LVDS --brightness 0.9 --gamma 0.55

I put this command in “Session and startup preferences” in Manjaro on login, but it is not working when I login.

It is possible run this command automatically when I log in? How can I do this?

I’m not using XFCE but can recommend something of a mixture. You can make that command into a script file. Create an empty file on your home folder and name it or whatever you want. Put your command in it like this and save.

xrandr --output LVDS --brightness 0.9 --gamma 0.55

Later, put this command into your autostart:
sh ~/

Or you can wait for an XFCE user to reply. :slight_smile:

It would be better as a hidden file so better make the name start with a dot, like this:

Don’t forget giving executable permissions to the file
chmod +x ~/

1 Like
  • - Scroll down to ${XDG_CONFIG_DIRS}/autostart/

work when i run this command in terminal.

but nothing happens when i put the same code on startup preference command field

sh -c "sleep 3 && ~/"

@visone Forgot to mention that, thank you.

As @stargazer shared from Arch Wiki, you should be able to directly add the script file it seems. Add a new autostart program and choose from file manager. Should be fine I guess.

1 Like

Thank you for your help.

I chose to use a package called autorandr.

I was having a problem where any configuration I set it would run for a few seconds at startup and then go back to the previous state.

So I had to disable some items (Xfsettingsd and xiccd) in Session and startup in Manjaro xfce and it finally worked.

No problem, glad you solved your issue.
I guess xiccd is not needed unless you’re a photographer. Though xfsettingsd seems apply different XFCE config files at once, by disabling it you may need some things to start manually.

1 Like

Use the full path to the script instead of ~/

sh /home/$(USER)/

and add the sleep 3 command to the script before the xrandr command

sleep 3
xrandr --output LVDS --brightness 0.9 --gamma 0.55