What is the best place to add a mode with xrandr?
As of now, I added
xrandr --newmode "1344x744_60.00" 80.75 1344 1408 1544 1744 744 747 757 773 -hsync +vsync
xrandr --newmode "1344x768_60.00" 84.00 1344 1416 1552 1760 768 771 781 798 -hsync +vsync
xrandr --addmode DP-2 "1344x744_60.00"
xrandr --addmode DP-2 "1344x768_60.00"
to my ~/.bashrc, but this is obviously not the best place, as every time I launch a bash process it tries to add modes.
So far, it only throws some errors (see below tl;dr), but it is harmless, I guess.
Perhaps .gnomerc is appropriate, although I guess if I start an xrdp session the mode may not be available.
Related:
- How to run scripts on start up?
- https://unix.stackexchange.com/questions/120291/how-to-get-external-monitor-resolution-set-by-xrandr-to-persist
EDIT:
It seems ~/.xprofile may be a good place for these settings.
I am not sure it works well with vino-server, which I need.
EDIT 2:
This suggests using ~/.xinitrc.
But it may be outdated.
TL;DR: Errors I get:
When connecting from a text terminal (e.g., ssh)
Can't open display Can't open display Can't open display Can't open displayWhen starting a graphic terminal when the modes were already added
X Error of failed request: BadName (named color or font does not exist) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 16 (RRCreateMode) Serial number of failed request: 27 Current serial number in output stream: 27 X Error of failed request: BadName (named color or font does not exist) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 16 (RRCreateMode) Serial number of failed request: 27 Current serial number in output stream: 27