feat: make screenshare utility autotoggle

This commit is contained in:
Swarsel 2024-12-05 02:22:23 +01:00
parent a42cf17d79
commit 02921a6922
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
7 changed files with 52 additions and 24 deletions

View file

@ -1,10 +1,16 @@
SHARESCREEN="$(nix eval --raw ~/.dotfiles#nixosConfigurations."$(hostname)".config.home-manager.users."$(whoami)".swarselsystems.sharescreen)"
if [[ "$1" == "start" ]]; then
touch /tmp/screenshare.state
STATE=$(</tmp/screenshare.state)
if [[ "$STATE" != "1" ]]; then
wl-mirror "$SHARESCREEN" & sleep 0.1
swaymsg output eDP-2 mode 1280x800
swaymsg output "$SHARESCREEN" mode "$SWARSEL_LO_RES"
echo 1 > /tmp/screenshare.state
swaymsg '[app_id=at.yrlf.wl_mirror] move to workspace 12:S'
swaymsg '[app_id=at.yrlf.wl_mirror] fullscreen'
else
swaymsg output eDP-2 mode 2560x1600
swaymsg output "$SHARESCREEN" mode "$SWARSEL_HI_RES"
echo 0 > /tmp/screenshare.state
swaymsg '[app_id=at.yrlf.wl_mirror] kill'
fi