I have a small script that I manually need to execute each day to set my refresh rate to 120Hz. This is what the script has:
#!/bin/bash
xrandr --output HDMI-1 --mode 1920x1080 --rate 120
echo 120Hz Has been Enabled
How can I set this as my default mode, each time I boot into my OS I am automatically assigned back to 60Hz. Here is my xrandr output for the display in question:
HDMI-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 531mm x 298mm
1920x1080 60.00 + 120.00* 100.00 119.88 119.98 99.91 50.00 59.94
3840x2160 30.00 25.00 24.00 29.97 23.98
1280x1024 119.96 75.02 60.02
1440x900 119.85
1280x960 99.99
1152x864 75.00
1280x720 60.00 50.00 59.94
1024x768 119.99 75.03 60.00
800x600 119.97 99.99 75.00 60.32
720x576 50.00
720x480 60.00 59.94
640x480 119.99 75.00 60.00 59.94
720x400 70.08
There are two ways you could accomplish this:
The first way would be to execute your script each time X starts by adding sh path-to-my-script.sh
to your ~/.xinitrc
file
A more permanent way to do this would be to edit your xorg.conf
file, usually located at /etc/X11/xorg.conf
.
First you need a modeline, to get a modeline for your resolution and refresh rate execute
cvt <x resolution> <y resolution> <refresh rate>
in your case
cvt 1920 1080 120
Then find your monitor in xorg.conf
and add only the numbers from the modeline, it should look something like this (but with different values of course):
Section "Monitor"
Identifier "dummy_monitor"
HorizSync 28.0-80.0
VertRefresh 48.0-75.0
Modeline "1920x1080" 172.80 1920 2040 2248 2576 1080 1081 1084 1118
EndSection
for more info on how to configure your xorg file you can read on the arch wiki
I was able to fix my issue following the steps below.
Notes: I'm current using Debian 10 with the Gnome graphical interface and Xorg server.
I follow the instructions at Gnome documentation to add a xrandr script which changes the resolution right after user login:
[Desktop Entry]
Type=Application
Name=xrandr
Exec=xrandr --output Virtual1 --mode 1280x768 --preferred
OnlyShowIn=GNOME;
I'm sure there is a more elegant solution out there, but I haven't found it yet.
This is the Gnome documentation link: https://help.gnome.org/admin/system-admin-guide/stable/autostart-applications.html.en
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.