Note that there are some explanatory texts on larger screens.

plurals
  1. POadd udev rule for external display
    primarykey
    data
    text
    <p>I wrote a small shell script configuring attached external displays with xrandr.</p> <pre><code># cat /home/didi/bin/monitor_autoswitcher.sh #!/bin/bash xrandr | grep "HDMI1 connected" if [[ $? == 0 ]]; then # is connected xrandr --output HDMI1 --right-of LVDS1 --auto else # not connected xrandr --output HDMI1 --auto fi xrandr | grep "VGA1 connected" if [[ $? == 0 ]]; then # is connected xrandr --output VGA1 --right-of LVDS1 --auto else # not connected xrandr --output VGA1 --auto fi </code></pre> <p>That works. Now I want to have it triggered automatically and found out that this can be done with udev. I tried</p> <pre><code>udevadm monitor </code></pre> <p>which, when plugging in an external displays outputs</p> <pre><code>KERNEL[465828.240250] change /devices/pci0000:00/0000:00:02.0/drm/card0 (drm) UDEV [465828.243549] change /devices/pci0000:00/0000:00:02.0/drm/card0 (drm) </code></pre> <p>and when plugging it out</p> <pre><code>KERNEL[465836.844209] change /devices/pci0000:00/0000:00:02.0/drm/card0 (drm) UDEV [465836.847445] change /devices/pci0000:00/0000:00:02.0/drm/card0 (drm) </code></pre> <p>Also good.</p> <p>Then I added an udev rule:</p> <pre><code># cat 40-external-display.rules SUBSYSTEM=="drm", ACTION=="change", RUN+="/home/didi/bin/monitor_autoswitcher.sh" </code></pre> <p>and restarted udev</p> <pre><code>service udev restart </code></pre> <p>Unfortunately, still nothing happens when plugging in/out the display. The script <code>monitor_autoswitcher.sh</code> definitely works, because invoking it manually after plugging does what it should.</p> <p>What's missing?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload