sketchybar: init
This commit is contained in:
parent
ded82a8f8b
commit
ae71080920
10 changed files with 182 additions and 96 deletions
14
stow/.config/sketchybar/plugins/aerospace.sh
Executable file
14
stow/.config/sketchybar/plugins/aerospace.sh
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# make sure it's executable with:
|
||||
# chmod +x ~/.config/sketchybar/plugins/aerospace.sh
|
||||
#
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
source $SCRIPT_DIR/../colours.sh
|
||||
|
||||
if [ "$1" = "$FOCUSED_WORKSPACE" ]; then
|
||||
# If workspace is focused
|
||||
sketchybar --set $NAME background.color=$PRIMARY_COLOUR label.color=$BACKGROUND_COLOUR
|
||||
else
|
||||
sketchybar --set $NAME background.color=$BACKGROUND_COLOUR label.color=$PRIMARY_COLOUR
|
||||
fi
|
||||
|
|
@ -12,4 +12,4 @@ else
|
|||
sketchybar --set "$NAME" label.padding_right=20
|
||||
fi
|
||||
|
||||
sketchybar --set "$NAME" label=" $(date +'%a %d %b') $(date +'%I:%M %p')"
|
||||
sketchybar --set "$NAME" label="$(date +'%l:%M %p')"
|
||||
|
|
|
|||
29
stow/.config/sketchybar/plugins/input-method.sh
Executable file
29
stow/.config/sketchybar/plugins/input-method.sh
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
#!/bin/sh
|
||||
|
||||
# from: https://apple.stackexchange.com/questions/251666/how-to-get-current-input-language-of-the-input-source
|
||||
|
||||
#!/usr/local/bin/bash
|
||||
# Checks current keyboard input source (aka language)
|
||||
|
||||
#These are the strings that MacOS uses to identify the current input source
|
||||
ENGLISH="Australian"
|
||||
HIRIGANA="com.apple.inputmethod.Japanese"
|
||||
KATANA="com.apple.inputmethod.Japanese.Katakana"
|
||||
|
||||
WESTERN_LANGUAGE=$(defaults read ~/Library/Preferences/com.apple.HIToolbox.plist AppleSelectedInputSources | grep 'KeyboardLayout Name' | sed -E 's/^.+ = \"?([^\"]+)\"?;$/\1/')
|
||||
|
||||
# If the current language is not western one, then check a different variable
|
||||
EASTERN_LANGUAGE=$(defaults read ~/Library/Preferences/com.apple.HIToolbox.plist AppleSelectedInputSources | grep -w 'Input Mode' | head -1 | sed -E 's/^.+ = \"?([^\"]+)\"?;$/\1/')
|
||||
|
||||
if [ "$WESTERN_LANGUAGE" = "$ENGLISH" ]; then
|
||||
LABEL="English"
|
||||
ICON="🇬🇧"
|
||||
elif [ "$EASTERN_LANGUAGE" = "$HIRIGANA" ]; then
|
||||
LABEL="Japanese"
|
||||
ICON="🇯🇵"
|
||||
elif [ "$EASTERN_LANGUAGE" = "$KATANA" ]; then
|
||||
LABEL="Katakana"
|
||||
ICON="🈴"
|
||||
fi
|
||||
|
||||
sketchybar --set "$NAME" label="$LABEL" icon="$ICON"
|
||||
10
stow/.config/sketchybar/plugins/music.sh
Executable file
10
stow/.config/sketchybar/plugins/music.sh
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
# sketchybar doesn't like it when the line doesn't end with a carriage return
|
||||
SONG="$(osascript -e 'tell application "Music" to if player state is playing then artist of current track & " - " & name of current track' | head -c 65 && echo '\r')"
|
||||
|
||||
if [[ "$(echo $SONG | wc -w | sed 's/ //g')" != "0" ]]; then
|
||||
sketchybar --set "$NAME" label="${SONG}" background.drawing=true icon.drawing=true
|
||||
else
|
||||
sketchybar --set "$NAME" label="" background.drawing=false icon.drawing=false
|
||||
fi
|
||||
8
stow/.config/sketchybar/plugins/wifi.sh
Executable file
8
stow/.config/sketchybar/plugins/wifi.sh
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
ping -c 1 1.1.1.1 &> /dev/null
|
||||
|
||||
if [ "$?" = "0" ]; then
|
||||
sketchybar --set $NAME icon=
|
||||
else
|
||||
sketchybar --set $NAME icon=
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue