1. Overview

In this tutorial, we’ll learn how to check a monitor name in Linux. We’ll see how we can display a monitor’s vendor name, model name, and interface name. In addition, we’ll also discuss the interface/connection name under X11 and Wayland. For this purpose, we’ll install and utilize different tools.

2. Check the Monitor’s Vendor and Model Name

The vendor or product name represents the actual name of the monitor. Usually, these details are provided by the monitor’s EDID. EDID stands for Extended Display Identification Data. It provides detailed information about the monitor, including the monitor’s vendor and product name. There are tools like hwinfo and read-edid that allow us to decode and display the monitor’s detailed information.

2.1. hwinfo

hwinfo is a utility that collects the hardware components of a system. It’s available on most official package repositories. We can install it using a package manager like apt:

$ sudo apt install hwinfo -y

Once it’s installed, we can use it to print a detailed report about the monitors connected to our system:

$ hwinfo --monitor
17: None 00.0: 10002 LCD Monitor
  ...
  Hardware Class: monitor
  Model: "HP v220"
  Vendor: HWP 
  ...
  Resolution: 1280x720@60Hz
...

We passed the –monitor switch to the command to limit the report to monitors only. In the output, we can see that the monitor’s vendor is “HWP“. Similarly, as we connect more monitors, hwinfo prints the information about those monitors as well.

2.2. read-edid

read-edid is a set of tools that can read and decode the EDID block of monitors.  We can install read-edid from the official package repository:

$ sudo apt install read-edid -y

Once it’s installed, we’ll get the get-edid and parse-edid binaries. The names aptly suggest their functionality, and we can use both of these tools together to make sense of the EDID data. For instance, we can read the EDID data of our monitor by piping the output of get-edid to parse-edid:

$ sudo get-edid | parse-edid
Section "Monitor"
    Identifier "HP v220"
    ModelName "HP v220"
    VendorName "HWP"
    ...
    Gamma 2.20
    Option "DPMS" "true"
    Horizsync 30-81
    VertRefresh 56-75
EndSection
...

Notably, we can see the model and vendor name in their respective fields. In addition, if we have more monitors connect, they will have their own dedicated “Section“.

3. Monitor’s Connection Name: X11

Nowadays, most Linux distributions either use Wayland or X11. Therefore, getting the interface and connection names under these display managers is different. For that reason, we’ll use a tool suitable for X11. X11 is a software suite that enables us to run graphical applications and handle user input events on Linux and UNIX machines. In other words, it’s a display manager that controls the GUI aspects of our operating system.

3.1. Connection Name

The connection name is used by X11 to identify the physical video outputs. These names are specific to the display interface, like HDMI, DisplayPort, and VGA. Usually, the format of a connection is <connector>-<output>, where <connector> is the interface type and the <output> is a numeric identifier. So, if we have a single monitor connected through DisplayPort, the connection name would be DP-1. In addition, X11 assigns these names in the order of detection.

3.2. xrandr

There is a wide range of tools available for X11 that can detect the monitor’s connection name. However, we’ll use xrandr, which is part of the X11 software suite. xrandr lets us configure the display settings of X11-based systems. On most distributions, it’s pre-installed. However, if needed, we can also install it from the distro’s official package repository:

$ sudo apt install x11-xserver-utils -y

By default, when we run xrandr, it displays the properties of the available monitors:

$ xrandr
Screen 0: minimum 320 x 200, current 1280 x 720, maximum 8192 x 8192
e-DP1 connected primary 1280x720+0+0 (normal left inverted right x axis y axis) 325mm x 192mm
   1280x720      60.00*+
   5120x2160     50.00  
...

In the output, we can see that the connection name is e-DP1. Similarly, it would print the connection names of all monitors connected to the system.

4. Monitor’s Connection Name: Wayland

Wayland is a display server protocol that provides a more secure foundation for the Linux desktop. It’s the intended replacement for X11. In the Wayland ecosystem, every compositor has unique tools and graphical settings to handle displays. Therefore, there’s no one-size-fits-all approach. For that reason, we’ll discuss a couple of the most used compositors.

4.1. GNOME’s Mutter

On GNOME, we can use the gnome-randr script. It’s a Python script that implements some of the functionality of xrandr. In order to use it, we’ll clone the repository:

$ git clone --depth 1 "https://gitlab.com/Oschowa/gnome-randr" && cd gnome-randr

Next, let’s make the script executable:

$ chmod +x gnome-randr.py

Now, we can simply run the script:

$ ./gnome-randr.py
...
logical monitor 0:
x: 0 y: 0, scale: 1.0, rotation: normal, primary: yes
associated physical monitors:
	e-DP1 HP v220
...

As we can see, the script displays the monitor’s attributes as well as the interface name.

4.2. SwayWM

SwayWM is an i3-compatible wayland compositor. It comes with the swaymsg utility, which lets us communicate with the Sway Window Manager to perform various actions.  It’s installed as a dependency of the sway package. So, if we’re running Sway, we can readily use it:

$ swaymsg -t get_outputs
Output eDP-1 'HP v220 0x0000F75D'
  Current mode: 1280x720 @ 60.000 Hz
  ...
...

The -t option specifies the type of the message, which is get_outputs. The get_outputs message prints information about the connected displays.

5. Conclusion

In this article, we learned how to display our monitor’s name in Linux. Apart from displaying the monitor’s vendor and model name, we also explored how to check the interface or connection name under X11 and Wayland.

Comments are open for 30 days after publishing a post. For any issues past this date, use the Contact form on the site.