feat: add browser script

This commit is contained in:
2025-09-25 18:59:03 +09:00
parent 289625930c
commit b0ef37c800
2 changed files with 59 additions and 26 deletions

26
scripts/toggle-firefox.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Workspace name for scratchpad
SCRATCH="special:firefox"
# Find Firefox window
WIN=$(hyprctl clients -j | jq -r '.[] | select(.class == "firefox") | .address' | head -n1)
if [ -z "$WIN" ]; then
# If not running, launch Firefox
firefox &
exit
fi
# Get current workspace of Firefox
CUR=$(hyprctl clients -j | jq -r --arg WIN "$WIN" '.[] | select(.address == $WIN) | .workspace.name')
if [ "$CUR" = "$SCRATCH" ]; then
# If hidden, move back to current workspace
hyprctl dispatch movetoworkspacesilent "$(hyprctl activeworkspace -j | jq -r .name),address:$WIN"
hyprctl dispatch focuswindow "address:$WIN"
else
# Otherwise, move it to scratchpad
hyprctl dispatch movetoworkspacesilent "$SCRATCH,address:$WIN"
fi