blob: 6f580dbe3c44c5fc40d7ecdd3ddf3ec22cf847b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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
|