msu: Monitor Setup Utility

[ library, mit, program, unclassified ] [ Propose Tags ]

Convenient wrapper over xrandr for setting up monitors


[Skip to Readme]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.0.1, 0.0.2, 0.2.0.0
Change log CHANGELOG.md
Dependencies aeson, aeson-casing, base (>=4.8.0 && <5), bytestring, directory, filepath, msu, parsec, process, unliftio, yaml [details]
License MIT
Author Pat Brisbin <pbrisbin@gmail.com>
Maintainer Pat Brisbin <pbrisbin@gmail.com>
Home page http://github.com/pbrisbin/msu
Uploaded by PatrickBrisbin at 2021-10-14T20:01:02Z
Distributions NixOS:0.2.0.0
Executables msu
Downloads 1681 total (6 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2021-10-14 [all 1 reports]

Readme for msu-0.2.0.0

[back to package description]

Monitor Setup Utility

ARandR is great for setting up monitors in a minimal way. I use it when plugging in at some random location and/or to save scripts to set things to a known configuration.

By contrast, this tool allows me to run a single command, with no options or thought (e.g. from a udev hot-plug rule), and have that tool figure out where I am and what saved-script (or literal command) to execute to configure my monitors.

Plugging into my office dock, like I do every morning? The script notes that I'm on my home wifi and a specific Display is now connected and it does the Right Thing.

Unplugging to only my laptop screen connected? This script sees this and resets to it as the single primary display.

Usage

Create a configuration file that defines how to match a "context" and what command to execute if matched:

~/.monitors.yaml:

- name: none
  match:
    # Only our primary display is connected
    displays:
      connected:
        eq:
          - eDP1

  # Turn everything else off and turn that on
  exec:
    xrandr
      --output eDP1 --primary --mode 2560x1440
      --output DP1 --off
      --output DP2 --off
      --output DP2-1 --off
      --output DP2-2 --off
      --output DP2-3 --off
      --output HDMI1 --off
      --output HDMI2 --off
      --output VIRTUAL1 --off

- name: home-dual
  match:
    # My second display is connected
    displays:
      connected:
        eq:
          - eDP1
          - DP2-2

    # And I'm on one of my home wifi networks
    wifi:
      essid:
        in:
          - pb-and-j
          - pb-and-j-5g

  # Set up those two displays how I like
  exec:
    xrandr
      --output eDP1 --mode 2560x1440 --right-of DP2-2
      --output DP1 --off
      --output DP2 --off
      --output DP2-1 --off
      --output DP2-2 --primary --mode 2560x1440
      --output DP2-3 --off
      --output HDMI1 --off
      --output HDMI2 --off
      --output VIRTUAL1 --off

Then run:

msu

CHANGELOG | LICENSE