Files
raycast-scripts/workspace-status.sh

24 lines
777 B
Bash
Executable File

#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Workspace Auto-Save Status
# @raycast.mode inline
# @raycast.refreshTime 10s
# Optional parameters:
# @raycast.icon 💠
# @raycast.packageName Window Automation
# 1. Pull active timer values from the live Hammerspoon engine state
COUNTDOWN=$(/opt/homebrew/bin/hs -c "print(WindowManager.saveCountdown)" 2>/dev/null)
LAST_SAVE=$(/opt/homebrew/bin/hs -c "print(WindowManager.lastSavedTime)" 2>/dev/null)
# 2. Output structural string directly into the Raycast search results row
if [ -z "$COUNTDOWN" ] || [ "$COUNTDOWN" == "nil" ]; then
echo "Hammerspoon Offline"
else
MIN=$((COUNTDOWN / 60))
SEC=$((COUNTDOWN % 60))
printf "Next: %d:%02d | Saved: %s\n" $MIN $SEC "$LAST_SAVE"
fi