2
1
When watching a movie on a laptop, it should cleverly disable its screen:
- If no external screen is plugged, don't disable.
- If a modifier key is used to open the movie, don't disable.
- If an external screen is plugged and no modifier is used, disable the laptop screen.
- When the media player exits, restore the laptop screen.
I've written the following script:
#!/bin/bash
if [ "$(cat /sys/class/drm/card0-VGA-1/status)" = connected ]
then
xrandr --output eDP1 --off
vlc "$1"
while [ "$(pidof vlc)" > 0 ]
do
sleep 1
done
xrandr --output eDP1 --auto --below VGA1
else
vlc "$1"
fi
eDP1 represents the laptop screen, VGA1 the external screen. The script is used by associating movie files in ~/.local/share/applications/mimeapps.list
with the following desktop file:
[Desktop Entry]
Name=VLC
Comment=
Exec=path/to/the/above/script
Icon=vlc
Terminal=false
Type=Application
StartupNotify=true
Can you suggest a way to modify the script or the desktop file, or any other way to check for a modifier key - the only restriction being that a single action must be used to open the movie.
I'll look at it later today, but I wanted to thank you in the meantime. – pouzzler – 2012-09-26T08:21:46.577