2

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!!!!

dubCraft Nation
  • 160
  • 1
  • 1
  • 11

1 Answers1

2

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!

Terrance
  • 41,612
  • 7
  • 124
  • 183