Ok so, a while back I asked a question on how to manually set my vga resolution on Ubuntu. But I need to do this upon LOGIN (ie NOT ON BOOT). I need to run sudo cvt 1366 768 && sudo xrandr --newmode "1366x768_60.00" 74.50 1280 1344 1472 1664 720 723 728 748 -hsync +vsync && sudo xrandr --addmode VGA1 1366x768_60.00
ON LOGIN again this needs to be automatically run at login on all users no matter the desktop I choose at boot (ie Kodi, Unity, Xfce etc) Please help!!!!

- 160
- 1
- 1
- 11
-
1Possible duplicate of How to run xrandr commands at startup in Ubuntu – Jacob Vlijm Jul 02 '16 at 07:17
-
^ the linked dupe actually is about log in, as often. – Jacob Vlijm Jul 02 '16 at 08:09
1 Answers
Create a .desktop
file in the /etc/xdg/autostart
folder. Any .desktop
file in that folder will be started as it is a system wide used folder that all users existing and new upon logging in will have applications start from. No need to create separate startup applications / links / shortcuts for each user. More information can be found here: FreeDesktop.Org/xdg-autostart
For the contents of the /etc/xdg/autostart/<filename>.desktop
file add in the following:
NOTE: xrandr
does not need to be loaded with sudo
in front of it.
[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=Some Name
Comment=Some Comment
Exec=bash -c 'cvt 1366 768 && xrandr --newmode "1366x768_60.00" 74.50 1280 1344 1472 1664 720 723 728 748 -hsync +vsync && xrandr --addmode VGA1 1366x768_60.00'
If you need a startup delay of like 10 seconds, change the Exec
line to the following:
Exec=bash -c 'sleep 10 && cvt 1366 768 && xrandr --newmode "1366x768_60.00" 74.50 1280 1344 1472 1664 720 723 728 748 -hsync +vsync && xrandr --addmode VGA1 1366x768_60.00'
Your .desktop
file should be owned by root:
sudo chown root:root /etc/xdg/autostart/<filename>.desktop
and it needs to be set with -rw-r--r--
permissions:
sudo chmod 644 /etc/xdg/autostart/<filename>.desktop
When you log in, this file should be called now from any user in any desktop.
Hope this helps!

- 41,612
- 7
- 124
- 183
-
-
@dubCraftNation I had a similar type thing with a video issue I was having, and without the delay on it, the settings never took. I added the delay, and it worked great after that. Try without and see if it works. – Terrance Jul 02 '16 at 02:24
-
-
-
Could not apply stored configuration for monitors Error on line 1 char 1: Document must begin with an element (e.g.
) – dubCraft Nation Jul 02 '16 at 02:28 -
@dubCraftNation Might want to check here: http://askubuntu.com/questions/552329/error-box-related-to-display-driver-using-virtualbox But it looks like you might need to delete
~/.config/monitors.xml
– Terrance Jul 02 '16 at 02:32 -
1This works flawlessly! Thank you sooooooo much. One more thing: Can I use this method for any other software if I change the command to that software? – dubCraft Nation Jul 02 '16 at 02:38
-
-
-