2

What automatically executed script (~/.xinitrc, ~/.bash_profile, etc) is the best place to put a call to xrandr to set the correct refresh rate for my monitor on login?

I'm using Ubuntu 18.04, and i3wm. I'm using bash as my shell, and xdm as my display manager. All of the scripts I've tried have either not executed the command, or have not done so automatically on login.

1 Answer 1

2

Open Startup Applications program and add you xrandr command there. You can put your xrandr in a script and add a script, or enter xrandr command directly in Startup Applications.

enter image description here

3
  • I'm not sure what Desktop Environment you're using. My desktop environment does not have a 'Startup Applications'. I'm specifically asking what script, invoked by my shell, window manager, x11, or etc, should I put this command in. Commented Jul 20, 2021 at 7:36
  • Oops. I overlooked that you are using xdm. In that case, I would suggest ~/.xinitrc. I think the last line in .xinitrc is usually the window manager. xrandr requires running Xorg and a DISPLAY. Xorg is already running when executing ~/.xinitrc, so executing xrandr should work. If you would put xrandr in ~/.bash_profile, xrandr would try to execute every time you open a new terminal and even when you would login in tty. Commented Jul 20, 2021 at 11:00
  • If you have ~/.xinitrc file, do not put your xrandr after exec statement, because it will not be executed. Your programs should be started before that and window manager is always the last. If you do not have /.xinitrc, copy default xinitrc (/etc/X11/xinit/xinitrc) to /.xinitrc and then edit it. Commented Jul 20, 2021 at 11:08

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.