From d06784958d73159b5e4abafe5114804662114ed7 Mon Sep 17 00:00:00 2001 From: Ryan Schanzenbacher Date: Thu, 9 Jul 2026 22:15:53 -0400 Subject: move ubersicht modules in tree --- .../lib/scripts/browser-audio.applescript | 91 ++++++++++++++++++ .../lib/scripts/firefox-audio.applescript | 24 +++++ .../lib/scripts/firefox-dev-audio.applescript | 24 +++++ .../lib/scripts/init-aerospace.sh | 26 ++++++ .../simple-bar-source/lib/scripts/init-yabai.sh | 102 +++++++++++++++++++++ .../simple-bar-source/lib/scripts/netstats.sh | 5 + .../simple-bar-source/lib/scripts/next-meeting.sh | 101 ++++++++++++++++++++ .../lib/scripts/run-command-in-iterm2.applescript | 9 ++ .../scripts/run-command-in-terminal.applescript | 7 ++ .../lib/scripts/yabai-set-mode-server.sh | 38 ++++++++ .../lib/scripts/yabai-set-mode.sh | 40 ++++++++ .../lib/scripts/zoom-mute-status.applescript | 17 ++++ .../lib/scripts/zoom-video-status.applescript | 17 ++++ 13 files changed, 501 insertions(+) create mode 100755 users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/browser-audio.applescript create mode 100755 users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/firefox-audio.applescript create mode 100755 users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/firefox-dev-audio.applescript create mode 100755 users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/init-aerospace.sh create mode 100755 users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/init-yabai.sh create mode 100755 users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/netstats.sh create mode 100755 users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/next-meeting.sh create mode 100755 users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/run-command-in-iterm2.applescript create mode 100755 users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/run-command-in-terminal.applescript create mode 100755 users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/yabai-set-mode-server.sh create mode 100755 users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/yabai-set-mode.sh create mode 100755 users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/zoom-mute-status.applescript create mode 100755 users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/zoom-video-status.applescript (limited to 'users/ryan/modules/simple-bar/simple-bar-source/lib/scripts') diff --git a/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/browser-audio.applescript b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/browser-audio.applescript new file mode 100755 index 0000000..e6b64cf --- /dev/null +++ b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/browser-audio.applescript @@ -0,0 +1,91 @@ +set browser to "" +set title_string to "" +set active_tab to 0 + +to replace_chars(this_text, search_string, replacement_string) + set AppleScript's text item delimiters to the search_string + set the item_list to every text item of this_text + set AppleScript's text item delimiters to the replacement_string + set this_text to the item_list as string + set AppleScript's text item delimiters to "" + return this_text +end replace_chars + +try + do shell script "osascript -e 'id of application \"Google Chrome\"'" + if application "Google Chrome" is running then + tell application "Google Chrome" + set window_list to every window + + repeat with the_window in window_list + set tab_list to every tab in the_window + + repeat with the_tab in tab_list + set the_title to the title of the_tab + set the_url to the URL of the_tab + if "- YouTube" is in the_title then + if active_tab is 0 then set title_string to " " & text 1 thru -11 of the_title + set browser to "chrome" + set active_tab to 1 + end if + if "open.spotify.com" is in the_url then + if active_tab is 0 then set title_string to " " & text of the_title + set browser to "chrome" + set active_tab to 1 + if "Spotify" is in the_title then set title_string to "" + end if + end repeat + end repeat + end tell + end if +end try + +try + do shell script "osascript -e 'id of application \"Brave Browser\"'" + if application "Brave Browser" is running then + tell application "Brave Browser" + set window_list to every window + + repeat with the_window in window_list + set tab_list to every tab in the_window + + repeat with the_tab in tab_list + set the_url to the URL of the_tab + set the_title to the title of the_tab + if "- YouTube" is in the_title then + if active_tab is 0 then set title_string to " " & text 1 thru -11 of the_title + set browser to "brave" + set active_tab to 1 + end if + if "open.spotify.com" is in the_url then + if active_tab is 0 then set title_string to " " & text of the_title + set browser to "brave" + set active_tab to 1 + if "Spotify" is in the_title then set title_string to "" + end if + end repeat + end repeat + end tell + end if +end try + +if application "Safari" is running then + tell application "Safari" + set window_list to every window + + repeat with the_window in window_list + set tab_list to every tab in the_window + + repeat with the_tab in tab_list + set the_title to the name of the_tab + if "- YouTube" is in the_title then + if active_tab is 0 then set title_string to " " & text 1 thru -11 of the_title + set browser to "safari" + set active_tab to 1 + end if + end repeat + end repeat + end tell +end if + +return "{ \"browser\": \"" & browser & "\", \"title\": \"" & replace_chars(title_string, "\"", "Ò") & "\" }" diff --git a/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/firefox-audio.applescript b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/firefox-audio.applescript new file mode 100755 index 0000000..23c408a --- /dev/null +++ b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/firefox-audio.applescript @@ -0,0 +1,24 @@ +set browser to "" +set title_string to "" +set active_tab to 0 + +to replace_chars(this_text, search_string, replacement_string) + set AppleScript's text item delimiters to the search_string + set the item_list to every text item of this_text + set AppleScript's text item delimiters to the replacement_string + set this_text to the item_list as string + set AppleScript's text item delimiters to "" + return this_text +end replace_chars + +tell application "Firefox" + set the_title to (name of windows whose name contains "- YouTube") as text + + if "- YouTube" is in the_title then + if active_tab is 0 then set title_string to " " & text 1 thru -11 of the_title + set browser to "firefox" + set active_tab to 1 + end if +end tell + +return "{ \"browser\": \"" & browser & "\", \"title\": \"" & replace_chars(title_string, "\"", "Ò") & "\" }" diff --git a/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/firefox-dev-audio.applescript b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/firefox-dev-audio.applescript new file mode 100755 index 0000000..6618fec --- /dev/null +++ b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/firefox-dev-audio.applescript @@ -0,0 +1,24 @@ +set browser to "" +set title_string to "" +set active_tab to 0 + +to replace_chars(this_text, search_string, replacement_string) + set AppleScript's text item delimiters to the search_string + set the item_list to every text item of this_text + set AppleScript's text item delimiters to the replacement_string + set this_text to the item_list as string + set AppleScript's text item delimiters to "" + return this_text +end replace_chars + +tell application "Firefox Developer Edition" + set the_title to (name of windows whose name contains "- YouTube") as text + + if "- YouTube" is in the_title then + if active_tab is 0 then set title_string to " " & text 1 thru -11 of the_title + set browser to "firefox" + set active_tab to 1 + end if +end tell + +return "{ \"browser\": \"" & browser & "\", \"title\": \"" & replace_chars(title_string, "\"", "Ò") & "\" }" diff --git a/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/init-aerospace.sh b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/init-aerospace.sh new file mode 100755 index 0000000..0e9c140 --- /dev/null +++ b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/init-aerospace.sh @@ -0,0 +1,26 @@ +# Store the first argument passed to the script in the variable aerospace_path +aerospace_path=$1 + +# Get the status of System Integrity Protection (SIP) and store it in the variable SIP +SIP=$(csrutil status) + +# List monitors using the aerospace tool, format the output as JSON, and store it in the variable displays +# Redirect any error output to /dev/null +displays=$($aerospace_path list-monitors --json --format "%{monitor-id} %{monitor-name} %{monitor-appkit-nsscreen-screens-id}" 2> /dev/null) + +# Check if the previous command failed (exit status 1) +if [ $? -eq 1 ]; then + # Print "aerospaceError" and exit the script with status 0 + echo "aerospaceError" + exit 0 +fi + +# Print a JSON object containing the displays information, SIP status, and a shadow property set to true +echo $(cat <<-EOF + { + "displays": $displays, + "SIP": "$SIP", + "shadow": true + } +EOF +) \ No newline at end of file diff --git a/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/init-yabai.sh b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/init-yabai.sh new file mode 100755 index 0000000..5dbbfe3 --- /dev/null +++ b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/init-yabai.sh @@ -0,0 +1,102 @@ +# Assign input arguments to variables +yabai_path=$1 +display_skhd_mode=$2 +disable_signals=$3 +enable_window_title_changed_signal=$4 + +# Check if yabai is running +pgrep -x yabai > /dev/null + +# If yabai is not running, output an error message and exit +if [ $? -eq 1 ]; then + echo "yabaiError" + exit 0 +fi + +# Get the System Integrity Protection (SIP) status +SIP=$(csrutil status) +# Get the current window shadow configuration from yabai +shadow_enabled=$($yabai_path -m config window_shadow) + +# Query yabai for spaces, windows, and displays information +spaces=$($yabai_path -m query --spaces) +windows=$($yabai_path -m query --windows) +displays=$($yabai_path -m query --displays) + +# Retry querying spaces if the initial query was empty +if [ -z "$spaces" ]; then + spaces=$($yabai_path -m query --spaces) +fi + +# Retry querying windows if the initial query was empty and remove backslashes +if [ -z "$windows" ]; then + windows=$($yabai_path -m query --windows | sed 's/\\.//g;') +fi + +# Retry querying displays if the initial query was empty +if [ -z "$displays" ]; then + displays=$($yabai_path -m query --displays) +fi + +# Add or remove signals based on the disable_signals flag +if [ $disable_signals = "false" ]; then + # Add signals to refresh the simple-bar widget on various yabai events + $yabai_path -m signal --add event=window_focused action="osascript -e 'tell application id \"tracesOf.Uebersicht\" to refresh widget id \"simple-bar-index-jsx\"'" label="Refresh simple-bar when focused application changes" + $yabai_path -m signal --add event=window_minimized action="osascript -e 'tell application id \"tracesOf.Uebersicht\" to refresh widget id \"simple-bar-index-jsx\"'" label="Refresh simple-bar when a window is minimized" + $yabai_path -m signal --add event=window_resized action="osascript -e 'tell application id \"tracesOf.Uebersicht\" to refresh widget id \"simple-bar-index-jsx\"'" label="Refresh simple-bar when a window is resized" + $yabai_path -m signal --add event=window_destroyed action="osascript -e 'tell application id \"tracesOf.Uebersicht\" to refresh widget id \"simple-bar-index-jsx\"'" label="Refresh simple-bar when an application window is closed" + $yabai_path -m signal --add event=space_changed action="osascript -e 'tell application id \"tracesOf.Uebersicht\" to refresh widget id \"simple-bar-index-jsx\"'" label="Refresh simple-bar on space change" + $yabai_path -m signal --add event=display_changed action="osascript -e 'tell application id \"tracesOf.Uebersicht\" to refresh widget id \"simple-bar-index-jsx\"'" label="Refresh simple-bar on display focus change" + + # Add signal for window title change if enabled + if [ $enable_window_title_changed_signal = "true" ]; then + $yabai_path -m signal --add event=window_title_changed action="osascript -e 'tell application id \"tracesOf.Uebersicht\" to refresh widget id \"simple-bar-index-jsx\"'" label="Refresh simple-bar when current window title changes" + fi + + # Add signals for space creation and destruction if yabai version is 6 or higher + yabai_major_version=$($yabai_path -v | awk -F '.' '{print $1}' | sed 's/yabai-v//') + if [ $yabai_major_version -ge 6 ]; then + $yabai_path -m signal --add event=space_destroyed action="osascript -e 'tell application id \"tracesOf.Uebersicht\" to refresh widget id \"simple-bar-index-jsx\"'" label="Refresh simple-bar on space removal" + $yabai_path -m signal --add event=space_created action="osascript -e 'tell application id \"tracesOf.Uebersicht\" to refresh widget id \"simple-bar-index-jsx\"'" label="Refresh simple-bar on space creation" + fi +else + # Remove signals if disable_signals is true + $yabai_path -m signal --remove label="Refresh simple-bar when focused application changes" >/dev/null 2>&1 || true + $yabai_path -m signal --remove label="Refresh simple-bar when a window is minimized" >/dev/null 2>&1 || true + $yabai_path -m signal --remove label="Refresh simple-bar when a window is resized" >/dev/null 2>&1 || true + $yabai_path -m signal --remove label="Refresh simple-bar when an application window is closed" >/dev/null 2>&1 || true + $yabai_path -m signal --remove label="Refresh simple-bar on space change" >/dev/null 2>&1 || true + $yabai_path -m signal --remove label="Refresh simple-bar on display focus change" >/dev/null 2>&1 || true + $yabai_path -m signal --remove label="Refresh simple-bar when current window title changes" >/dev/null 2>&1 || true + $yabai_path -m signal --remove label="Refresh simple-bar on space removal" >/dev/null 2>&1 || true + $yabai_path -m signal --remove label="Refresh simple-bar on space creation" >/dev/null 2>&1 || true +fi + +# Determine skhd mode based on the display_skhd_mode flag and disable_signals flag +if [ $display_skhd_mode = "true" ]; then + SCRIPT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd) + if [ $disable_signals = "false" ]; then + skhd_mode=$(cat "$("${SCRIPT_DIR}"/yabai-set-mode.sh --query)") + else + skhd_mode=$(cat "$("${SCRIPT_DIR}"/yabai-set-mode-server.sh --query)") + fi +else + skhd_mode="{}" +fi + +# Output the collected information as a JSON object +echo $(cat <<-EOF + { + "spaces": $spaces, + "windows": $windows, + "displays": $displays, + "SIP": "$SIP", + "shadow": "$shadow_enabled", + "skhdMode": $skhd_mode + } +EOF +) | \ + # Remove invisible U+200E Left-To-Right Mark character + sed "s/\xe2\x80\x8e//g" | \ + # Remove newlines from output (handling Google Chrome JSON parse error caused by "search in page") + tr -d '\n' diff --git a/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/netstats.sh b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/netstats.sh new file mode 100755 index 0000000..66447ec --- /dev/null +++ b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/netstats.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# Optimized: Single netstat call with direct output processing +netstat -w1 2>&1 | awk 'NR==3 {printf "{ \"download\": %s, \"upload\": %s}", $4, $6; exit}' + diff --git a/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/next-meeting.sh b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/next-meeting.sh new file mode 100755 index 0000000..b8e13e5 --- /dev/null +++ b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/next-meeting.sh @@ -0,0 +1,101 @@ +#!/bin/bash +# Get next meeting using icalBuddy (much faster than AppleScript, handles recurring events) +# Usage: next-meeting.sh [icalBuddyPath] [lookAheadHours] + +# Configuration +MAX_IN_PROGRESS_MINUTES=15 # Stop showing "now" after meeting is 15 min in progress +LOOKAHEAD="${2:-12}" # How many hours ahead to look for meetings (default: 12) +MAX_EVENTS=10 # Fetch multiple events to skip stale in-progress ones + +# Calculate end time (icalBuddy doesn't support now+Xh syntax) +END_TIME=$(date -v+${LOOKAHEAD}H "+%Y-%m-%d %H:%M") + +# Use custom path if provided, otherwise auto-detect +CUSTOM_PATH="$1" +if [ -n "$CUSTOM_PATH" ] && [ -x "$CUSTOM_PATH" ]; then + ICALBUDDY="$CUSTOM_PATH" +else + ICALBUDDY=$(which icalBuddy 2>/dev/null) + if [ -z "$ICALBUDDY" ]; then + if [ -x "/opt/homebrew/bin/icalBuddy" ]; then + ICALBUDDY="/opt/homebrew/bin/icalBuddy" + elif [ -x "/usr/local/bin/icalBuddy" ]; then + ICALBUDDY="/usr/local/bin/icalBuddy" + else + echo "" + exit 0 + fi + fi +fi + +now_epoch=$(date +%s) + +# Fetch multiple events - each event bullet starts with <<>> +# Using a unique prefix that won't appear in notes content +output=$("$ICALBUDDY" -n -nc -nrd -ea -eed -li "$MAX_EVENTS" \ + -b "<<>>" -ss "" \ + -df "%Y-%m-%d" -tf "%H:%M" \ + -iep "title,datetime,notes" \ + eventsFrom:"now" to:"$END_TIME" 2>/dev/null) + +if [ -z "$output" ]; then + echo "" + exit 0 +fi + +# Write events to temp file for processing +tmpfile=$(mktemp) +echo "$output" > "$tmpfile" + +# Extract individual events by splitting on <<>> prefix +event_num=0 +while IFS= read -r line; do + if [[ "$line" == "<<>>"* ]]; then + # Process previous event if we have one + if [ "$event_num" -gt 0 ] && [ -n "$cur_title" ] && [ -n "$cur_start_time" ] && [ -n "$cur_iso_date" ]; then + meeting_epoch=$(date -j -f "%Y-%m-%d %H:%M" "$cur_iso_date $cur_start_time" +%s 2>/dev/null) + if [ -n "$meeting_epoch" ]; then + minutes_until=$(( (meeting_epoch - now_epoch) / 60 )) + if [ "$minutes_until" -ge "-$MAX_IN_PROGRESS_MINUTES" ]; then + echo "${cur_title}|${cur_iso_date}T${cur_start_time}||${cur_notes}|${minutes_until}" + rm -f "$tmpfile" + exit 0 + fi + fi + fi + + # Start new event + event_num=$((event_num + 1)) + cur_title="${line#<<>>}" + cur_title=$(echo "$cur_title" | sed 's/ (Calendar)$//') + cur_iso_date="" + cur_start_time="" + cur_notes="" + in_notes=0 + elif [[ "$line" =~ ^[[:space:]]+[0-9]{4}-[0-9]{2}-[0-9]{2}" at "[0-9]{2}:[0-9]{2} ]]; then + cur_iso_date=$(echo "$line" | grep -oE '[0-9]{4}-[0-9]{2}-[0-9]{2}') + cur_start_time=$(echo "$line" | grep -oE 'at [0-9]{2}:[0-9]{2}' | head -1 | sed 's/at //') + in_notes=0 + elif [[ "$line" == *"notes:"* ]]; then + in_notes=1 + cur_notes="$line" + elif [ "$in_notes" -eq 1 ]; then + cur_notes="${cur_notes} $(echo "$line" | sed 's/|/¦/g')" + fi +done < "$tmpfile" + +# Process the last event +if [ "$event_num" -gt 0 ] && [ -n "$cur_title" ] && [ -n "$cur_start_time" ] && [ -n "$cur_iso_date" ]; then + meeting_epoch=$(date -j -f "%Y-%m-%d %H:%M" "$cur_iso_date $cur_start_time" +%s 2>/dev/null) + if [ -n "$meeting_epoch" ]; then + minutes_until=$(( (meeting_epoch - now_epoch) / 60 )) + if [ "$minutes_until" -ge "-$MAX_IN_PROGRESS_MINUTES" ]; then + echo "${cur_title}|${cur_iso_date}T${cur_start_time}||${cur_notes}|${minutes_until}" + rm -f "$tmpfile" + exit 0 + fi + fi +fi + +rm -f "$tmpfile" +echo "" diff --git a/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/run-command-in-iterm2.applescript b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/run-command-in-iterm2.applescript new file mode 100755 index 0000000..ab00115 --- /dev/null +++ b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/run-command-in-iterm2.applescript @@ -0,0 +1,9 @@ +on run argv + set commandToRun to item 1 of argv + tell application "iTerm" + set newWindow to (create window with default profile) + tell current session of newWindow + write text commandToRun + end tell + end tell +end run \ No newline at end of file diff --git a/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/run-command-in-terminal.applescript b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/run-command-in-terminal.applescript new file mode 100755 index 0000000..898ec7a --- /dev/null +++ b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/run-command-in-terminal.applescript @@ -0,0 +1,7 @@ +on run argv + set commandToRun to item 1 of argv + tell application "Terminal" + do script commandToRun + activate + end tell +end run \ No newline at end of file diff --git a/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/yabai-set-mode-server.sh b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/yabai-set-mode-server.sh new file mode 100755 index 0000000..f5fc782 --- /dev/null +++ b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/yabai-set-mode-server.sh @@ -0,0 +1,38 @@ +#! /usr/bin/env sh + +# make sure to fix permissions! +# Privacy & Security > Automation > skhd > Ubersicht + +# Write information regarding skhd mode to a cache file for widgets to read from. +# Usage: +# $0 --query print location of cache file +# $0 mode_name [color] write mode_name (and optionally, a color) to a cache file +# default color is white. +# by default, a mode named "default" will not be shown. + +CACHE_FILE="$HOME/Library/Caches/uebersicht-simple-bar-index/yabai-mode" + +mkdir -p "$(dirname "$CACHE_FILE")" +touch "$CACHE_FILE" + +main() { + # optional second argument color + color="$2" + if [ -z "$color" ]; then + color="white" + fi + + # update cache file + echo \ + "{\"mode\": \"$1\", \"color\": \"$color\"}" \ + > "$CACHE_FILE" +} + +case "$1" in + --query) + echo "$CACHE_FILE" + ;; + *) + main "$@" + ;; +esac diff --git a/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/yabai-set-mode.sh b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/yabai-set-mode.sh new file mode 100755 index 0000000..6f580db --- /dev/null +++ b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/yabai-set-mode.sh @@ -0,0 +1,40 @@ +#! /usr/bin/env sh + +# make sure to fix permissions! +# Privacy & Security > Automation > skhd > Ubersicht + +# Write information regarding skhd mode to a cache file for widgets to read from. +# Usage: +# $0 --query print location of cache file +# $0 mode_name [color] write mode_name (and optionally, a color) to a cache file +# default color is white. +# by default, a mode named "default" will not be shown. + +CACHE_FILE="$HOME/Library/Caches/uebersicht-simple-bar-index/yabai-mode" + +mkdir -p "$(dirname "$CACHE_FILE")" +touch "$CACHE_FILE" + +main() { + # optional second argument color + color="$2" + if [ -z "$color" ]; then + color="white" + fi + + # update cache file + echo \ + "{\"mode\": \"$1\", \"color\": \"$color\"}" \ + > "$CACHE_FILE" + + osascript -e 'tell application id "tracesOf.Uebersicht" to refresh widget id "simple-bar-index-jsx"' +} + +case "$1" in + --query) + echo "$CACHE_FILE" + ;; + *) + main "$@" + ;; +esac diff --git a/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/zoom-mute-status.applescript b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/zoom-mute-status.applescript new file mode 100755 index 0000000..71288a7 --- /dev/null +++ b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/zoom-mute-status.applescript @@ -0,0 +1,17 @@ +property btnTitle : "Mute audio" + +if application "zoom.us" is running then + tell application "System Events" + tell application process "zoom.us" + if exists (menu item btnTitle of menu 1 of menu bar item "Meeting" of menu bar 1) then + set returnValue to "on" + else + set returnValue to "off" + end if + end tell + end tell +else + set returnValue to "" +end if + +return returnValue \ No newline at end of file diff --git a/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/zoom-video-status.applescript b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/zoom-video-status.applescript new file mode 100755 index 0000000..367821f --- /dev/null +++ b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/zoom-video-status.applescript @@ -0,0 +1,17 @@ +property btnTitle : "Stop video" + +if application "zoom.us" is running then + tell application "System Events" + tell application process "zoom.us" + if exists (menu item btnTitle of menu 1 of menu bar item "Meeting" of menu bar 1) then + set returnValue to "on" + else + set returnValue to "off" + end if + end tell + end tell +else + set returnValue to "" +end if + +return returnValue \ No newline at end of file -- cgit v1.3