1. Overview

If the login screen isn’t oriented properly with the monitor, users may find it difficult to read the text and navigate the interface. Therefore, rotating the screen correctly to align with a rotated monitor ensures consistency and increases accessibility.

In this tutorial, we’ll explore two ways to rotate the login screen in Linux.

2. Using Xorg Configuration File

Using the Xorg configuration file in Linux, we can rotate the login screen for a rotated monitor. Typically, the Xorg configuration file is also used to customize the behavior of the input devices, graphics settings, and display settings.

2.1. Modifying Xorg Configuration File

Before opening the Xorg configuration file, we need to know the name of the monitor.

Therefore, we utilize the xrandr command to list all the monitors connected with the system:

$ xrandr
Screen 0: minimum 16 x 16, current 1920 x 1080, maximum 32767 x 32767
HDMI-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 340mm x 190mm
   1920x1080     60.00*+
   1440x1080     59.94
...output truncated...

From the output, we find the name of the monitor: HDMI-1.

The next step is to open the Xorg configuration file and insert some instructions to rotate the login screen:

$ sudo cat /etc/X11/xorg.conf.d/10-monitor.conf
 "Monitor"
    Identifier "HDMI-1"
    Option "Rotate" "left"  # or right, inverted, normal
EndSection

Section "Screen"
    Identifier "Screen0"
    Device "Device0"
    Monitor "HDMI-1"
EndSection

Here, we specified the monitor’s name and added a command to rotate it via Option “Rotate” left. Moreover, we can perform four types of rotations:

  • left
  • right
  • inverted
  • normal

Once we add the custom instructions, we save the file and exit from the text editor.

2.2. Configuring GNOME Display Manager

After modifying the Xorg configuration file, it’s important to ensure that the GNOME Display Manager (GDM) is correctly configured to use the Xorg display server.

We can verify this by opening the GDM configuration file:

$ sudo cat /etc/gdm3/custom.conf 
GDM configuration storage
#
# See /usr/share/gdm/gdm.schemas for a list of available options.

[daemon]
# Uncomment the line below to force the login screen to use Xorg
#WaylandEnable=false

# Enabling automatic login
#  AutomaticLoginEnable = true
#  AutomaticLogin = user1

# Enabling timed login
#  TimedLoginEnable = true
#  TimedLogin = user1
#  TimedLoginDelay = 10

In the configuration file, we find the option WaylandEnable and disable it:

WaylandEnable=false

By disabling the WaylandEnable option, we make sure that GDM can’t use the Wayland server.

Finally, to apply the changes we made, we restart the GDM service using the systemctl command:

$ sudo systemctl restart gdm

Now, the rotation we specified on the Xorg configuration file should be reflected in the system and the screen should be rotated.

3. Using Custom GDM Script

An alternative approach is to create a custom script for GDM to rotate the login screen in Linux.

First, we create the required directory using the mkdir command:

$ sudo mkdir -p /etc/gdm3

The next step is to create a script file:

$ sudo touch /etc/gdm3/RotateScreen

Now, we’ve created a script RotateScreen. Moreover, the script should be automatically executed before the start of the desktop environment.

Furthermore, we open the script and add a command to rotate the login screen:

$ sudo cat /etc/gdm3/RotateScreen
#!/bin/bash
xrandr --output HDMI-1 --rotate right  # or left, inverted, normal

Here, we specify the name of the monitor and the rotation we want to perform. Additionally, the xrandr command enables us to change display settings dynamically via –rotate. Finally, we save the file and exit the text editor.

Furthermore, the next step is to make the script executable so that GDM can execute it. Therefore, we utilize the chmod command to change the permission of the script to be executable:

$ sudo chmod +x /etc/gdm3/RotateScreen

Thus, GDM can use the script we created.

The final step is to restart GDM to apply the changes we made:

$ sudo systemctl restart gdm

After restarting, the login screen should rotate to the right as specified in the script.

4. Conclusion

In this article, we discussed two methods for rotating the login screen for a rotated monitor in Linux.

Modifying the Xorg configuration file and inserting the rotation we want to perform is fairly straightforward. However, it’s important to add the correct name of the monitor we want to rotate.

On the other hand, creating a custom script for GDM to rotate the login screen in Linux requires a bit more technical knowledge. It involves several steps to create a file, add instructions, and change the permission of the file to make it executable.