45 lines
1.2 KiB
Bash
Executable File
45 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
APP_ID='google-chrome'
|
|
HIDDEN_WS='__ekklesia_hidden'
|
|
|
|
if ! pgrep -x chrome >/dev/null 2>&1 &&
|
|
! pgrep -x google-chrome >/dev/null 2>&1; then
|
|
exec google-chrome \
|
|
--ozone-platform=wayland \
|
|
--start-maximized \
|
|
https://app.wonderink.org/
|
|
fi
|
|
|
|
focused_app="$(
|
|
swaymsg -t get_tree -r |
|
|
python3 -c '
|
|
import json, sys
|
|
|
|
tree = json.load(sys.stdin)
|
|
|
|
def find_focused(node):
|
|
if node.get("focused"):
|
|
return node
|
|
for child in node.get("nodes", []) + node.get("floating_nodes", []):
|
|
result = find_focused(child)
|
|
if result:
|
|
return result
|
|
return None
|
|
|
|
node = find_focused(tree)
|
|
print((node or {}).get("app_id") or "")
|
|
'
|
|
)"
|
|
|
|
if [ "$focused_app" = "$APP_ID" ]; then
|
|
swaymsg '[app_id="google-chrome"] move container to workspace __ekklesia_hidden' >/dev/null
|
|
exit 0
|
|
fi
|
|
|
|
swaymsg '[app_id="google-chrome"] move container to workspace current' >/dev/null 2>&1 || true
|
|
swaymsg '[app_id="google-chrome"] focus' >/dev/null 2>&1 || true
|
|
swaymsg '[app_id="google-chrome"] fullscreen disable' >/dev/null 2>&1 || true
|
|
swaymsg '[app_id="google-chrome"] floating disable' >/dev/null 2>&1 || true
|