dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 90588ab1e729abba09f9948c0f91188ba6935322
parent 2c1c1e98c6c7c3d484a8bc95190be969646e1ccc
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Wed, 17 Jul 2019 11:48:07 +0200

Simplify and fix xrandr script

Diffstat:
A.local/bin/xrandr-auto | 12++++++++++++
M.local/bin/xrandr-auto.sh | 53-----------------------------------------------------
2 files changed, 12 insertions(+), 53 deletions(-)

diff --git a/.local/bin/xrandr-auto b/.local/bin/xrandr-auto @@ -0,0 +1,12 @@ +#!/bin/sh + +internal_screen=LVDS1 +external_screen=DP3 + +if (xrandr | grep "^$external_screen connected" >/dev/null); then + notify-send "${0##/*} Activating external monitor $external_screen" + xrandr --output $external_screen --auto --output $internal_screen --off +else + notify-send "${0##/*} Activating internal monitor $internal_screen" + xrandr --output $external_screen --off --output $internal_screen --auto +fi diff --git a/.local/bin/xrandr-auto.sh b/.local/bin/xrandr-auto.sh @@ -1,53 +0,0 @@ -#!/bin/bash - -#notify-send "Running xrand-auto.sh" - -LAPTOPSCR=LVDS1 -EXTSCR=DP1 -#PROJECTOR= - -# default monitor is LVDS1 -MONITOR=$LAPTOPSCR - -# functions to switch from LVDS1 to VGA and vice versa -function ActivateEXT { - #echo "Switching to EXTSCR" - #xrandr --output $EXTSCR --auto --output $LAPTOPSCR --off - xrandr --output $EXTSCR --auto --output $LAPTOPSCR --auto - ~/bin/wallpaper.sh - MONITOR=$EXTSCR - #notify-send "Activating $EXTSCR" -} -function DeactivateEXT { - #echo "Switching to $LAPTOPSCR" - xrandr --output $EXTSCR --off --output $LAPTOPSCR --auto - #xrandr --auto --scale 1.0x1.0 - ~/bin/wallpaper.sh - MONITOR=$LAPTOPSCR - #notify-send "Activating $LAPTOPSCR" -} - -# functions to check if EXT is connected and in use -function EXTActive { - [ $MONITOR = "$EXTSCR" ] -} -function EXTConnected { - ! xrandr | grep "^$EXTSCR" | grep disconnected -} - -#while true -#do -if ! EXTActive && EXTConnected -then - notify-send "${0##/*}" "Activating external monitor $EXTSCR" - ActivateEXT -fi - -if EXTActive && ! EXTConnected -then - notify-send "${0##/*}" "Deactivating external monitor $EXTSCR" - DeactivateEXT -fi - -#sleep 5s -#done