You are not logged in.

#1 2014-10-25 23:52:54

Jonhoo
Member
Registered: 2009-05-23
Posts: 118

Automatically running script on monitor changes

I have a script that I use to set up the resolution, orientation and layout of all connected screens. It does different things depending on whether the screen is HDMI or DP, adjusts default sound devices for ALSA, and a bunch of other things. The problem is that I need to run this script manually whenever I connect or disconnect an external monitor, which is inconvenient. So, the question is, is there any tool I can use to register a script to be run whenever the set of connected monitors changes? I had a look at acpid, but it seems it does not support monitor events?

Offline

#2 2014-10-26 00:27:23

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Automatically running script on monitor changes

A udev rule + SYSTEMD_WANTS + a service file for your script...

See `man systemd.device` for the details.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB