I have a bash, (below, which mirrors the display to my Tv. The duplicate version I have in /home/memyself/HouseKeeping/ works without any problems from a panel quick launch icon.
Code:
#!/bin/bash
# see http://ift.tt/2aW2Zcu
# also http://ift.tt/2bta1BW
# For refence, an inactive copy of this script is kept in /home/memyself/HouseKeeping/, but this is the one that does the work.
# This script is activated by Udev rule kept in /etc/udev/rules.d/70-MirrorToTv.rules
# Note Udev naming convention for rules is important!
# see http://ift.tt/2aW2IpX
# see http://ift.tt/2bt9EaD
# see http://ift.tt/qFdpS3
# debug
/bin/echo "$(date) Executing udev monitor clone....." >> /home/memyself/Desktop/MirrorDebug.txt
# Check default screen is eDP1
if xrandr --query | grep "eDP1"; then
# check HDMI is connected as "HDMI1" or "HDMI-1"
if xrandr --query | grep "HDMI1"; then
xrandr --output eDP1 --auto --primary --output HDMI1 --auto --same-as eDP1
else if xrandr --query | grep "HDMI-1"; then
xrandr --output eDP1 --auto --primary --output HDMI-1 --auto --same-as eDP1
else
xrandr --query
echo -n "Neither HDMI1 nor HDMI-1 is present, hit return to exit"
read YesNo
fi
fi
else
xrandr --query
echo -n "Main display is not eDP1, hit return to exit"
read YesNo
fi
I would like to have a udev rule that launches the bash automatically when the Tv is switched on and have tried various variations of the following without any success:
Code:
# Calls /usr/bin/MirrorToTv.sh when HDMI tv is connected # see http://ift.tt/2aW2IpX # see http://ift.tt/2bt9EaD # see http://ift.tt/qFdpS3 # Note Udev naming convention for rules is important! KERNEL=="card0", SUBSYSTEM=="drm", ACTION=="change", RUN+="su memyself -c /usr/bin/MirrorToTv.sh"
Code:
/usr/bin/MirrorToTV.sh
Code:
/etc/udev/rules.d/70-MirrorToTv.rules
Any advice is very welcome.
Irvine
Udev rules anyone?
Aucun commentaire:
Enregistrer un commentaire