Use full if for more involved logic

This commit is contained in:
ItsDrike 2022-08-13 13:45:46 +02:00
parent 7e111fd566
commit 977eb985fc
No known key found for this signature in database
GPG key ID: B014E761034AF742

View file

@ -68,9 +68,10 @@ allposs=$(xrandr -q | grep "connected")
screens=$(echo "$allposs" | awk '/ connected/ {print $1}') screens=$(echo "$allposs" | awk '/ connected/ {print $1}')
# If there's only one screen # If there's only one screen
[ "$(echo "$screens" | wc -l)" -lt 2 ] && if [ "$(echo "$screens" | wc -l)" -lt 2 ]; then
{ onescreen "$screens"; postrun; notify-send "💻 Only one screen detected." "Using it in its optimal settings..."; exit ;} onescreen "$screens"
notify-send "💻 Only one screen detected." "Using it in its optimal settings..."
else
# Get user choice including multi-monitor and manual selection: # Get user choice including multi-monitor and manual selection:
chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") && chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") &&
case "$chosen" in case "$chosen" in
@ -78,5 +79,7 @@ case "$chosen" in
"multi-monitor") multimon ;; "multi-monitor") multimon ;;
*) onescreen "$chosen" ;; *) onescreen "$chosen" ;;
esac esac
fi
postrun postrun