way-displays: Manage Your Wayland Displays

Overview

way-displays: Manage Your Wayland Displays

  1. Sets preferred mode or highest at maximum refresh
  2. Arranges left to right
  3. Auto scales based on DPI: 96 is a scale of 1
  4. Reacts when displays are plugged/unplugged
  5. Reacts when laptop lid is closed/opened

Works out of the box: no configuration required.

See an example session for more details.

Wayland successor to xlayoutdisplay

Inspired by kanshi

Requirements

The wayland compositor must support the WLR (wayland roots) Output Management protocol.

Such compositors include:

Usage

Run once after your wayland compositor has been started. way-displays will remain in the background, responding to changes, such as plugging in a display, and will terminate when you exit the compositor.

way-displays will print messages to inform you of everything that is going on.

Example: sway

sway will start way-displays once on startup via the exec command. See man 5 sway.

Remove any output commands from your sway config file and add the following:

exec way-displays > /tmp/way-displays.${XDG_VTNR}.${USER}.log 2>&1

Look at /tmp/way-displays.1.me.log to see what has been going on.

Configuration

The following are used, in order: $XDG_CONFIG_HOME/way-displays/cfg.yaml, $HOME/.config/way-displays/cfg.yaml, /usr/local/etc/way-displays/cfg.yaml, /etc/way-displays/cfg.yaml

See default configuration at /etc/way-displays/cfg.yaml.

To get started:

mkdir ~/.config/way-displays
cp /etc/way-displays/cfg.yaml ~/.config/way-displays/cfg.yaml

cfg.yaml will be monitored for changes, which will be immediately applied.

Option: Order

The default left to right order is simply the order in which the displays are discovered.

Define this own e.g.:

ORDER:
    - 'DP-2'
    - 'Monitor Maker ABC123'

Option: Auto Scaling

The default is to scale each display by DPI.

This may be disabled and scale 1 will be used, unless a SCALE has been specified.

AUTO_SCALE: false

Option: Custom Scales

Auto scale may be overridden for each display e.g.

SCALE:
    - NAME_DESC: 'Monitor Maker ABC123'
      SCALE: 1.75

Option: Laptop Display Name Prefix

Laptop displays usually start with eDP e.g. eDP-1. This may be overridden if your laptop is different e.g.:

LAPTOP_DISPLAY_PREFIX: 'eDPP'

On Names and Descriptions

You can configure displays by name or description. You can find these by looking at the logs e.g.

DP-3 Arrived:
    name:     'DP-3'
    desc:     'Unknown Monitor Maker ABC123 (DP-3 via HDMI)'

It is recommended to use the description rather than the name, as the name may change over time and will most likely be different on different PCs.

The description does contain information about how it is connected, so strip that out. In the above example, you would use the description Monitor Maker ABC123.

Installation

AUR

way-displays

Install with your favourite package manager e.g. pacaur -S way-displays

Build From Source

Dependencies:

  • gcc
  • wayland
  • wayland-protocols
  • wlroots
  • libinput
  • yaml-cpp

Most will be available if you are running a wlroots based compositor like sway.

yaml-cpp will need to be installed via your distribution's package manager.

Build

git clone gi[email protected]:alex-courtis/way-displays.git
cd way-displays
make

Install / Uninstall

sudo make install
sudo make uninstall

On Scale And Blurring

When using a display scale that is not a whole number, the result will not be a pixel perfect rendition of the unscaled content. There are no fractional pixels so there will be rounding and thus some blurring.

To ameliorate this, we always round our scale to a multiple of one eighth. This results in a nice round binary number, which minimises some of the rounding and results in a smoother image. If you're interested, our rounded scale is a wl_fixed_t.

Help, Questions, Suggestions And Ideas

Please create a github issue.

Contributing

Enhancements and bug fixes are very welcome: please raise an issue or fork this repo and submit a PR.

Comments
  • Fails to build on 32-bit architectures (armv7, x86)

    Fails to build on 32-bit architectures (armv7, x86)

    src/log.c: In function 'log_print':
    src/log.c:21:59: error: format '%ld' expects argument of type 'long int', but argument 7 has type 'suseconds_t' {aka 'long long int'} [-Werror=format=]
       21 |                 fprintf(__stream, "%s [%02d:%02d:%02d.%03ld]\n", prefix, tm->tm_hour, tm->tm_min, tm->tm_sec, tv.tv_usec / 1000);
          |                                                       ~~~~^                                                   ~~~~~~~~~~~~~~~~~
          |                                                           |                                                              |
          |                                                           long int                                                       suseconds_t {aka long long int}
          |                                                       %03lld
    src/log.c:25:51: error: format '%ld' expects argument of type 'long int', but argument 7 has type 'suseconds_t' {aka 'long long int'} [-Werror=format=]
       25 |         fprintf(__stream, "%s [%02d:%02d:%02d.%03ld] %s", prefix, tm->tm_hour, tm->tm_min, tm->tm_sec, tv.tv_usec / 1000, suffix);
          |                                               ~~~~^                                                    ~~~~~~~~~~~~~~~~~
          |                                                   |                                                               |
          |                                                   long int                                                        suseconds_t {aka long long int}
          |                                               %03lld
    cc1: all warnings being treated as errors
    

    • Alpine Linux Edge
    • gcc 11.2.1
    • musl libc 1.2.2
    bug 
    opened by jirutka 13
  • Resolution

    Resolution

    Hi, probably a noob question, but I see

    MAX_PREFERRED_REFRESH For the specified displays, use the maximum avalable refresh rate for resolution of the preferred mode. e.g. when preferred mode is 1920x1080@60Hz, use 1920x1080@165Hz

    in documentation. How do I set preferred mode? (on sway specifically)

    I have these modes

    I [14:58:34.510] HDMI-A-1 Arrived:
    I [14:58:34.510]   info:
    I [14:58:34.510]     name:     'HDMI-A-1'
    I [14:58:34.510]     desc:     'Samsung Electric Company U28E590 H4ZM901003 (HDMI-A-1)'
    I [14:58:34.510]     width:    610mm
    I [14:58:34.510]     height:   350mm
    I [14:58:34.510]     dpi:      158.32 @ 3840x2160
    D [14:58:34.510]     mode:     3840x2160@30Hz (preferred)
    D [14:58:34.510]     mode:     3840x2160@30Hz
    D [14:58:34.510]     mode:     3840x2160@30Hz
    D [14:58:34.510]     mode:     3840x2160@25Hz
    D [14:58:34.510]     mode:     3840x2160@24Hz
    D [14:58:34.510]     mode:     3840x2160@24Hz
    D [14:58:34.510]     mode:     2560x1440@60Hz
    D [14:58:34.510]     mode:     1920x1080@60Hz
    D [14:58:34.510]     mode:     1920x1080@60Hz
    

    with 3840x2160@30Hz (preferred). However I would like to use 2560x1440@60Hz (I don't really care if it is preferred or no). Setting output HDMI-A-1 res 2560x1440@60Hz (or with mode) doesn't seem to work, since way-displays will override it. Can you please help setting my resolution? Thanks

    opened by peter-si 12
  • Feature request: Disable/enable monitors

    Feature request: Disable/enable monitors

    First of all I love this program, I like that way-displays turns on all monitors when you first run it without configuration, and the config is very straightforward. And it autoupdates when the config is saved, much faster than wlr-randr and wdisplays.

    But currently all monitors are turned on by default. It would be great to specify which monitors are powered on or off. One way to implement this in the config is to only turn on monitors listed in the ORDER. For example:

    eDP-1 on only:

    ORDER:
        - 'eDP-1'
    

    HDMI-1 on only:

    ORDER:
        - 'HDMI-1'
    

    Both on: (and keep the current behavior of turning all monitors on if the order key is undefined or empty)

    ORDER:
        - 'eDP-1'
        - 'HDMI-1'
    

    Maybe ORDER could also be renamed to DISPLAYS to be more intuitive.

    What do you think?

    opened by kiasoc5 10
  • Feature: Maximum Preferred Refresh

    Feature: Maximum Preferred Refresh

    Hey there!

    Quick question, is there an option for the tool to try to force the maximum refresh rate using the resolution from the "preferred" configuration (for stability)?

    opened by skyne98 10
  • Feature: Arrange: row|column Align: bottom|middle|top|left|right

    Feature: Arrange: row|column Align: bottom|middle|top|left|right

    Thanks for the great package!

    By default dissimilar-sized displays align by the top edge which is not easy to accomplish in the physical world with a laptop on a desk with an external display. Thus, the mouse, for example, does not 'flow' properly from one display to the next.

    smaller

    It would be helpful if there were the ability to set the position alignment to 'Bottom', and have way-displays do the math to make it happen. I would propose that Bottom should be the default, also.

    opened by steveb-123 10
  • Lid closing is not detected

    Lid closing is not detected

    When I close my laptop lid, the workspaces on the laptop monitor are not moved to the external monitor at all. The message Lid closed does not show up in the logs either.

    However, cat /proc/acpi/button/lid/LID0/state still outputs the correct state of my lid.

    Additional info:

    • sway version 1.6-f2b6d1ec
    • wlroots 07ccc6e0
    • way-displays 1.2.1
    opened by minhduc0711 8
  • Documentation about new client

    Documentation about new client

    Hello, do you have some document to how implement "The client could use the same IPC socket and YAML streaming protocol as the CLI." our application ( a simple desktop ) runs on sway and we want dev a go app to control monitor . Regards, Nicolas

    documentation 
    opened by limbo127 6
  • Display Enabled With Lid Closed At Startup

    Display Enabled With Lid Closed At Startup

    I [16:47:50] Found configuration file: /home/alex/.dotfiles/config/way-displays/cfg.yaml
    I [16:47:50]   Arrange in a ROW aligned at the TOP
    I [16:47:50]   Order:
    I [16:47:50]     HDMI-A-1
    I [16:47:50]   Auto scale: ON
    I [16:47:50]
    I [16:47:50] HDMI-A-1 Arrived:
    I [16:47:50]   info:
    I [16:47:50]     name:     'HDMI-A-1'
    I [16:47:50]     desc:     'Unknown ASUS XG32V 0x0000CF52 (HDMI-A-1)'
    I [16:47:50]     width:    700mm
    I [16:47:50]     height:   390mm
    I [16:47:50]   current:
    I [16:47:50]     scale:    1.000
    I [16:47:50]     position: 0,0
    I [16:47:50]     mode:     2560x1440@60Hz
    I [16:47:50]
    I [16:47:50] eDP-1 Arrived:
    I [16:47:50]   info:
    I [16:47:50]     name:     'eDP-1'
    I [16:47:50]     desc:     'Unknown 0x05EF 0x00000000 (eDP-1)'
    I [16:47:50]     width:    310mm
    I [16:47:50]     height:   170mm
    I [16:47:50]     dpi:      212.45 @ 2560x1440
    I [16:47:50]   current:
    I [16:47:50]     (disabled)
    I [16:47:50]
    I [16:47:50] eDP-1 Changing:
    I [16:47:50]   from:
    I [16:47:50]     (disabled)
    I [16:47:50]   to:
    I [16:47:50]     scale:    2.250
    I [16:47:50]     position: 2560,0
    I [16:47:50]     mode:     2560x1440@60Hz (preferred)
    I [16:47:50]     (enabled)
    I [16:47:50]
    I [16:47:50] Changes successful
    I [16:47:51]
    I [16:47:51] Monitoring lid device: /dev/input/event1
    
    opened by alex-courtis 6
  • Drop Linux header to unbreak on FreeBSD

    Drop Linux header to unbreak on FreeBSD

    Leaving out the following for simplicity (downstream can override/append):

    diff --git a/config.mk b/config.mk
    index 87e1ecd..c6aebe2 100644
    --- a/config.mk
    +++ b/config.mk
    @@ -18,10 +18,9 @@ COMPFLAGS = $(WFLAGS) $(OFLAGS)
     CFLAGS += $(COMPFLAGS) -std=gnu17
     CXXFLAGS += $(COMPFLAGS) -std=gnu++17
     
    -LDFLAGS +=
    +# If we have pkg-config try harder to pass correct flags
    +CFLAGS += `pkg-config --cflags wayland-client 2>/dev/null || echo -isystem$(PREFIX)/include`
    +CXXFLAGS += `pkg-config --cflags yaml-cpp 2>/dev/null`
    +LDFLAGS += `pkg-config --libs epoll-shim libinotify 2>/dev/null` # BSD, ignore on Linux
     
     LDLIBS += -lwayland-client -lyaml-cpp -linput -ludev
    -
    -CC = gcc
    -CXX = g++
    -
    
    opened by jbeich 5
  • Doesn't work with sway 1.8-rc2

    Doesn't work with sway 1.8-rc2

    using the latest way-display with sway 1.8-rc2, wlroots 0.16.0. arch linux. user in added in input group.

    way-display fails to start. logs:

    I [00:24:58] way-displays version 1.6.0 I [00:24:58] I [00:24:58] Found configuration file: /home/okhsunrog/.config/way-displays/cfg.yaml I [00:24:58] I [00:24:58] Active configuration: I [00:24:58] Arrange in a ROW aligned at the TOP I [00:24:58] Order: I [00:24:58] eDP-1 I [00:24:58] monitor description I [00:24:58] HDMI-A-1 I [00:24:58] Auto scale: ON I [00:24:58] Laptop display prefix: eDP I [00:24:58] I [00:24:58] Monitoring lid device: /dev/input/event1 I [00:24:58] I [00:24:58] Lid open interface 'zwlr_output_head_v1' has no event 13 E [00:24:58] E [00:24:58] ERROR: wl_display_read_events failed at src/server.c:166, exiting: 2 No such file or directory E [00:24:58] E [00:24:58] ERROR: Please raise an issue: https://github.com/alex-courtis/way-displays/issues E [00:24:58] ERROR: Attach this log and describe the events that occurred before this failure.

    opened by okhsunrog 4
  • 1.4.0 fails to build on aarch64

    1.4.0 fails to build on aarch64

    1.3.0 built fine, so probably regressed by 8f06db876a51.

    src/log.c:73:15: error: invalid operands to binary expression ('const char *restrict' and 'va_list' (aka '__builtin_va_list'))
            if (__format && __args) {
                ~~~~~~~~ ^  ~~~~~~
    src/log.c:105:48: error: passing 'void *' to parameter of incompatible type 'va_list' (aka '__builtin_va_list')
                    print_line(threshold, "", 0, __stream, NULL, NULL);
                                                                 ^~~~
    /usr/include/sys/_null.h:34:14: note: expanded from macro 'NULL'
    #define NULL    ((void *)0)
                    ^~~~~~~~~~~
    src/log.c:66:143: note: passing argument to parameter '__args' here
    void print_line(enum LogThreshold threshold, const char *prefix, int eno, FILE *__restrict __stream, const char *__restrict __format, va_list __args) {
                                                                                                                                                  ^
    2 errors generated.
    
    $ cc --version
    FreeBSD clang version 11.0.1 ([email protected]:llvm/llvm-project.git llvmorg-11.0.1-0-g43ff75f2c3fe)
    Target: aarch64-unknown-freebsd13.0
    Thread model: posix
    InstalledDir: /nxb-bin/usr/bin
    
    opened by jbeich 4
  • Feature: wdisplays Collaboration

    Feature: wdisplays Collaboration

    https://github.com/artizirk/wdisplays offers a GUI to set wayland output properties:

    • scale
    • position
    • size
    • refresh
    • translation

    way-displays lacks a GUI however persistently supports all the above, with yaml file and CLI interface.

    wdisplays and way-displays could work together via IPC API or be merged.

    opened by alex-courtis 3
  • Feature: Post Update Hooks

    Feature: Post Update Hooks

    Following an update, invoke a user executable.

    API or (scraped) CLI could be used during the executable.

    Alternatively, the config / changes could be rendered as YAML in a file.

    opened by alex-courtis 0
  • Feature: ORDER_LAST

    Feature: ORDER_LAST

    https://www.reddit.com/r/swaywm/comments/ruhc0t/best_way_to_have_monitor_of_unknown_size_above_a/hqzkeng/?utm_source=reddit&utm_medium=web2x&context=3

    Order after all other monitors, allowing to be ordered after unknown.

    enhancement 
    opened by alex-courtis 1
  • Added package to nixpks

    Added package to nixpks

    Hi! as of today way-displays can be installed via nix package manager (Linux distros using nix and NixOS). The package is available from the unstable branch of nixpks. Probably will be merged in the next release as stable.

    I am the current maintainer for that package, I will update it when new versions will be available. But if any of you wants to do it the necessary changes to update the package are realy simple.

    For the future we can think to ad a CI/CD process so that the package can be directly downloaded from GitHub instead of building it on the host platform.

    opened by simoneruffini 9
Releases(1.6.2)
Owner
Alexander Courtis
Alexander Courtis
Lock you keyboard and clean your screen. A simple, and easy way to clean your computers.

Pristine Cleaner A screen and keyboard cleaning application made to turn screen black, and lock keyboard for easy cleaning. With features such as star

Rhino Inani 2 Jan 16, 2022
A 3-D Printed Bot which can talk, cheer, dance and manage your day-to-day schedule.

cheerup A 3-D Printed Bot which can talk, cheer, dance and manage your day-to-day schedule. In childhood many of us have watched this show "SpongeBob

Aniket Dhole 4 Sep 5, 2021
Embedded Flutter runtime targeting Embedded Linux with Wayland

ivi-homescreen IVI Homescreen for Wayland Strongly Typed (C++) Lightweight Clang 11 Release Stripped = 151k GCC 9.3 Release Stripped = 168k Source run

null 170 Dec 13, 2022
A friendly C++ library to create Wayland Compositors.

A friendly C++ library to create Wayland compositors that runs directly on top of DRM.

Eduardo Hopperdietzel 7 Dec 30, 2022
Extremely minimal raw Wayland greeter for greetd.

greetd-mini-wl-greeter An extremely simple raw Wayland greeter for greetd, inspired by lightdm-mini-greeter. Usage Follow the same steps as for e.g. g

Philip Jones 20 Dec 4, 2022
GTK-based lockscreen for Wayland

gtklock GTK-based lockscreen for Wayland. About gtklock is based on gtkgreet. It uses the wlr-layer-shell and wlr-input-inhibitor Wayland protocols an

Jovan Lanik 138 Dec 7, 2022
A way to visualize your multithreaded Mbed OS application like never before!

MbedSysview Library A way to visualize your multithreaded Mbed OS application like never before! MbedSysview is a library that connects the Mbed OS ta

Jamie Smith 5 Nov 5, 2022
ContactGot is an offline desktop app, where clients can leave their info, while an administrator can manage which information they need to gather on certain projects.

ContactGot Contents Description How to use Requirements Engineering Installation Documentation Design Architecture Demonstration 1. Description During

Elizaveta 15 Sep 17, 2022
Two alphanumeric LCDs and 2 LED bars to show and manage some in-flight parameters

FS2020-LCD-Panel with Arduino Two alphanumeric LCDs and 2 LED bars to show and manage some in-flight parameters for FS2020. In this project you can pl

null 7 Dec 12, 2022
Collection of tools to manage Teensy boards

You can find these instructions on the official web page. Overview TyTools is a collection of independent tools and you only need one executable to us

Niels Martignène 181 Dec 31, 2022
Library to manage and implement achievements in a game.

Achieve Library to easily implement achievements in a game. Every achievement is described as a combination of properties (which are counters) guided

Fernando Bevilacqua 33 Aug 7, 2022
Uses queues in C to manage tweets.

Uses queues in C to manage tweets.

Arshia Sandhu 2 Jan 16, 2022
A tiny external monitor for PC using STM32 and ST7789. Connects to PC over USB and displays the captured screen on ST7789 (240x240) display.

STM32 Tiny Monitor A super tiny monitor for your PC, suitable for your pet ant. A python script sends the captured screen over USB to the STM32 microc

Avra Mitra 69 Dec 27, 2022
refterm is a reference renderer for monospace terminal displays.

refterm v2 refterm is a reference renderer for monospace terminal displays. It was designed to demonstrate that even in the worst-case scenario - extr

Casey Muratori 1.3k Jan 1, 2023
Assembly HellGate implementation that directly calls Windows System Calls and displays the PPID of the explorer.exe process

Custom HellsGate Implementation Assembly HellGate implementation that directly calls Windows System Calls and displays the PPID of the explorer.exe pr

Bobby Cooke 90 Oct 18, 2022
F Graphics Library (FGL) is a small graphics C++ portable library for LCD displays on embedded systems

F Graphics Library (FGL) Full documentation: fgl.docsforge.com (By Filipe Chagas) F Graphics Library is a C++ library that I created for use in embedd

Filipe Chagas 9 Oct 31, 2022
This repository uses a ROS node to subscribe to camera (hikvision) and lidar (livox) data. After the node merges the data, it publishes the colored point cloud and displays it in rviz.

fusion-lidar-camera-ROS 一、介绍 本仓库是一个ROS工作空间,其中ws_fusion_camera/src有一个工具包color_pc ws_fusion_camera │ README.md │ └───src │ └───package: c

hongyu wang 23 Dec 7, 2022
Displays Lat & Long on the terminal from a public API.

iss-term Displays Latidude & Longitude on the terminal from a public API, by using lib curl Libraries used libcurl to install Before you do anything,

Brad Bettencourt 1 Nov 16, 2021
An Arduino library to control 2-bit (4 gray level) LCD displays

TwoBitDisplay (2-bpp LCD library) Project started 10/23/2021 Copyright (c) 2021 BitBank Software, Inc. Written by Larry Bank [email protected] The pur

Larry Bank 8 Mar 21, 2022