`xrandr` for Gnome/wayland, on distros that don't support `wlr-randr`

Overview

gnome-randr-rust

A reimplementation of xrandr for Gnome on Wayland, especially for systems that don't support wlr-output-management-unstable-v1 (e.g. Manjaro). Written ground-up in rust for performance. This is also my first project in rust, so any suggestions are welcome!

Method

gnome-randr-rust uses the dbus object org.gnome.Mutter.DisplayConfig. See https://wiki.gnome.org/Initiatives/Wayland/Gaps/DisplayConfig for the original proposal, although the specification listed there is somewhat out of date (checked via dbus introspect on Gnome shell 40.5). A better (commented) XML file is listed in the gnome-monitor-config project here.

The GetCurrentState method is used to list information about the displays, while ApplyMonitorsConfig is used to modify the current configuration.

Inspiration

This project was heavily inspired by xrandr (obviously) and also gnome-randr. Sadly, gnome-randr.py appears to be broken as of my gnome version (40.5) when trying to modify display configurations.

gnome-randr.py is also slower than my rust reimplementation: querying the python script takes about 30ms on my 3-monitor system, while the rust implementation takes about 3ms (xrandr takes about 1.5ms, but is also displaying different information due to limitations in xrandr's bridge.)

Comments
  • No List of Commands

    No List of Commands

    --help yields:

    gnome-randr 0.1.1
    A program to query information about and manipulate displays on Gnome with Wayland.
    
    Default command is `query`.
    
    USAGE:
        gnome-randr [SUBCOMMAND]
    
    FLAGS:
        -h, --help       
                Prints help information
    
        -V, --version    
                Prints version information
    
    
    SUBCOMMANDS:
        help      Prints this message or the help of the given subcommand(s)
        modify    Modify allows you to alter the current display configuration.
        query     Query returns information about the current state of the monitors. This is the default subcommand.
    

    Where are the rest of the commands? The traditional xrandr commands don't seem to be working either.

    opened by InklingGirl 4
  • Fractional scaling

    Fractional scaling

    I need to set 1.5x scale for one of my monitors - I used to do it with GNOME display settings but with update to GNOME 42, that seems no longer possible (the UI doesn't offer it despite 'scale-monitor-framebuffer' being set).

    Your tool looked great, but sadly did not allow me to make the change:

    gnome-randr modify --scale 1.5 HDMI-1
    setting scale to 1.5
    D-Bus error: Scale 1.5 not valid for resolution 3840x2160 (org.freedesktop.DBus.Error.InvalidArgs)
    Scale 1.5 not valid for resolution 3840x2160
    

    Can I do anything about this?

    opened by arakan94 1
  • [Feature Request]: Mirroring config

    [Feature Request]: Mirroring config

    Hi :wave: nice tool you've made, thanks for your work!

    Would be great to be able to configure display mirroring, as GNOME itself currently only allows either extended or mirror all.

    Example: I have three displays attached and want to mirror 2 as my "primary", leaving the 3rd as an extended.

    enhancement investigating 
    opened by Merrit 11
  • Add XY movement & refactor monitor types

    Add XY movement & refactor monitor types

    Main Change

    Created an Action to handle changing monitor position in X and Y. Tied this action into the CLI. Tested functionality - tests pass.

    Secondary Changes

    This change also led me to refactor most of display_config. physical_monitor and virtual_monitor now share distinct types for:

    • Transformation
      • Displacement
        • Handles X, Y, and Scale
        • Handles parsing CLI instructions
      • Orientation
        • Handles u32 encoding Rotation and Flipping
        • Handles parsing CLI instructions
    • Connector/Vendor/Product/Serial (now MonitorDescription)

    There are no longer two 'rotation' types ("Actions::Rotation" and "LogicalMonitor::Transform") - Actions::Rotation has been superseded, extending the CLI's rotation capabilities to include flipping, without breaking previous behavior.

    I'm relatively new to Open Source / GitHub tradition, and I'm very very new to Rust. If there's something I can do to help in any way, or if I've made a mistake in some way, please let me know.

    enhancement cleanliness 
    opened by FractalMachinist 0
  • Feature request: set brightness

    Feature request: set brightness

    Hello, @maxwellainatchi. Thank you very much for this amazing tool! It works like a charm in my new Wayland env.

    I'd like to know if is possible to implement brightness control and if you think that could be a good idea.

    Motivation

    My PC is quite old with a very obsolete AMD GPU:

    $ lspci
    ...
    01:00.0 Display controller: Advanced Micro Devices, Inc. [AMD/ATI] Opal XT [Radeon R7 M265/M365X/M465]
    

    And I can't change brightness through system settings and neither by set /sys/class/backlight/acpi-video0/brightness.

    Because of this I've been using Brightness Controller for a quite few years and it works very well in Xorg envs. I saw that they use xrandr to set brightness. So maybe your tool could help on this as well for Wayland envs.

    I'm not saying that you should implement something to work in conjunction with Brightness Controller, it's just that your tool could control brightness as xrandr does.

    Suggestion

    # based on gnome-randr usage
    USAGE:
        gnome-randr modify [FLAGS] [OPTIONS] <connector>
    
    # suggestion
    $ gnome-randr modify --brightness 0.75 HDMI-1
    

    As you already know, in xrandr we have:

    xrandr --output HDMI-1 --brightness 0.75
    

    My setup

    | Info | Value | |-|-| | Distro | Manjaro 21.2 | | Display server | Wayland | | Gnome | 41.3 | | gnome-randr | 0.1.1 |

    Query output

    $ gnome-randr query
    supports-mirroring: true
    layout-mode: physical
    supports-changing-layout-mode: false
    global-scale-required: false
    legacy-ui-scaling-factor: 1
    
    logical monitor 0:
    x: 0, y: 0, scale: 1, rotation: normal, primary: yes
    associated physical monitors:
    	HDMI-1 DEL Inspiron 5348 0x002206f2
    
    HDMI-1 DEL Inspiron 5348 0x002206f2
                      1920x1080@60	1920x1080 	60.00*+   	[x1.00+, x2.00]
      [email protected]	1920x1080 	59.94     	[x1.00+, x2.00]
                      1920x1080@50	1920x1080 	50.00     	[x1.00+, x2.00]
      [email protected]	1680x1050 	59.88     	[x1.00+, x2.00]
       [email protected]	1440x900  	59.90     	[x1.00+]
       [email protected]	1360x768  	60.02     	[x1.00+]
      [email protected]	1280x1024 	60.02     	[x1.00+]
                       1280x720@60	1280x720  	60.00     	[x1.00+]
       [email protected]	1280x720  	59.94     	[x1.00+]
                       1280x720@50	1280x720  	50.00     	[x1.00+]
       [email protected]	1024x768  	60.00     	[x1.00+]
        [email protected]	800x600   	60.32     	[x1.00+]
                        720x576@50	720x576   	50.00     	[x1.00+]
    is-builtin: false
    display-name: "Dell Inc. 23\""
    

    Thanks in advance.

    enhancement 
    opened by danilobjr 6
Releases(v0.1.1)
Owner
Max Ainatchi
Programmer, but you knew that
Max Ainatchi
Minimal, flexible & user-friendly X and Wayland tiling window manager with rust

SSWM Minimal, flexible & user-friendly X and Wayland tiling window manager but with rust. Feel free to open issues and make pull requests. [Overview]

Linus Walker 19 Aug 28, 2023
Error context library with support for type-erased sources and backtraces, targeting full support of all features on stable Rust

Error context library with support for type-erased sources and backtraces, targeting full support of all features on stable Rust, and with an eye towards serializing runtime errors using serde.

Findora Foundation 1 Feb 12, 2022
Utilities to gather data out of roms. Written in Rust. It (should) support all types.

snesutilities Utilities to gather data out of roms. Written in Rust. It (should) support all types. How Have a look at main.rs: use snesutilities::Sne

Layle | Luca 5 Oct 12, 2022
OpenAPI support for Poem

Poem OpenAPI Fast and Type-Safe OpenAPI implementation for Poem. Poem-openapi allows you to easily implement APIs that comply with the OpenAPIv3 speci

Poem Web 40 Sep 16, 2021
A rewrite of Phonelink for Windows Forms written in Rust, with cross-platform support.

phonelink-rs A rewrite of Phonelink for Windows Forms written in Rust, with cross-platform support. Usage Clone the repository and build, or download

ahsan-a 4 Aug 6, 2022
Use enum to filter something, support | and & operator.

Filter Use enum to filter something, support | and & operator. Just need to implement Filter Trait with filter-macros crate. How to work Example #[add

上铺小哥 9 Feb 8, 2022
Board Support Crate for Arduino Leonardo in Rust

Deprecation Note: This crate will soon be deprecated in favor of avr-hal. avr-hal is a new approach to writing the HAL crate, that was designed with s

Rahix 5 May 6, 2021
How to bootstrap support for a no_std target

The Embedonomicon How to bootstrap support for a no_std target This book is hosted at https://docs.rust-embedded.org/embedonomicon/ This project is de

Rust Embedded 191 Dec 20, 2022
Universal changelog generator using conventional commit+ with monorepo support. Written in Rust.

chlog Universal changelog generator using conventional commit+ with monorepo support. chlog can generate the changelog from the conventional commits w

Jeff Yang 3 Nov 27, 2022
🦀 Rust support library for semaphore

?? semaphore-rs Rust support library for using semaphore. It's mostly a Rust rewrite of zk-kit, but just focuses on semaphore (for now) and still cove

Worldcoin 31 Dec 21, 2022
Rust no_std, embedded_hal board support package for the Electro-Smith Daisy platform.

Daisy Rust no_std, embedded_hal board support package for the Electro-Smith Daisy platform. This project was forked from antoinevg/daisy_bsp. Supporte

zlosynth 5 Dec 4, 2022
Rust usb-device support for ATmega chips

atmega-usbd usb_device support for ATmega microcontrollers. NOTE: This is an experimental library, and certainly not production-ready. Expect bugs, an

Adam Gausmann 20 Jan 8, 2023
⚙️ A cute .gitignore generator with support for custom templates

Gign A Gitignore Generator Table of Contents Examples Install Custom templates Help Examples # This is how you going to use it probably most of the ti

Vadim 6 Dec 7, 2022
Lapce vue plugin, support vue (SFC) syntax highlight, autocomplate,types check

Lapce Plugin for Vue (based volar) Preview Usage Required: Lapce version must be greater than 2.0, and you can use Lapce nightly version. click here t

xiaoxin 32 Dec 26, 2022
Mommy's here to support you when running cargo~

cargo-mommy Mommy's here to support you when running cargo~ ❤️ Installation Install cargo-mommy like you would any other cargo extension~ > cargo inst

Aria Beingessner 198 Jan 5, 2023
serde support for http crate types Request, Response, Uri, StatusCode, HeaderMap

serde extensions for the http crate types Allows serializing and deserializing the following types from http: Response Request HeaderMap StatusCode Ur

Andrew Toth 3 Nov 1, 2023
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
An application for creating encrypted vaults for the GNOME desktop.

Vaults An application for creating encrypted vaults for the GNOME desktop. It currently uses gocryptfs and CryFS for encryption. Please always keep a

Martin Pobaschnig 51 Dec 17, 2022
Provides Rust bindings for Gnome libraries

gtk-rs-core The gtk-rs organization aims to provide safe Rust binding over GObject-based libraries. You can find more about it on https://gtk-rs.org.

null 174 Dec 26, 2022
Gtk/Rust native Spotify client for the GNOME desktop.

Gtk/Rust native Spotify client for the GNOME desktop.

Alexandre Trendel 1.7k Jan 1, 2023