You are not logged in.
Hi!
I wanted to know if it is possible to run a specific shellscript if a specific monitor is connected?
Actually there is this function in xfce (in Display-settings) whcih recognises a new display and opens some settings...
But i want to check if it is a specific monitor and call a arandr-script for each monitor...
i hope i expressed my problem in a clear way. ![]()
greetings
Moesi
Offline
What are the differences in the xrandr scripts you want to call? Xrandr itself can detect which connector the newly connected monitor is on, and it can also check the default resolution. Would this be sufficient to identify the monitor? Or in what way do you want the "specific monitor" identified?
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
The difference is: At home the monitor is to the left of the notebook, in my lab it is on the right. For identification... they are from different manufacturers, but same resolution.
Xrandr itself can detect which connector the newly connected monitor is on, and it can also check the default resolution.
Should xrandr recognise/trigger an event when the hdmi is plugged in? Or did i get this wrong?
So maybe for me to start with this whole thing, the question should be updated to: How could i catch an "plugged-in event" with bash/python... or even C/C++ (but then, not too complicated).
thx
Moesi
Offline
The xrandr program will not monitor for events, but it can get all the information about that is currently plugged/unplugged, and then configure the monitors from there. This seems sufficient as you claimed that xfce is already detecting the plug/unplug events - so just run an xrandr sript from there.
The randr extension to xlib can respond to events and do all of the above (this is how xfce detects the plug/unplug events). I don't know anything about the python API, but the C one is good if you know C. There isn't one for bash.
If I were you I'd just write a script that queried the current state and configured everything properly - then have this script triggered by the xfce event.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Ok thank your for the informations!
But thats a little to complicated for me, so i am goign to do it manually with shortcuts.
greetings
Moesi
Offline
You could look into randrctl and autorandr -- two of the results for an AUR search of "randr" that might be useful to you.
Offline