How to get Wayland monitor resolution in Linux?
- User
How to get Wayland monitor resolution in Linux?
- Assistant
To get the monitor resolution in a Wayland session on Linux, you can use various tools or commands that are designed to work with Wayland. Here are a few methods you can try:
Method 1: Using
wlr-randrwlr-randris a utility for Wayland systems similar toxrandron X11. If it's not installed, you can usually find it in your distribution’s package manager.To install it, you might run:
# On Debian/Ubuntu-based systems sudo apt install wlr-randr # On Arch-based systems sudo pacman -S wlr-randr # On Fedora sudo dnf install wlr-randrAfter installation, you can use it like this:
wlr-randrThis command will display the connected monitors along with their resolutions.
Method 2: Using
swaymsg(if using Sway)If you are using the Sway window manager, you can use the
swaymsgcommand to query monitor details:swaymsg -t get_outputsThis will provide detailed information about connected outputs, including their resolutions.
Method 3: Using
gnome-settings(if using GNOME)If you're using a GNOME-based environment under Wayland, you can use dconf or gsettings to get monitor settings:
gsettings get org.gnome.desktop.interface scaling-factorHowever, checking the current resolution specifically is less direct here. You can also check monitor settings through the GNOME display settings GUI.
Method 4: Using
weston-info(if using Weston)If you are using the Weston compositor, you can use
weston-infoto get information about connected monitors:weston-infoThis will output various details about the compositor, including connected monitors and their resolutions.
Method 5: Using
loginctlfor generic outputsYou can also check if you are using a Wayland session by using:
loginctl show-session $XDG_SESSION_IDThis command can help confirm if you are running a Wayland session, but it won't give monitor resolutions directly.
Summary
The most straightforward method typically involves using
wlr-randrorswaymsgif you are working with a Wayland compositor like Sway. If you're using a specific desktop environment like GNOME, the settings manager or the GUI is often the easiest way to check your monitor's resolution settings.