mirror of
https://github.com/rileyrg/linux-init.git
synced 2024-09-29 05:37:29 +02:00
sway-screen dont turn off single display
This commit is contained in:
parent
6c0f701bd6
commit
03d60d09c8
7 changed files with 42 additions and 18 deletions
23
README.md
23
README.md
|
@ -1508,7 +1508,7 @@ bindsym $mod+Control+t exec sway-notify "Opening NEW terminal instance" && alacr
|
|||
exec sway-kanshi
|
||||
exec sway-idle
|
||||
exec '[ -f "$HOME/.sway-autostart" ] && . "$HOME/.sway-autostart" && (sleep 1 && sway-notify "~/.sway-autostart processed")'
|
||||
exec gpg-cache
|
||||
exec sleep 2 && gpg-cache
|
||||
exec $editor
|
||||
exec swaymsg workspace $ws1
|
||||
```
|
||||
|
@ -1524,6 +1524,15 @@ include /etc/sway/config.d/*
|
|||
## bin,scripts :sway:wayland:
|
||||
|
||||
|
||||
### ~/bin/sway-sway-active-monitors-count
|
||||
|
||||
```bash
|
||||
#!/usr/bin/bash
|
||||
# Maintained in linux-config.org
|
||||
swaymsg -t get_outputs | jq -r '[ .[] | select(.dpms and .active) ] | length'
|
||||
```
|
||||
|
||||
|
||||
### ~/bin/sway/sway-autostart
|
||||
|
||||
```bash
|
||||
|
@ -1695,8 +1704,8 @@ exec swayidle -w \
|
|||
#!/usr/bin/bash
|
||||
# Maintained in linux-config.org
|
||||
m="$(swaymsg -t get_outputs | jq -r '.[0].name')"
|
||||
#swaymsg bindswitch lid:on exec "sway-screen disable $m"
|
||||
#swaymsg bindswitch lid:off exec "sway-screen enable $m"
|
||||
swaymsg bindswitch lid:on exec "sway-screen disable $m"
|
||||
swaymsg bindswitch lid:off exec "sway-screen enable $m"
|
||||
echo $m
|
||||
```
|
||||
|
||||
|
@ -1724,8 +1733,10 @@ notify-send -t 5000 "${@}"
|
|||
```bash
|
||||
#!/usr/bin/bash
|
||||
# Maintained in linux-config.org
|
||||
m=${2:-$(swaymsg -t get_outputs | jq -r '.[0].name')}
|
||||
swaymsg "output ${m} ${1:-enable}"
|
||||
m="${2:-$(swaymsg -t get_outputs | jq -r '.[0].name')}"
|
||||
c="${1:-enable}"
|
||||
[ "$c" = "disable" ] && [ "$(sway-active-monitors-count)" = "1" ] && sway-notify "Not turning off single display $m" && exit 1
|
||||
swaymsg "output ${m} "
|
||||
(sleep 2 && sway-notify "${m}:${1:-enable}") &
|
||||
```
|
||||
|
||||
|
@ -1739,7 +1750,7 @@ s=$(swaymsg -t get_outputs | jq -r '.[] | "\(.name)\n\(.active)"' | zenity --
|
|||
if [ ! -z "$s" ]; then
|
||||
e="$(zenity --list --title "Enable ${s}?" --text "" --radiolist --column "Pick" --column "Enabled" TRUE enable FALSE disable)"
|
||||
if [ ! -z "$e" ]; then
|
||||
numActive=$(swaymsg -t get_outputs | jq -r '[ .[] | select(.dpms and .active) ] | length')
|
||||
numActive=$(sway-active-monitors-count)
|
||||
[ "$numActive" = "1" ] && [ $e = "disable" ] && sway-notify "Only one active monitor so no...." && exit 1
|
||||
swaymsg "output $s $e"
|
||||
(sleep 0.5 && sway-notify "$s:$e") &
|
||||
|
|
3
directories/bin/sway/sway-active-monitors-count
Executable file
3
directories/bin/sway/sway-active-monitors-count
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/bash
|
||||
# Maintained in linux-config.org
|
||||
swaymsg -t get_outputs | jq -r '[ .[] | select(.dpms and .active) ] | length'
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/bash
|
||||
# Maintained in linux-config.org
|
||||
m="$(swaymsg -t get_outputs | jq -r '.[0].name')"
|
||||
#swaymsg bindswitch lid:on exec "sway-screen disable $m"
|
||||
#swaymsg bindswitch lid:off exec "sway-screen enable $m"
|
||||
swaymsg bindswitch lid:on exec "sway-screen disable $m"
|
||||
swaymsg bindswitch lid:off exec "sway-screen enable $m"
|
||||
echo $m
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#!/usr/bin/bash
|
||||
# Maintained in linux-config.org
|
||||
m=${2:-$(swaymsg -t get_outputs | jq -r '.[0].name')}
|
||||
swaymsg "output ${m} ${1:-enable}"
|
||||
m="${2:-$(swaymsg -t get_outputs | jq -r '.[0].name')}"
|
||||
c="${1:-enable}"
|
||||
[ "$c" = "disable" ] && [ "$(sway-active-monitors-count)" = "1" ] && sway-notify "Not turning off single display $m" && exit 1
|
||||
swaymsg "output ${m} "
|
||||
(sleep 2 && sway-notify "${m}:${1:-enable}") &
|
||||
|
|
|
@ -4,7 +4,7 @@ s=$(swaymsg -t get_outputs | jq -r '.[] | "\(.name)\n\(.active)"' | zenity --
|
|||
if [ ! -z "$s" ]; then
|
||||
e="$(zenity --list --title "Enable ${s}?" --text "" --radiolist --column "Pick" --column "Enabled" TRUE enable FALSE disable)"
|
||||
if [ ! -z "$e" ]; then
|
||||
numActive=$(swaymsg -t get_outputs | jq -r '[ .[] | select(.dpms and .active) ] | length')
|
||||
numActive=$(sway-active-monitors-count)
|
||||
[ "$numActive" = "1" ] && [ $e = "disable" ] && sway-notify "Only one active monitor so no...." && exit 1
|
||||
swaymsg "output $s $e"
|
||||
(sleep 0.5 && sway-notify "$s:$e") &
|
||||
|
|
|
@ -254,7 +254,7 @@ exec waybar
|
|||
exec sway-kanshi
|
||||
exec sway-idle
|
||||
exec '[ -f "$HOME/.sway-autostart" ] && . "$HOME/.sway-autostart" && (sleep 1 && sway-notify "~/.sway-autostart processed")'
|
||||
exec gpg-cache
|
||||
exec sleep 2 && gpg-cache
|
||||
exec $editor
|
||||
exec swaymsg workspace $ws1
|
||||
|
||||
|
|
|
@ -1992,7 +1992,7 @@ Thank you https://github.com/deanproxy/dotfiles/blob/master/linux/i3/scripts/blu
|
|||
exec sway-kanshi
|
||||
exec sway-idle
|
||||
exec '[ -f "$HOME/.sway-autostart" ] && . "$HOME/.sway-autostart" && (sleep 1 && sway-notify "~/.sway-autostart processed")'
|
||||
exec gpg-cache
|
||||
exec sleep 2 && gpg-cache
|
||||
exec $editor
|
||||
exec swaymsg workspace $ws1
|
||||
#+end_src
|
||||
|
@ -2001,6 +2001,12 @@ Thank you https://github.com/deanproxy/dotfiles/blob/master/linux/i3/scripts/blu
|
|||
include /etc/sway/config.d/*
|
||||
#+end_src
|
||||
** bin,scripts :sway:wayland:
|
||||
*** ~/bin/sway-sway-active-monitors-count
|
||||
#+begin_src bash :tangle ~/bin/sway/sway-active-monitors-count
|
||||
#!/usr/bin/bash
|
||||
# Maintained in linux-config.org
|
||||
swaymsg -t get_outputs | jq -r '[ .[] | select(.dpms and .active) ] | length'
|
||||
#+end_src
|
||||
*** ~/bin/sway/sway-autostart
|
||||
#+begin_src bash :tangle "~/bin/sway/sway-autostart"
|
||||
#!/usr/bin/bash
|
||||
|
@ -2154,8 +2160,8 @@ Just a gathering place of locky/suspendy type things...
|
|||
#!/usr/bin/bash
|
||||
# Maintained in linux-config.org
|
||||
m="$(swaymsg -t get_outputs | jq -r '.[0].name')"
|
||||
#swaymsg bindswitch lid:on exec "sway-screen disable $m"
|
||||
#swaymsg bindswitch lid:off exec "sway-screen enable $m"
|
||||
swaymsg bindswitch lid:on exec "sway-screen disable $m"
|
||||
swaymsg bindswitch lid:off exec "sway-screen enable $m"
|
||||
echo $m
|
||||
#+end_src
|
||||
*** ~/bin/sway/sway-lock
|
||||
|
@ -2183,8 +2189,10 @@ Just a gathering place of locky/suspendy type things...
|
|||
#+begin_src bash :tangle "~/bin/sway/sway-screen"
|
||||
#!/usr/bin/bash
|
||||
# Maintained in linux-config.org
|
||||
m=${2:-$(swaymsg -t get_outputs | jq -r '.[0].name')}
|
||||
swaymsg "output ${m} ${1:-enable}"
|
||||
m="${2:-$(swaymsg -t get_outputs | jq -r '.[0].name')}"
|
||||
c="${1:-enable}"
|
||||
[ "$c" = "disable" ] && [ "$(sway-active-monitors-count)" = "1" ] && sway-notify "Not turning off single display $m" && exit 1
|
||||
swaymsg "output ${m} "
|
||||
(sleep 2 && sway-notify "${m}:${1:-enable}") &
|
||||
#+end_src
|
||||
*** ~/bin/sway/sway-screen-menu
|
||||
|
@ -2198,7 +2206,7 @@ Just a gathering place of locky/suspendy type things...
|
|||
if [ ! -z "$s" ]; then
|
||||
e="$(zenity --list --title "Enable ${s}?" --text "" --radiolist --column "Pick" --column "Enabled" TRUE enable FALSE disable)"
|
||||
if [ ! -z "$e" ]; then
|
||||
numActive=$(swaymsg -t get_outputs | jq -r '[ .[] | select(.dpms and .active) ] | length')
|
||||
numActive=$(sway-active-monitors-count)
|
||||
[ "$numActive" = "1" ] && [ $e = "disable" ] && sway-notify "Only one active monitor so no...." && exit 1
|
||||
swaymsg "output $s $e"
|
||||
(sleep 0.5 && sway-notify "$s:$e") &
|
||||
|
|
Loading…
Reference in a new issue