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 display
When 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
vino-server
and TigerVNC under Win10 as a client. I had implemented the.xprofile
method. I just rebooted for the first time since this posting. At first I couldn't start a VNS session, and it turned out thatvino-server
did not start. So I tried renaming.xprofile
, rebooting, and nowvino-server
started, and I could start a VNC session as usual. Then I issued the commands from a terminal. – sancho.s ReinstateMonicaCellio Aug 27 '20 at 09:43vino-server
is somewhat fragile, and I have almost no access to the console. – sancho.s ReinstateMonicaCellio Aug 27 '20 at 09:43