#!/usr/bin/env bash scratchpad_id=$(yabai -m query --windows | jq '.[] | select(.title=="scratchpad").id') if [[ "$scratchpad_id" == "" || "$scratchpad_id" -lt 1 ]]; then exit 1 fi is_visible=$(yabai -m query --windows --window "$scratchpad_id" | jq '."is-visible"') if [[ "$is_visible" = true ]]; then yabai -m window "$scratchpad_id" --space 10 else yabai -m window "$scratchpad_id" --space mouse yabai -m window --focus "$scratchpad_id" fi