Execute bash script after startup

Hi forum,

I have a bash script that adds a custom resolution to my monitor. (77hz instead of 60hz)
however I added it to settings-autostart but I won’t start after the pc boots. I know the script works because I can still just right click and execute it manually.

#!/bin/bash
xrandr --newmode "1920x1080_77.00" 227.00  1920 2064 2264 2608  1080 1083 1088 1131 -hsync +vsync
xrandr --addmode HDMI-A-0 1920x1080_77.00

Is there anything I can change or add here to make it start after boot?
thank you!

P.S.: I found a similar problem, but this guy’s solution didn’t work for me.
Bonus question: will xrandr (and this script) still work if I change to wayland in the future?

Hello,

Might want to see this

And no, xrandr will not work under wayland.
If you need the script to start later, place
sleep 5
above the main command, and that will delay it 5 seconds with my example.

Or create a desktop file as mentioned here

and add it to ~/.config/autostart/
or maybe the sh script file directly to ~/.config/autostart-scripts/ but i can’t guarantee … never used that ever.

3 Likes

Hey thanks so much, I didn’t such a good answer.
As I am not really good with scripts in general and because it took me ages to figure out how to create custom resolutions, this will be my weekend project.
But I will let you know if it worked, you have given me plenty of options, thanks for that!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.