monitor-monitor v1.3.0
= monitor-monitor
This program monitors my monitors (plugged/unplugged) and applies the desired configuration.
== Install
source, bash
npm install -g monitor-monitor
== Usage
Use it like this:
source, bash
monitor-monitor monitor-setups.json
monitor-setups.json
is a JSON file containing something like this:
source, json
{ "LG/1178/unknown": { "name": "laptop-only", "xrandrCommand": "xrandr --output eDP1 --primary --mode 2560x1440 --pos 0x0 --rotate normal" }, "LG/1178/unknown,Iiyama/26140/PLX2783H-DP": { "name": "home", "xrandrCommand": "xrandr --output eDP1 --primary --mode 2560x1440 --pos 0x1512 --rotate normal --output HDMI2 --mode 1920x1080 --scale 1.4x1.4 --panning 2688x1512" }
}
The keys are combinations of screens identifiers (vendor, productCode & modelName from EDID) separated by comas.
For each monitor setup, you need to specify a name
and a command to execute (an xrandr command preferably).
== Set up systemd service
If you want this to run in the background, you could set up a user systemd service.
Write this in /etc/systemd/system/monitor-monitor.service
:
source, config
Unit Description=Monitor monitor Wants=dbus.service After=dbus.service
Service ExecStart=/path/to/node /path/to/monitor-monitor /path/to/monitor-setups.json Restart=always RestartSec=10 StandardOutput=syslog StandardError=syslog SyslogIdentifier=monitor-monitor Environment=DISPLAY=:0.0 WorkingDirectory=/path/to/home
WantedBy=default.target
And the run the following commands:
source, base
systemctl --user enable monitor-monitor.service sudo systemctl daemon-reload
systemctl --user start monitor-monitor
Sources: