aboutsummaryrefslogtreecommitdiff
path: root/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts
diff options
context:
space:
mode:
authorRyan Schanzenbacher <ryan@rschanz.org>2026-07-09 22:15:53 -0400
committerRyan Schanzenbacher <ryan@rschanz.org>2026-07-09 22:15:53 -0400
commitd06784958d73159b5e4abafe5114804662114ed7 (patch)
treed8464262c1aa1f10553a5b11a9fda3e505e71f7f /users/ryan/modules/simple-bar/simple-bar-source/lib/scripts
parent1a71e94eb8ca1585201263cf654611ef6849d359 (diff)
move ubersicht modules in tree
Diffstat (limited to 'users/ryan/modules/simple-bar/simple-bar-source/lib/scripts')
-rwxr-xr-xusers/ryan/modules/simple-bar/simple-bar-source/lib/scripts/browser-audio.applescript91
-rwxr-xr-xusers/ryan/modules/simple-bar/simple-bar-source/lib/scripts/firefox-audio.applescript24
-rwxr-xr-xusers/ryan/modules/simple-bar/simple-bar-source/lib/scripts/firefox-dev-audio.applescript24
-rwxr-xr-xusers/ryan/modules/simple-bar/simple-bar-source/lib/scripts/init-aerospace.sh26
-rwxr-xr-xusers/ryan/modules/simple-bar/simple-bar-source/lib/scripts/init-yabai.sh102
-rwxr-xr-xusers/ryan/modules/simple-bar/simple-bar-source/lib/scripts/netstats.sh5
-rwxr-xr-xusers/ryan/modules/simple-bar/simple-bar-source/lib/scripts/next-meeting.sh101
-rwxr-xr-xusers/ryan/modules/simple-bar/simple-bar-source/lib/scripts/run-command-in-iterm2.applescript9
-rwxr-xr-xusers/ryan/modules/simple-bar/simple-bar-source/lib/scripts/run-command-in-terminal.applescript7
-rwxr-xr-xusers/ryan/modules/simple-bar/simple-bar-source/lib/scripts/yabai-set-mode-server.sh38
-rwxr-xr-xusers/ryan/modules/simple-bar/simple-bar-source/lib/scripts/yabai-set-mode.sh40
-rwxr-xr-xusers/ryan/modules/simple-bar/simple-bar-source/lib/scripts/zoom-mute-status.applescript17
-rwxr-xr-xusers/ryan/modules/simple-bar/simple-bar-source/lib/scripts/zoom-video-status.applescript17
13 files changed, 501 insertions, 0 deletions
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 @@
1set browser to ""
2set title_string to ""
3set active_tab to 0
4
5to replace_chars(this_text, search_string, replacement_string)
6 set AppleScript's text item delimiters to the search_string
7 set the item_list to every text item of this_text
8 set AppleScript's text item delimiters to the replacement_string
9 set this_text to the item_list as string
10 set AppleScript's text item delimiters to ""
11 return this_text
12end replace_chars
13
14try
15 do shell script "osascript -e 'id of application \"Google Chrome\"'"
16 if application "Google Chrome" is running then
17 tell application "Google Chrome"
18 set window_list to every window
19
20 repeat with the_window in window_list
21 set tab_list to every tab in the_window
22
23 repeat with the_tab in tab_list
24 set the_title to the title of the_tab
25 set the_url to the URL of the_tab
26 if "- YouTube" is in the_title then
27 if active_tab is 0 then set title_string to " " & text 1 thru -11 of the_title
28 set browser to "chrome"
29 set active_tab to 1
30 end if
31 if "open.spotify.com" is in the_url then
32 if active_tab is 0 then set title_string to " " & text of the_title
33 set browser to "chrome"
34 set active_tab to 1
35 if "Spotify" is in the_title then set title_string to ""
36 end if
37 end repeat
38 end repeat
39 end tell
40 end if
41end try
42
43try
44 do shell script "osascript -e 'id of application \"Brave Browser\"'"
45 if application "Brave Browser" is running then
46 tell application "Brave Browser"
47 set window_list to every window
48
49 repeat with the_window in window_list
50 set tab_list to every tab in the_window
51
52 repeat with the_tab in tab_list
53 set the_url to the URL of the_tab
54 set the_title to the title of the_tab
55 if "- YouTube" is in the_title then
56 if active_tab is 0 then set title_string to " " & text 1 thru -11 of the_title
57 set browser to "brave"
58 set active_tab to 1
59 end if
60 if "open.spotify.com" is in the_url then
61 if active_tab is 0 then set title_string to " " & text of the_title
62 set browser to "brave"
63 set active_tab to 1
64 if "Spotify" is in the_title then set title_string to ""
65 end if
66 end repeat
67 end repeat
68 end tell
69 end if
70end try
71
72if application "Safari" is running then
73 tell application "Safari"
74 set window_list to every window
75
76 repeat with the_window in window_list
77 set tab_list to every tab in the_window
78
79 repeat with the_tab in tab_list
80 set the_title to the name of the_tab
81 if "- YouTube" is in the_title then
82 if active_tab is 0 then set title_string to " " & text 1 thru -11 of the_title
83 set browser to "safari"
84 set active_tab to 1
85 end if
86 end repeat
87 end repeat
88 end tell
89end if
90
91return "{ \"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 @@
1set browser to ""
2set title_string to ""
3set active_tab to 0
4
5to replace_chars(this_text, search_string, replacement_string)
6 set AppleScript's text item delimiters to the search_string
7 set the item_list to every text item of this_text
8 set AppleScript's text item delimiters to the replacement_string
9 set this_text to the item_list as string
10 set AppleScript's text item delimiters to ""
11 return this_text
12end replace_chars
13
14tell application "Firefox"
15 set the_title to (name of windows whose name contains "- YouTube") as text
16
17 if "- YouTube" is in the_title then
18 if active_tab is 0 then set title_string to " " & text 1 thru -11 of the_title
19 set browser to "firefox"
20 set active_tab to 1
21 end if
22end tell
23
24return "{ \"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 @@
1set browser to ""
2set title_string to ""
3set active_tab to 0
4
5to replace_chars(this_text, search_string, replacement_string)
6 set AppleScript's text item delimiters to the search_string
7 set the item_list to every text item of this_text
8 set AppleScript's text item delimiters to the replacement_string
9 set this_text to the item_list as string
10 set AppleScript's text item delimiters to ""
11 return this_text
12end replace_chars
13
14tell application "Firefox Developer Edition"
15 set the_title to (name of windows whose name contains "- YouTube") as text
16
17 if "- YouTube" is in the_title then
18 if active_tab is 0 then set title_string to " " & text 1 thru -11 of the_title
19 set browser to "firefox"
20 set active_tab to 1
21 end if
22end tell
23
24return "{ \"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 @@
1# Store the first argument passed to the script in the variable aerospace_path
2aerospace_path=$1
3
4# Get the status of System Integrity Protection (SIP) and store it in the variable SIP
5SIP=$(csrutil status)
6
7# List monitors using the aerospace tool, format the output as JSON, and store it in the variable displays
8# Redirect any error output to /dev/null
9displays=$($aerospace_path list-monitors --json --format "%{monitor-id} %{monitor-name} %{monitor-appkit-nsscreen-screens-id}" 2> /dev/null)
10
11# Check if the previous command failed (exit status 1)
12if [ $? -eq 1 ]; then
13 # Print "aerospaceError" and exit the script with status 0
14 echo "aerospaceError"
15 exit 0
16fi
17
18# Print a JSON object containing the displays information, SIP status, and a shadow property set to true
19echo $(cat <<-EOF
20 {
21 "displays": $displays,
22 "SIP": "$SIP",
23 "shadow": true
24 }
25EOF
26) \ 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 @@
1# Assign input arguments to variables
2yabai_path=$1
3display_skhd_mode=$2
4disable_signals=$3
5enable_window_title_changed_signal=$4
6
7# Check if yabai is running
8pgrep -x yabai > /dev/null
9
10# If yabai is not running, output an error message and exit
11if [ $? -eq 1 ]; then
12 echo "yabaiError"
13 exit 0
14fi
15
16# Get the System Integrity Protection (SIP) status
17SIP=$(csrutil status)
18# Get the current window shadow configuration from yabai
19shadow_enabled=$($yabai_path -m config window_shadow)
20
21# Query yabai for spaces, windows, and displays information
22spaces=$($yabai_path -m query --spaces)
23windows=$($yabai_path -m query --windows)
24displays=$($yabai_path -m query --displays)
25
26# Retry querying spaces if the initial query was empty
27if [ -z "$spaces" ]; then
28 spaces=$($yabai_path -m query --spaces)
29fi
30
31# Retry querying windows if the initial query was empty and remove backslashes
32if [ -z "$windows" ]; then
33 windows=$($yabai_path -m query --windows | sed 's/\\.//g;')
34fi
35
36# Retry querying displays if the initial query was empty
37if [ -z "$displays" ]; then
38 displays=$($yabai_path -m query --displays)
39fi
40
41# Add or remove signals based on the disable_signals flag
42if [ $disable_signals = "false" ]; then
43 # Add signals to refresh the simple-bar widget on various yabai events
44 $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"
45 $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"
46 $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"
47 $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"
48 $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"
49 $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"
50
51 # Add signal for window title change if enabled
52 if [ $enable_window_title_changed_signal = "true" ]; then
53 $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"
54 fi
55
56 # Add signals for space creation and destruction if yabai version is 6 or higher
57 yabai_major_version=$($yabai_path -v | awk -F '.' '{print $1}' | sed 's/yabai-v//')
58 if [ $yabai_major_version -ge 6 ]; then
59 $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"
60 $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"
61 fi
62else
63 # Remove signals if disable_signals is true
64 $yabai_path -m signal --remove label="Refresh simple-bar when focused application changes" >/dev/null 2>&1 || true
65 $yabai_path -m signal --remove label="Refresh simple-bar when a window is minimized" >/dev/null 2>&1 || true
66 $yabai_path -m signal --remove label="Refresh simple-bar when a window is resized" >/dev/null 2>&1 || true
67 $yabai_path -m signal --remove label="Refresh simple-bar when an application window is closed" >/dev/null 2>&1 || true
68 $yabai_path -m signal --remove label="Refresh simple-bar on space change" >/dev/null 2>&1 || true
69 $yabai_path -m signal --remove label="Refresh simple-bar on display focus change" >/dev/null 2>&1 || true
70 $yabai_path -m signal --remove label="Refresh simple-bar when current window title changes" >/dev/null 2>&1 || true
71 $yabai_path -m signal --remove label="Refresh simple-bar on space removal" >/dev/null 2>&1 || true
72 $yabai_path -m signal --remove label="Refresh simple-bar on space creation" >/dev/null 2>&1 || true
73fi
74
75# Determine skhd mode based on the display_skhd_mode flag and disable_signals flag
76if [ $display_skhd_mode = "true" ]; then
77 SCRIPT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
78 if [ $disable_signals = "false" ]; then
79 skhd_mode=$(cat "$("${SCRIPT_DIR}"/yabai-set-mode.sh --query)")
80 else
81 skhd_mode=$(cat "$("${SCRIPT_DIR}"/yabai-set-mode-server.sh --query)")
82 fi
83else
84 skhd_mode="{}"
85fi
86
87# Output the collected information as a JSON object
88echo $(cat <<-EOF
89 {
90 "spaces": $spaces,
91 "windows": $windows,
92 "displays": $displays,
93 "SIP": "$SIP",
94 "shadow": "$shadow_enabled",
95 "skhdMode": $skhd_mode
96 }
97EOF
98) | \
99 # Remove invisible U+200E Left-To-Right Mark character
100 sed "s/\xe2\x80\x8e//g" | \
101 # Remove newlines from output (handling Google Chrome JSON parse error caused by "search in page")
102 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 @@
1#!/bin/bash
2
3# Optimized: Single netstat call with direct output processing
4netstat -w1 2>&1 | awk 'NR==3 {printf "{ \"download\": %s, \"upload\": %s}", $4, $6; exit}'
5
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 @@
1#!/bin/bash
2# Get next meeting using icalBuddy (much faster than AppleScript, handles recurring events)
3# Usage: next-meeting.sh [icalBuddyPath] [lookAheadHours]
4
5# Configuration
6MAX_IN_PROGRESS_MINUTES=15 # Stop showing "now" after meeting is 15 min in progress
7LOOKAHEAD="${2:-12}" # How many hours ahead to look for meetings (default: 12)
8MAX_EVENTS=10 # Fetch multiple events to skip stale in-progress ones
9
10# Calculate end time (icalBuddy doesn't support now+Xh syntax)
11END_TIME=$(date -v+${LOOKAHEAD}H "+%Y-%m-%d %H:%M")
12
13# Use custom path if provided, otherwise auto-detect
14CUSTOM_PATH="$1"
15if [ -n "$CUSTOM_PATH" ] && [ -x "$CUSTOM_PATH" ]; then
16 ICALBUDDY="$CUSTOM_PATH"
17else
18 ICALBUDDY=$(which icalBuddy 2>/dev/null)
19 if [ -z "$ICALBUDDY" ]; then
20 if [ -x "/opt/homebrew/bin/icalBuddy" ]; then
21 ICALBUDDY="/opt/homebrew/bin/icalBuddy"
22 elif [ -x "/usr/local/bin/icalBuddy" ]; then
23 ICALBUDDY="/usr/local/bin/icalBuddy"
24 else
25 echo ""
26 exit 0
27 fi
28 fi
29fi
30
31now_epoch=$(date +%s)
32
33# Fetch multiple events - each event bullet starts with <<<E>>>
34# Using a unique prefix that won't appear in notes content
35output=$("$ICALBUDDY" -n -nc -nrd -ea -eed -li "$MAX_EVENTS" \
36 -b "<<<E>>>" -ss "" \
37 -df "%Y-%m-%d" -tf "%H:%M" \
38 -iep "title,datetime,notes" \
39 eventsFrom:"now" to:"$END_TIME" 2>/dev/null)
40
41if [ -z "$output" ]; then
42 echo ""
43 exit 0
44fi
45
46# Write events to temp file for processing
47tmpfile=$(mktemp)
48echo "$output" > "$tmpfile"
49
50# Extract individual events by splitting on <<<E>>> prefix
51event_num=0
52while IFS= read -r line; do
53 if [[ "$line" == "<<<E>>>"* ]]; then
54 # Process previous event if we have one
55 if [ "$event_num" -gt 0 ] && [ -n "$cur_title" ] && [ -n "$cur_start_time" ] && [ -n "$cur_iso_date" ]; then
56 meeting_epoch=$(date -j -f "%Y-%m-%d %H:%M" "$cur_iso_date $cur_start_time" +%s 2>/dev/null)
57 if [ -n "$meeting_epoch" ]; then
58 minutes_until=$(( (meeting_epoch - now_epoch) / 60 ))
59 if [ "$minutes_until" -ge "-$MAX_IN_PROGRESS_MINUTES" ]; then
60 echo "${cur_title}|${cur_iso_date}T${cur_start_time}||${cur_notes}|${minutes_until}"
61 rm -f "$tmpfile"
62 exit 0
63 fi
64 fi
65 fi
66
67 # Start new event
68 event_num=$((event_num + 1))
69 cur_title="${line#<<<E>>>}"
70 cur_title=$(echo "$cur_title" | sed 's/ (Calendar)$//')
71 cur_iso_date=""
72 cur_start_time=""
73 cur_notes=""
74 in_notes=0
75 elif [[ "$line" =~ ^[[:space:]]+[0-9]{4}-[0-9]{2}-[0-9]{2}" at "[0-9]{2}:[0-9]{2} ]]; then
76 cur_iso_date=$(echo "$line" | grep -oE '[0-9]{4}-[0-9]{2}-[0-9]{2}')
77 cur_start_time=$(echo "$line" | grep -oE 'at [0-9]{2}:[0-9]{2}' | head -1 | sed 's/at //')
78 in_notes=0
79 elif [[ "$line" == *"notes:"* ]]; then
80 in_notes=1
81 cur_notes="$line"
82 elif [ "$in_notes" -eq 1 ]; then
83 cur_notes="${cur_notes} $(echo "$line" | sed 's/|/¦/g')"
84 fi
85done < "$tmpfile"
86
87# Process the last event
88if [ "$event_num" -gt 0 ] && [ -n "$cur_title" ] && [ -n "$cur_start_time" ] && [ -n "$cur_iso_date" ]; then
89 meeting_epoch=$(date -j -f "%Y-%m-%d %H:%M" "$cur_iso_date $cur_start_time" +%s 2>/dev/null)
90 if [ -n "$meeting_epoch" ]; then
91 minutes_until=$(( (meeting_epoch - now_epoch) / 60 ))
92 if [ "$minutes_until" -ge "-$MAX_IN_PROGRESS_MINUTES" ]; then
93 echo "${cur_title}|${cur_iso_date}T${cur_start_time}||${cur_notes}|${minutes_until}"
94 rm -f "$tmpfile"
95 exit 0
96 fi
97 fi
98fi
99
100rm -f "$tmpfile"
101echo ""
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 @@
1on run argv
2 set commandToRun to item 1 of argv
3 tell application "iTerm"
4 set newWindow to (create window with default profile)
5 tell current session of newWindow
6 write text commandToRun
7 end tell
8 end tell
9end 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 @@
1on run argv
2 set commandToRun to item 1 of argv
3 tell application "Terminal"
4 do script commandToRun
5 activate
6 end tell
7end 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 @@
1#! /usr/bin/env sh
2
3# make sure to fix permissions!
4# Privacy & Security > Automation > skhd > Ubersicht
5
6# Write information regarding skhd mode to a cache file for widgets to read from.
7# Usage:
8# $0 --query print location of cache file
9# $0 mode_name [color] write mode_name (and optionally, a color) to a cache file
10# default color is white.
11# by default, a mode named "default" will not be shown.
12
13CACHE_FILE="$HOME/Library/Caches/uebersicht-simple-bar-index/yabai-mode"
14
15mkdir -p "$(dirname "$CACHE_FILE")"
16touch "$CACHE_FILE"
17
18main() {
19 # optional second argument color
20 color="$2"
21 if [ -z "$color" ]; then
22 color="white"
23 fi
24
25 # update cache file
26 echo \
27 "{\"mode\": \"$1\", \"color\": \"$color\"}" \
28 > "$CACHE_FILE"
29}
30
31case "$1" in
32 --query)
33 echo "$CACHE_FILE"
34 ;;
35 *)
36 main "$@"
37 ;;
38esac
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 @@
1#! /usr/bin/env sh
2
3# make sure to fix permissions!
4# Privacy & Security > Automation > skhd > Ubersicht
5
6# Write information regarding skhd mode to a cache file for widgets to read from.
7# Usage:
8# $0 --query print location of cache file
9# $0 mode_name [color] write mode_name (and optionally, a color) to a cache file
10# default color is white.
11# by default, a mode named "default" will not be shown.
12
13CACHE_FILE="$HOME/Library/Caches/uebersicht-simple-bar-index/yabai-mode"
14
15mkdir -p "$(dirname "$CACHE_FILE")"
16touch "$CACHE_FILE"
17
18main() {
19 # optional second argument color
20 color="$2"
21 if [ -z "$color" ]; then
22 color="white"
23 fi
24
25 # update cache file
26 echo \
27 "{\"mode\": \"$1\", \"color\": \"$color\"}" \
28 > "$CACHE_FILE"
29
30 osascript -e 'tell application id "tracesOf.Uebersicht" to refresh widget id "simple-bar-index-jsx"'
31}
32
33case "$1" in
34 --query)
35 echo "$CACHE_FILE"
36 ;;
37 *)
38 main "$@"
39 ;;
40esac
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 @@
1property btnTitle : "Mute audio"
2
3if application "zoom.us" is running then
4 tell application "System Events"
5 tell application process "zoom.us"
6 if exists (menu item btnTitle of menu 1 of menu bar item "Meeting" of menu bar 1) then
7 set returnValue to "on"
8 else
9 set returnValue to "off"
10 end if
11 end tell
12 end tell
13else
14 set returnValue to ""
15end if
16
17return 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 @@
1property btnTitle : "Stop video"
2
3if application "zoom.us" is running then
4 tell application "System Events"
5 tell application process "zoom.us"
6 if exists (menu item btnTitle of menu 1 of menu bar item "Meeting" of menu bar 1) then
7 set returnValue to "on"
8 else
9 set returnValue to "off"
10 end if
11 end tell
12 end tell
13else
14 set returnValue to ""
15end if
16
17return returnValue \ No newline at end of file