If you are using Fedora 38 as your operating system, you may have encountered some issues with the screen resolution. The default resolution may not be suitable for your monitor or your preferences, and you may want to change it to a higher or lower value. However, changing the resolution from the Settings menu may not work properly, or it may not persist after a reboot. In this blog post, I will show you how to set up a custom screen resolution on Fedora 38 permanently using some simple commands and configuration files.
The first step is to disable the Wayland display server, which is the default display server for Fedora 38. Wayland is a modern and secure display server, but it may not support some custom resolutions or drivers. To disable Wayland, you need to edit the /etc/gdm/custom.conf
file as root. You can use any text editor of your choice, such as nano, vim, or gedit. To open the file with nano, for example, you can type the following command in the terminal:
sudo nano /etc/gdm/custom.conf
You will be prompted to enter your password. After that, you will see the contents of the file in the terminal. Look for the line that says #WaylandEnable=false
and remove the hash (#
) at the beginning of the line. This will uncomment the line and set the value to false, which means Wayland will be disabled. The line should look like this:
WaylandEnable=false
Save the file by pressing Ctrl+O and then exit by pressing Ctrl+X. You can also use other commands depending on the text editor you are using.
The next step is to find out the resolution that you want to set for your screen. You can use any resolution that is supported by your monitor and your graphics card. For example, if you want to set a resolution of 1280x1024, which is a common 5:4 aspect ratio resolution, you can use the cvt
command to generate a modeline for this resolution. A modeline is a string of parameters that defines how a video mode should be displayed. To generate a modeline for 1280x1024 resolution, type the following command in the terminal:
cvt 1280 1024
You will see an output like this:
# 1280x1024 59.89 Hz (CVT 1.31M4) hsync: 63.67 kHz; pclk: 109.00 MHz Modeline "1280x1024_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
The modeline is the second line that starts with Modeline
. You will need this modeline for the next step.
The final step is to use the xrandr
command to add and apply the new resolution. The xrandr
command is a tool for managing the screen resolution and refresh rate of your display. To use this command, you need to know the name of your display output, which is usually something like eDP-1
for laptops or HDMI-1
for external monitors. You can find out the name of your display output by typing xrandr
without any arguments in the terminal. You will see an output like this:
Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 8192 x 8192 eDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 344mm x 194mm 1920x1080 60.01*+ 60.01 59.97 59.96 59.93 ...
The first line after Screen 0:
shows the name of your display output and its current resolution and refresh rate. In this example, the name of the display output is eDP-1
. Note down the name of your display output for the next step.
To add and apply the new resolution, you need to use the xrandr
command with some arguments. The first argument is --newmode
, which adds a new mode with a given name and modeline. The second argument is --addmode
, which adds a new mode to a given output device. The third argument is --output
, which specifies which output device to use. The fourth argument is --mode
, which specifies which mode to use.
For example, if you want to add and apply a resolution of 1280x1024 with a modeline of "1280x1024_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
to a display output of eDP-1
, you can type the following command in the terminal:
xrandr --newmode "1280x1024_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
xrandr --addmode eDP-1 "1280x1024_60.00"
xrandr --output eDP-1 --mode "1280x1024_60.00"
You can replace the values with your own resolution, modeline, and display output name. After typing the command, you should see your screen resolution change to the new value.
However, this change is not permanent and will be reset after a reboot. To make it permanent, you need to create a script that runs these commands at startup. To do that, you can follow these steps:
- Create a new file in your home directory and name it something like
resolution.sh
. You can use any text editor of your choice, such as nano, vim, or gedit. To open the file with nano, for example, you can type the following command in the terminal:
nano resolution.sh
- In the file, type the following lines:
#!/bin/bash
xrandr --newmode "1280x1024_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
xrandr --addmode eDP-1 "1280x1024_60.00"
xrandr --output eDP-1 --mode "1280x1024_60.00"
You can replace the values with your own resolution, modeline, and display output name.
- Save the file by pressing Ctrl+O and then exit by pressing Ctrl+X. You can also use other commands depending on the text editor you are using.
- Make the file executable by typing the following command in the terminal:
chmod +x resolution.sh
- Move the file to the
/etc/profile.d/
directory by typing the following command in the terminal:
sudo mv resolution.sh /etc/profile.d/
You will be prompted to enter your password.
This will make the script run automatically at every login and apply your custom resolution.
That’s it! You have successfully set up a custom screen resolution on Fedora 38 permanently. You can enjoy your new resolution and adjust it as needed.
Comments
Post a Comment