this post was submitted on 04 Sep 2021
3 points (100.0% liked)
Linux
56031 readers
1041 users here now
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 6 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
there's a file called
status
incat /sys/class/drm/card0-CONNECTION
whereCONNECTION
is the namexrandr --listmonitors
shows on the right. So e.g. for me it looks like this:You can watch this file with
inotifywatch -e modify
. You can put this in a systemd.path unit which calls your script as a one-shot or with an environment parameter.You can also use srandrd but IMHO that's a bit overkill when you can do it with pid0 tools 😅
Hmm. Maybe I'm doing something wrong but doing
only gives me "No events occurred." (after ctrl-c stops it). Oddly, I can see the file contents change (connected to disconnected and back again) if I cat it in a separate term window so I don't know what's going on.
hm, maybe you need another event type. What GPU is it?
May be
create
ordelete