Skip to content

Wayland does not directly support screen rotation through tools such as xrandr like Xorg. This approuch is used for screen rotation on Wayland using the command line.

Notifications You must be signed in to change notification settings

srleohung/wayland-monitor-config

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gnome Monitor Config on Wayland

On Wayland, screen rotation is typically handled differently than on Xorg due to the differences in architecture and design between the two display servers. Wayland does not directly support screen rotation through tools like xrandr as Xorg does. This approuch is used for screen rotation on Wayland using the command line.

Run the following command to check the session type:

echo $XDG_SESSION_TYPE
# Output: wayland

Install Dependencies

Install Python 3 & Ninja

sudo apt-get install python3 python3-pip python3-setuptools python3-wheel ninja-build

Install Meson

Install as a local user (recommended):

pip3 install --user meson

Install as root:

sudo pip3 install meson

Install build dependencies

# Related errors: src/meson.build:3:8: ERROR: Dependency lookup for cairo with method 'pkgconfig' failed: Pkg-config for machine host machine not found. Giving up.
sudo apt-get install libcairo2-dev libjpeg-dev libgif-dev

Build

The following steps can be used to build gnome-monitor-config

$ meson build
$ cd build
$ meson compile

The output binary can be found in build/src/gnome-monitor-config.

Usage

For usage details, run

# Path: gnome-monitor-config/build/src/gnome-monitor-config
$ ./gnome-monitor-config --help

Usage: ./src/gnome-monitor-config [OPTIONS...] COMMAND [COMMAND OPTIONS...]
Options:
 -h, --help                  Print help text

Commands:
  list                       List current monitors and current configuration
  set                        Set new configuration
  show                       Show monitor labels

Options for 'set':
 -L, --logical-monitor       Add logical monitor
 -x, --x=X                   Set x position of newly added logical monitor
 -y, --y=Y                   Set y position of newly added logical monitor
 -s, --scale=SCALE           Set scale of newly added logical monitor
 -t, --transform=TRANSFORM   Set transform (normal, left, right, flip)
 -p, --primary               Mark the newly added logical monitor as primary
 -m, --mode                  Set the display resolution and refresh rate. ex: 1920x1080@60
 -M, --monitor=CONNECTOR     Add a monitor (given its connector) to newly added
                             logical monitor
 -p, --primary               Mark the newly added logical monitor as primary
 --logical-layout-mode       Set logical layout mode
 --physical-layout-mode      Set physical layout mode

When running this as a service or crontab script, it may be necessary to:

export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus

Single-Monitor configuration

Start with gnome-monitor-config list to get a list of available monitors and configurations.

$ gnome-monitor-config list
...
  [email protected] [id: '[email protected]'] [preferred scale = 1 (1)]
  720x576@50 [id: '[email protected]'] [preferred scale = 1 (1)]
Logical monitor [ 2560x1440+0+0 ], scale = 1, transform = left
  DP-3
Logical monitor [ 3840x1600+1440+270 ], PRIMARY, scale = 1, transform = normal
  DP-1
Max screen size: unlimited

For example to set a single display to a particular configuration:

$ gnome-monitor-config set -LpM DP-1 -t normal -m [email protected]

This sets the display attached to DP-1 as the primary display (specified with -p) at [email protected] configuration with a normal orientation.

Multi-Monitor config

Similarly, to setup multple monitors. First use the list command to get a list of what is available, then simply:

$ gnome-monitor-config set -LM DP-3 -m [email protected] -t left -LpM DP-1 -m [email protected]" -x 1440 -y 270 -t normal 

This command sets the monitor attached to DP-3 at the starting point [0, 0], configured at [email protected] and left transformed (portrait). Then the next monitor on DP-1 is configured as the primary (-p) with an x,y offset of [1440, 270] relative to the first one with normal orientation. For getting the correct y offset with multiple monitors, you can simple experiment with the value to get an appropriate alignment.

About

Wayland does not directly support screen rotation through tools such as xrandr like Xorg. This approuch is used for screen rotation on Wayland using the command line.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 97.5%
  • Shell 1.2%
  • Meson 1.2%
  • Makefile 0.1%