You are not logged in.

#1 2014-09-07 13:40:47

eDio
Member
From: Ukraine, Kyiv
Registered: 2008-12-02
Posts: 422

randrctl - profile based screen manager for X

Hi all.

Here is my humble contribution.
I developed an utility which may be useful for those who tired of using bare xrandr and who ends up eventually in creating scripts home.sh office.sh default.sh to re-apply screen settings.

My utility solves this by storing screen settigns in json and providing simple interface to apply stored settings.

Here how it works:

Under /etc/randrctl/profiles you create profile that you use at home, say, /etc/randrctl/profiles/home

{
    "outputs": {
        "LVDS1": {
            "width": 1366,
            "height": 768,
            "top": 0,
            "left": 0
        },
        "DP1": {
            "width": 1920,
            "height": 1080,
            "left": 1366
        }
    },
    "primary": "DP1"
}

You can then activate this profile by simply running

$ randrctl switch-to home

Profiles can be generated automatically from your current screen setup (root is required as profiles are stored under /etc/randrctl/profiles/*)

# randrctl dump office

randrctl -h will give you basic usage information.

Utility is not nearly complete. The main idea (I already have prototype for this) is to associate EDIDs of connected displays with profiles and choose appropriate profiles automatically when new displays are connected/disconnected.

Code and all usage info is on github
https://github.com/edio/randrctl

I've created AUR package for archers
https://aur.archlinux.org/packages/randrctl-git/

Would be glad to get any feedback on idea and implementation.
Cheers!

Offline

#2 2014-09-08 09:32:02

eDio
Member
From: Ukraine, Kyiv
Registered: 2008-12-02
Posts: 422

Re: randrctl - profile based screen manager for X

Added simple code completions for zsh and bash (just edited those ones for netctl).

Offline

#3 2014-09-08 22:48:54

ids1024
Member
From: California
Registered: 2013-08-16
Posts: 243
Website

Re: randrctl - profile based screen manager for X

Are you familiar with autorandr?  It seems to serve a similar purpose.


"Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it."—Linus Torvalds
s/ftp/git/

https://iandouglasscott.com | https://github.org/ids1024 | https://keybase.io/ids1024

Offline

#4 2014-09-09 07:49:37

eDio
Member
From: Ukraine, Kyiv
Registered: 2008-12-02
Posts: 422

Re: randrctl - profile based screen manager for X

Thanks for pointing. Never heard of that project before.

I suspected there should be similar tools already...

Just checked the code: yes, it is exactly the tool I was looking for. Only after/before hooks are missing to workaround i3 crash when applying saved profile.

Offline

#5 2014-09-09 07:53:10

eDio
Member
From: Ukraine, Kyiv
Registered: 2008-12-02
Posts: 422

Re: randrctl - profile based screen manager for X

Oh, there is even a postswitch script. Nice. Perhaps I have to consider contributing support for "priorswitch"

Offline

#6 2014-09-10 18:17:56

sekret
Member
Registered: 2013-07-22
Posts: 291

Re: randrctl - profile based screen manager for X

Still, nice work!

Offline

#7 2014-09-17 08:45:28

eDio
Member
From: Ukraine, Kyiv
Registered: 2008-12-02
Posts: 422

Re: randrctl - profile based screen manager for X

Although there is this autorandr project, which is better in some ways (its simplicity is a huge Pro comparing to randrctl), I decided to keep up development.
Perhaps, I'll borrow some ideas from autorandr (I like that it works in without sudo and how its support for posthook is done).
Anyway, open source is about choice, and I have fun doing all this.

Regarding randrctl itself: I've just added support for rotation and panning. This, by the way, impacted profile format, which became simpler I believe.

Offline

#8 2014-09-17 09:10:02

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: randrctl - profile based screen manager for X

One comment about the name: Everytime I read *ctl, I assume it is somehow related to systemd. That said, I salute your decision to continue development, maybe you can exchange ideas with autorandr at some point.

Do you plan to add support for user profiles not stored in /etc?

Offline

#9 2014-09-17 09:42:47

eDio
Member
From: Ukraine, Kyiv
Registered: 2008-12-02
Posts: 422

Re: randrctl - profile based screen manager for X

Awebb,
*ctl should suggest that experience is similar to Archlinux's netctl. This also led to a decision to store all configuration under /etc/randrctl to be consistent with netctl approach.
But, yes, I understand that this is not very convenient, so I'm going to implement support for profiles stored under user's home directory.

Offline

#10 2014-09-17 10:40:58

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: randrctl - profile based screen manager for X

Yeah, that's exactly why I thought it's a systemd tool. It used to be netcfg but morphed into netctl to integrate and mimic systemd. No big deal, though.

Offline

#11 2014-09-17 15:22:51

eDio
Member
From: Ukraine, Kyiv
Registered: 2008-12-02
Posts: 422

Re: randrctl - profile based screen manager for X

Implemented per-user configuration.
Now application uses both ~/.config/randrctl/ and /etc/randrctl.
The first location is preferred. If no such folder exists, app will give a warning, saying, that it prefers to use ~/.config/randrctl.
If /etc/randrctl is also absent, app will create ~/.config/randrctl.

During conflicts resolution (conflicting options in config.ini, same profile names) data from ~/.config/randrctl prevails.

It is possible to force randrctl to use only /etc/randrct/ as before with --system key (may be needed to dump system-wide profile).

Known issues: shell completion functions are not fully updated, readme not updated.

Offline

#12 2014-09-23 00:13:51

eDio
Member
From: Ukraine, Kyiv
Registered: 2008-12-02
Posts: 422

Re: randrctl - profile based screen manager for X

Implemented support for automatic profiles switching.
Fully automatic switching is possible with udev (afaik, only opensource drivers allow this).
Also it is now possible to run

randrctl auto

to automatically activate the most matching profile.

What randrctl has now above autorandr is an ability to match profiles by supported modes. For example, you can create profile, that will be activated for any display on your HDMI port that supports 1920x1080 mode.

{
    "primary": "DP1",
    "outputs": {
        "LVDS1": {
            "pos": "0x312",
            "mode": "1366x768"
        },
        "HDMI1": {
            "pos": "1366x0",
            "mode": "1920x1080"
        }
    },
    "match": {
        "LVDS1": {},
        "DP1": {
            "mode": "1920x1080"
        }
    }
}

Offline

#13 2014-09-25 13:32:46

CjK
Member
Registered: 2008-10-17
Posts: 23

Re: randrctl - profile based screen manager for X

Very nice tool - thanks for sharing it!

I have to try this out ASAP, as in the past my WM (bspwm) was sometimes crashing between xrandr-calls. Not sure if it's really bspwm's fault, but I've been looking for a tool to both provide pre-/post-switching hooks and the "auto-detect"-functionality at the same time.

thanks again,
CjK

Offline

#14 2014-09-25 15:08:59

eDio
Member
From: Ukraine, Kyiv
Registered: 2008-12-02
Posts: 422

Re: randrctl - profile based screen manager for X

Thanks for showing interest in this tool! I've been desperate already, that no one uses it (except for me of course wink ).
Let me know if you have any issues with it.

Offline

#15 2014-09-26 16:57:11

eDio
Member
From: Ukraine, Kyiv
Registered: 2008-12-02
Posts: 422

Re: randrctl - profile based screen manager for X

Noticed, I forgot to update aur package with new PKGBUILD. So package missed completions and udev rules. Fixed now.

Offline

#16 2014-11-04 11:15:41

eDio
Member
From: Ukraine, Kyiv
Registered: 2008-12-02
Posts: 422

Re: randrctl - profile based screen manager for X

Updated setup.py to include randrctl-auto. Before this autoswitching had been broken.

Offline

Board footer

Powered by FluxBB