From 2b5ffad2c3b4b5fe2a330f63d06d56e5cde6d9f2 Mon Sep 17 00:00:00 2001 From: Stefan Ritter Date: Tue, 28 Dec 2010 17:50:35 +0100 Subject: Add automon function for my own purposes --- zsh/zshrc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'zsh') diff --git a/zsh/zshrc b/zsh/zshrc index 7bf939e..2f5b00e 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -114,6 +114,15 @@ md() { cd $1 } +automon() { + vga=$(xrandr -q | while read line; do if [[ $line =~ ^VGA1.*$ ]] { echo $line | cut -d " " -f 2 }; done) + if [[ $vga = "disconnected" ]] { + xrandr --output LVDS1 --auto --output VGA1 --off + } else { + xrandr --output LVDS1 --off --output VGA1 --auto + } +} + case $TERM in rxvt*) -- cgit v1.2.3