Commit: 113b6fc5029035f86aacdc5c791b82ebeb8c0b4a
Parent: 036e6cb27a4828c0ab68c6cc1c87c10450913595
Author: Randy Palamar
Date: Fri, 28 Jun 2024 21:05:19 -0600
displaycon: properly disable disconnected screens with display_one
Also set background at the end like old version.
Diffstat:
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/bin/displaycon b/bin/displaycon
@@ -7,7 +7,7 @@ nl='
oldifs=$ifs
ifs=$nl
-all_scrs=`{xrandr | grep '\sconnected'}
+connected=`{xrandr | grep '\sconnected'}
ifs=$oldifs
fn display_location_orientation {
@@ -16,7 +16,11 @@ fn display_location_orientation {
}
fn display_one {
- extra_args=`{printf '%s' $all_scrs ^ $nl | grep -v $1 | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -}
+ ifs=$nl
+ # NOTE: covers disconnected too
+ all_screens=`{xrandr | grep 'connected'}
+ ifs=$oldifs
+ extra_args=`{printf '%s' $all_screens ^ $nl | grep -v $1 | awk '{print "--output", $1, "--off"}'}
xrandr --output $1 --primary --auto --scale 1.0x1.0 $extra_args
}
@@ -27,10 +31,10 @@ dmenu_args=( \
'ONE: Primary Display Only' \
)
-switch ($#all_scrs) {
+switch ($#connected) {
case 1
ifs=' '
- connected_display=`{printf '%s' $all_scrs ^ $nl}
+ connected_display=`{printf '%s' $connected ^ $nl}
display_one $connected_display(1)
case *
ifs=':'
@@ -47,3 +51,5 @@ case *
display_one $disp(1)
}
}
+
+bgs -z $home/.config/h_wallpaper.jpg