feat: add browser script
This commit is contained in:
26
scripts/toggle-firefox.sh
Executable file
26
scripts/toggle-firefox.sh
Executable 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
|
||||
|
||||
Reference in New Issue
Block a user