Alex Iceman
Alex Iceman

Reputation: 1767

Wayland, how to force a custom Display resolution?

I've been using X11 for many years and xrandr has been a great tool.

I am able to set a custom resolution to my display (not officially supported resolution) by using the code blow. However Wayland doesn't have xrandr.

How can I force a custom unsupported resolution in Wayland?

Here is my xrandr code that works well in Xorg.

#!/bin/bash

# Function to get the currently connected display name
get_connected_display() {
  xrandr --query | grep -w "connected" | awk '{print $1}'
}

# Set custom resolution
custom_resolution="3840x720"

# Set rotation
rotation="inverted"

# Get the currently connected display
display_name="$(get_connected_display)"

# Add the custom resolution using xrandr
xrandr --newmode "$(cvt 3840 720 60 | grep -oP '(?<=Modeline ).*')"

# Add the custom mode to the display
xrandr --addmode "$display_name" "$custom_resolution"

# Apply the custom resolution and rotation to the display
xrandr --output "$display_name" --mode "$custom_resolution"

So far I've tried setting up the resolution at boot time, but it has no effect. I'd appreciate help if somebody actually forced a resolution in Wayland and had it working properly.

Upvotes: 0

Views: 1285

Answers (0)

Related Questions