modified sway-screen-menu to use variables unlikely to clash

This commit is contained in:
rileyrg 2021-05-23 19:00:39 +02:00
parent ee6a13375d
commit 264b385f1c
3 changed files with 18 additions and 18 deletions

View file

@ -1627,12 +1627,12 @@ swaymsg "output ${m} ${1:-enable}"
```bash
#!/usr/bin/bash
# Maintained in linux-config.org
SCREEN=$(swaymsg -t get_outputs | jq -r '.[] | "\(.name)\n\(.active)"' | zenity --title "Select Display" --list --text "" --column "Monitor" --column "Enabled")
if [ ! -z "$SCREEN" ]; then
ENABLED="$(zenity --list --title "Enable ${SCREEN}?" --text "" --radiolist --column "Pick" --column "Enabled" TRUE enable FALSE disable)"
if [ ! -z "$ENABLED" ]; then
swaymsg "output $SCREEN $ENABLED"
command -v notify-send &> /dev/null && (sleep 0.5 && notify-send -t 3000 "$SCREEN:$ENABLED") &
s=$(swaymsg -t get_outputs | jq -r '.[] | "\(.name)\n\(.active)"' | zenity --title "Select Display" --list --text "" --column "Monitor" --column "Enabled")
if [ ! -z "$s" ]; then
e="$(zenity --list --title "Enable ${SCREEN}?" --text "" --radiolist --column "Pick" --column "Enabled" TRUE enable FALSE disable)"
if [ ! -z "$e" ]; then
swaymsg "output $s $e"
command -v notify-send &> /dev/null && (sleep 0.5 && notify-send -t 3000 "$s:$e") &
fi
fi
```

View file

@ -1,10 +1,10 @@
#!/usr/bin/bash
# Maintained in linux-config.org
SCREEN=$(swaymsg -t get_outputs | jq -r '.[] | "\(.name)\n\(.active)"' | zenity --title "Select Display" --list --text "" --column "Monitor" --column "Enabled")
if [ ! -z "$SCREEN" ]; then
ENABLED="$(zenity --list --title "Enable ${SCREEN}?" --text "" --radiolist --column "Pick" --column "Enabled" TRUE enable FALSE disable)"
if [ ! -z "$ENABLED" ]; then
swaymsg "output $SCREEN $ENABLED"
command -v notify-send &> /dev/null && (sleep 0.5 && notify-send -t 3000 "$SCREEN:$ENABLED") &
s=$(swaymsg -t get_outputs | jq -r '.[] | "\(.name)\n\(.active)"' | zenity --title "Select Display" --list --text "" --column "Monitor" --column "Enabled")
if [ ! -z "$s" ]; then
e="$(zenity --list --title "Enable ${SCREEN}?" --text "" --radiolist --column "Pick" --column "Enabled" TRUE enable FALSE disable)"
if [ ! -z "$e" ]; then
swaymsg "output $s $e"
command -v notify-send &> /dev/null && (sleep 0.5 && notify-send -t 3000 "$s:$e") &
fi
fi

View file

@ -2071,12 +2071,12 @@ Just a gathering place of locky/suspendy type things...
#+begin_src bash :tangle "~/bin/sway/sway-screen-menu"
#!/usr/bin/bash
# Maintained in linux-config.org
SCREEN=$(swaymsg -t get_outputs | jq -r '.[] | "\(.name)\n\(.active)"' | zenity --title "Select Display" --list --text "" --column "Monitor" --column "Enabled")
if [ ! -z "$SCREEN" ]; then
ENABLED="$(zenity --list --title "Enable ${SCREEN}?" --text "" --radiolist --column "Pick" --column "Enabled" TRUE enable FALSE disable)"
if [ ! -z "$ENABLED" ]; then
swaymsg "output $SCREEN $ENABLED"
command -v notify-send &> /dev/null && (sleep 0.5 && notify-send -t 3000 "$SCREEN:$ENABLED") &
s=$(swaymsg -t get_outputs | jq -r '.[] | "\(.name)\n\(.active)"' | zenity --title "Select Display" --list --text "" --column "Monitor" --column "Enabled")
if [ ! -z "$s" ]; then
e="$(zenity --list --title "Enable ${SCREEN}?" --text "" --radiolist --column "Pick" --column "Enabled" TRUE enable FALSE disable)"
if [ ! -z "$e" ]; then
swaymsg "output $s $e"
command -v notify-send &> /dev/null && (sleep 0.5 && notify-send -t 3000 "$s:$e") &
fi
fi
#+end_src