diff --git a/deep-focus.sh b/deep-focus.sh new file mode 100755 index 0000000..fcba483 --- /dev/null +++ b/deep-focus.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# @raycast.schemaVersion 1 +# @raycast.title Deep Focus +# @raycast.mode silent +# @raycast.packageName Focus Engine +# +# @raycast.argument1 { "type": "text", "placeholder": "Work, Home, Study, or Clear", "optional": false } + +PROFILE=$1 +HS_CLI="/opt/homebrew/bin/hs" + +PROFILE_LOWER=$(echo "$PROFILE" | tr '[:upper:]' '[:lower:]') + +if [ "$PROFILE_LOWER" = "clear" ] || [ "$PROFILE_LOWER" = "off" ]; then + $HS_CLI -c "ClearDeepFocus()" +else + # Format string to CamelCase (e.g., "work" -> "Work") + FIRST_LETTER=$(echo "${PROFILE:0:1}" | tr '[:lower:]' '[:upper:]') + REST_LETTERS=$(echo "${PROFILE:1}" | tr '[:upper:]' '[:lower:]') + TARGET_PROFILE="${FIRST_LETTER}${REST_LETTERS}" + + $HS_CLI -c "ActivateDeepFocus('${TARGET_PROFILE}')" +fi