drama I had a little time today, so I've played around in a VM to figure out all how to get
xrandrto run on boot.
- I've got
xrandr to successfully change the resolution at boot, however it only effects the Greeter (login screen)
- At login the resolution will reset to what ever the user has selected
- After loging out, the Greeter will reset to the default resolution (
xrandr will not run again).
We will create a shell script and place it in
/usr/local/sbin. By placing our script in said folder, we can call/execute our script as a command.
By default Solus doesn't have
/usr/local/sbin so we need to create it:
mkdir -p /usr/local/sbin
Next we need to make our shell script:
# DEBUG OUTPUT
echo "Display: $DISPLAY"
echo "Xauth: $XAUTHORITY"
# wait for DM to start
# xrandr commands to run
xrandr --newmode "1280x720_60.00" 74.50 1280 1344 1472 1664 720 723 728 748 -hsync +vsync
xrandr --addmode VGA-0 "1280x720_60.00"
xrandr --output VGA-0 --mode "1280x720_60.00"
Note: We need to add
sleep to our script. In testing I've found that the shell script may be called to early and fail. Adding a 1 second timeout was enough to ensure that LightDM was fully started before executing the script.
Setup SystemD service
First we need to get the environmental variables for
To get the value for
DISPLAY do the following:
XAUTHORITY we need to find the path of the X authority file that our Display Manager uses.
For SDDM (KDE) we do:
find /var/run/sddm/ -type f
For LightDM (Budgie) we do:
find /var/run/lightdm/root/ -type f
Next we need to create a systemd service script in
/etc/systemd/system/, the name doesn't matter but it must end in
.service. (Change the values as necessary.)
sudo gedit /etc/systemd/system/startup.service
Description=Setup VGA Fix
If you don't want to use a shell script, another option is to use
oneshot will execute each comand in series, and if a command fails to run it will abort the service.
For our purposes there is no difference between using
oneshot or running a shell script. \
(I just added it for completeness)
ExecStart=/usr/bin/xrandr --newmode "1280x720_60.00" 74.50 1280 1344 1472 1664 720 723 728 748 -hsync +vsync
ExecStart=/usr/bin/xrandr --addmode VGA-0 "1280x720_60.00"
ExecStart=/usr/bin/xrandr --output VGA-0 --mode "1280x720_60.00"
Due to the limitations listed above I don't know if this will solve your issue, though this does do what was requested "run a script (a series of commands) at boot" (
xrandr in specific).
Since the change doesn't apply to the user, you may need to follow @brent's suggestion and setup a autostart (you can link to the same
For the Greeter logout/switch user issue, I don't have any ideas at the moment. I don't really know anything about how Greeters work so I'm currently at a loss for any suggestions.
You may want to look into LightDM (since your on Budgie) there may be a better solution there. It looks like you may be able to run
xrandr directly though/by LightDM, it may be a better solution for what your trying to do (Arch Wiki).
Another option would be to configure x directly, but again I definitely won't be much help there.