From a9dfb3defb57d36e750c3cc1b2676574c84c0d42 Mon Sep 17 00:00:00 2001 From: Matthew Forrester Date: Mon, 8 Feb 2021 06:42:00 +0000 Subject: [PATCH] connected but off screens cause breakage I often have my laptop connected to my main large screen, however I usually prefer the laptop screen to be off. If this is the case the window ends up super tiny (probably 0x0). I have added a tiny bit of `grep` to stop the connected-but-off screens appearing. --- window_grid | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/window_grid b/window_grid index e300169..fdbff01 100755 --- a/window_grid +++ b/window_grid @@ -131,7 +131,7 @@ declare -a SCREEN_DIMENSIONS function get_screen_dimensions() { i=0 - LINES=$(xrandr |grep ' connected' |cut -d\( -f 1 |awk '{print $NF}') + LINES=$(xrandr |grep ' connected' | grep '[0-9]x[0-9]' |cut -d\( -f 1 |awk '{print $NF}') while IFS= read -r line; do IFS=: read width height startx starty <<< "${line//[+x]/:}" endx=$(( $width + $startx ))