diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-08-23 12:42:37 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-08-23 12:42:37 +0900 |
| commit | 07d294425a98ee5d1e22d03e2b24ae2c76e487c0 (patch) | |
| tree | a6818f0d64438c5fdb88b00a35d944f80c056213 /mac/.config/sketchybar/plugins | |
| parent | 6fc28cdb3529ca8ee864cb5c41674cb0a4af72a1 (diff) | |
updates
Diffstat (limited to 'mac/.config/sketchybar/plugins')
34 files changed, 0 insertions, 2349 deletions
diff --git a/mac/.config/sketchybar/plugins/battery.sh b/mac/.config/sketchybar/plugins/battery.sh deleted file mode 100644 index 60a8dc4..0000000 --- a/mac/.config/sketchybar/plugins/battery.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash - -source "$CONFIG_DIR/colors.sh" - -render_item() { - - PERCENTAGE=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1) - CHARGING=$(pmset -g batt | grep 'AC Power') - CHARGING_STATUS="Not charging" - - if [ $PERCENTAGE = "" ]; then - exit 0 - fi - - COLOR=$LABEL_COLOR - ICON="" - - case ${PERCENTAGE} in - 9[0-9]) - ICON="" - ;; - 8[0-9]) - ICON="" - ;; - 7[0-9]) - ICON="" - ;; - 6[0-9]) - ICON="" - ;; - 5[0-9]) - ICON="" - ;; - 4[0-9]) - ICON="" - ;; - 3[0-9]) - ICON="" - ;; - 2[0-9]) - ICON="" - ;; - 1[0-9]) - ICON="" - ;; - *) - ICON="" - COLOR=$RED - ;; - esac - - if [[ $CHARGING != "" ]]; then - ICON="" - CHARGING_STATUS="Charging" - COLOR=$LABEL_COLOR - fi - - sketchybar --set battery icon=$ICON - -} - -render_popup() { - sketchybar --set battery.details label="$PERCENTAGE% (${CHARGING_STATUS})" -} - -update() { - render_item - render_popup -} - -popup() { - sketchybar --set "$NAME" popup.drawing="$1" -} - -case "$SENDER" in -"routine" | "forced" | "power_source_change") - update - ;; -"mouse.entered") - popup on - ;; -"mouse.exited" | "mouse.exited.global") - popup off - ;; -esac diff --git a/mac/.config/sketchybar/plugins/brew.sh b/mac/.config/sketchybar/plugins/brew.sh deleted file mode 100644 index 308fd78..0000000 --- a/mac/.config/sketchybar/plugins/brew.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/bash - -source "$CONFIG_DIR/globalstyles.sh" - -PREV_COUNT=$(sketchybar --query brew | jq -r .popup.items | grep ".package*" -c) - -render_bar_item() { - case "$COUNT" in - [3-5][0-9]) - COLOR=$MAROON - ;; - [1-2][0-9]) - COLOR=$PEACH - ;; - [1-9]) - COLOR=$YELLOW - ;; - 0) - COLOR=$GREEN - COUNT= - ;; - esac - - sketchybar --set "$NAME" label="$COUNT" label.color="$COLOR" icon.color="$COLOR" -} - -add_outdated_header() { - brew_header=( - label="$(echo -e 'Outdated Brews')" - label.font="$FONT:Bold:14.0" - label.align=left - icon.drawing=off - click_script="sketchybar --set $NAME popup.drawing=off" - ) - - sketchybar --set brew.details "${brew_header[@]}" - -} - -render_popup() { - add_outdated_header - - COUNTER=0 - sketchybar --remove '/brew.package\.*/' - - if [[ -n "$OUTDATED" ]]; then - while IFS= read -r package; do - - brew_package=( - label="$package" - label.align=right - label.padding_left=20 - icon.drawing=off - click_script="sketchybar --set $NAME popup.drawing=off" - - ) - item=brew.package."$COUNTER" - - sketchybar --add item "$item" popup."$NAME" \ - --set "$item" "${brew_package[@]}" - - COUNTER=$((COUNTER + 1)) - - done <<<"$(echo -n "$OUTDATED" | grep '^')" - fi -} - -update() { - brew update - COLOR=$RED - OUTDATED=$(brew outdated) - COUNT=$(echo -n "$OUTDATED" | grep -c '^') - - render_bar_item - render_popup - - if [ "$COUNT" -ne "$PREV_COUNT" ] 2>/dev/null || [ "$SENDER" = "forced" ]; then - sketchybar --animate tanh 15 --set "$NAME" - fi -} - -popup() { - if [[ "$PREV_COUNT" -gt 0 ]]; then - sketchybar --set "$NAME" popup.drawing="$1" - else - sketchybar --set "$NAME" popup.drawing=off - fi - -} - -case "$SENDER" in -"routine" | "forced") - update - ;; -"mouse.entered") - popup on - ;; -"mouse.exited" | "mouse.exited.global") - popup off - ;; -"mouse.clicked") - popup toggle - ;; -esac diff --git a/mac/.config/sketchybar/plugins/disk.sh b/mac/.config/sketchybar/plugins/disk.sh deleted file mode 100644 index f2adc30..0000000 --- a/mac/.config/sketchybar/plugins/disk.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -source "$CONFIG_DIR/globalstyles.sh" - -COUNT="$(df -H | grep -E '^(/dev/disk3s5)' | awk '{ printf ("%s\n", $5) }' | sed 's/%//')" - -COLOR=$RED - -case "$COUNT" in -[7-8][0-9]) # 70-89% - COLOR=$PEACH - ;; -[5-6][0-9]) # 50-69% - COLOR=$YELLOW - ;; -[3-4][0-9]) # 20-49% - COLOR=$GREEN - ;; -[1-2][0-9]) # 10-19% - COLOR=$LAVENDER - ;; -[0-9]) # 0-9% - COLOR=$WHITE - ;; -esac - -sketchybar -m --set "$NAME" \ - label="$COUNT%" \ - icon.color=$COLOR diff --git a/mac/.config/sketchybar/plugins/dnd.sh b/mac/.config/sketchybar/plugins/dnd.sh deleted file mode 100644 index 42c7ba6..0000000 --- a/mac/.config/sketchybar/plugins/dnd.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -# Load global styles, colors and icons -source "$CONFIG_DIR/globalstyles.sh" - -update() { - dnd_enabled=$(cat ~/Library/DoNotDisturb/DB/Assertions.json | jq .data[0].storeAssertionRecords) - # alternate method: defaults read com.apple.controlcenter "NSStatusItem Visible FocusModes" - ICON= - - if [ "$dnd_enabled" = "null" ]; then - COLOR=$WHITE_25 - # echo $NAME: "Disabled" - else - COLOR=$WHITE - # echo $NAME: "Enabled" - fi - - sketchybar --set $NAME icon=$ICON icon.color=$COLOR -} - -toggle() { - osascript -e 'tell application "System Events" to keystroke "\\" using {control down, shift down, command down, option down}' -} - -case "$SENDER" in -"routine" | "forced" | "focus_on" | "focus_off") - update - ;; -"mouse.clicked") - toggle - ;; -esac diff --git a/mac/.config/sketchybar/plugins/dndindicator.sh b/mac/.config/sketchybar/plugins/dndindicator.sh deleted file mode 100644 index 0dd05e8..0000000 --- a/mac/.config/sketchybar/plugins/dndindicator.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -# Thanks to reddit:rudypaul -# BIN_DIR="/usr/bin" - -# PLUTIL="${BIN_DIR}/plutil" -# XPATH="${BIN_DIR}/xpath" -# BASE64="${BIN_DIR}/base64" - -dnd_enabled=$( -defaults read com.apple.controlcenter "NSStatusItem Visible FocusModes" -# dnd_enabled=$( -# "${PLUTIL}" -extract dnd_prefs xml1 -o - ~/Library/Preferences/com.apple.ncprefs.plist | -# "${XPATH}" -q -e 'string(//data)' | -# "${BASE64}" -D | -# "${PLUTIL}" -convert xml1 - -o - | -# "${XPATH}" -q -e 'boolean(//key[text()="userPref"]/following-sibling::dict/key[text()="enabled"])' -) - -if [ $dnd_enabled -eq 1 ]; then - sketchybar --set $NAME drawing=on icon= -else - sketchybar --set $NAME drawing=off icon= -fi
\ No newline at end of file diff --git a/mac/.config/sketchybar/plugins/front_app.sh b/mac/.config/sketchybar/plugins/front_app.sh deleted file mode 100644 index 066efb0..0000000 --- a/mac/.config/sketchybar/plugins/front_app.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -if [ "$SENDER" = "front_app_switched" ]; then - # Set the app name and app icon and then animate a bounce for the icon size - sketchybar --set $NAME label="$INFO" icon.background.image="app.$INFO" \ - --animate tanh 10 --set $NAME icon.background.image.scale=0.8 \ - icon.background.image.scale=0.55 -fi diff --git a/mac/.config/sketchybar/plugins/github.sh b/mac/.config/sketchybar/plugins/github.sh deleted file mode 100644 index bf09991..0000000 --- a/mac/.config/sketchybar/plugins/github.sh +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/bash - -update() { - source "$CONFIG_DIR/colors.sh" - source "$CONFIG_DIR/icons.sh" - - NOTIFICATIONS="$(gh api notifications)" - COUNT="$(echo "$NOTIFICATIONS" | jq 'length')" - args=() - if [ "$NOTIFICATIONS" = "[]" ]; then - args+=(--set $NAME icon=$BELL label="0") - else - args+=(--set $NAME icon=$BELL_DOT label="$COUNT") - fi - - PREV_COUNT=$(sketchybar --query github.bell | jq -r .label.value) - # For sound to play around with: - # afplay /System/Library/Sounds/Morse.aiff - - args+=(--remove '/github.notification\.*/') - - COUNTER=0 - COLOR=$BLUE - args+=(--set github.bell icon.color=$COLOR) - - while read -r repo url type title; do - COUNTER=$((COUNTER + 1)) - IMPORTANT="$(echo "$title" | egrep -i "(deprecat|break|broke)")" - COLOR=$BLUE - PADDING=0 - - if [ "${repo}" = "" ] && [ "${title}" = "" ]; then - repo="Note" - title="No new notifications" - fi - case "${type}" in - "'Issue'") - COLOR=$GREEN - ICON=$GIT_ISSUE - URL="$(gh api "$(echo "${url}" | sed -e "s/^'//" -e "s/'$//")" | jq .html_url)" - ;; - "'Discussion'") - COLOR=$WHITE - ICON=$GIT_DISCUSSION - URL="https://www.github.com/notifications" - ;; - "'PullRequest'") - COLOR=$MAGENTA - ICON=$GIT_PULL_REQUEST - URL="$(gh api "$(echo "${url}" | sed -e "s/^'//" -e "s/'$//")" | jq .html_url)" - ;; - "'Commit'") - COLOR=$WHITE - ICON=$GIT_COMMIT - URL="$(gh api "$(echo "${url}" | sed -e "s/^'//" -e "s/'$//")" | jq .html_url)" - ;; - esac - - if [ "$IMPORTANT" != "" ]; then - COLOR=$RED - ICON= - args+=(--set github.bell icon.color=$COLOR) - fi - - notification=( - label="$(echo "$title" | sed -e "s/^'//" -e "s/'$//")" - icon="$ICON $(echo "$repo" | sed -e "s/^'//" -e "s/'$//"):" - icon.padding_left="$PADDING" - label.padding_right="$PADDING" - icon.color=$COLOR - position=popup.github.bell - icon.background.color=$COLOR - drawing=on - click_script="open \"$URL\"; sketchybar --set github.bell popup.drawing=off; sleep 5; sketchybar --trigger github.update" - ) - - args+=(--clone github.notification.$COUNTER github.template - --set github.notification.$COUNTER "${notification[@]}") - done <<<"$(echo "$NOTIFICATIONS" | jq -r '.[] | [.repository.name, .subject.latest_comment_url, .subject.type, .subject.title] | @sh')" - - sketchybar -m "${args[@]}" >/dev/null - - if [ $COUNT -gt $PREV_COUNT ] 2>/dev/null || [ "$SENDER" = "forced" ]; then - sketchybar --animate tanh 15 --set github.bell label.y_offset=5 label.y_offset=0 - fi -} - -popup() { - sketchybar --set $NAME popup.drawing=$1 -} - -case "$SENDER" in -"routine" | "forced" | "github.update") - update - ;; -"system_woke") - sleep 10 && update # Wait for network to connect - ;; -"mouse.entered") - popup on - ;; -"mouse.exited" | "mouse.exited.global") - popup off - ;; -"mouse.clicked") - popup toggle - ;; -esac diff --git a/mac/.config/sketchybar/plugins/icon_map.sh b/mac/.config/sketchybar/plugins/icon_map.sh deleted file mode 100644 index 1b2f82a..0000000 --- a/mac/.config/sketchybar/plugins/icon_map.sh +++ /dev/null @@ -1,486 +0,0 @@ -#!/bin/bash - -function icon_map() { - case "$1" in - "Typora") - icon_result=":text:" - ;; - "Orion" | "Orion RC") - icon_result=":orion:" - ;; - "Grammarly Editor") - icon_result=":grammarly:" - ;; - "kitty") - icon_result=":kitty:" - ;; - "ClickUp") - icon_result=":click_up:" - ;; - "Iris") - icon_result=":iris:" - ;; - "PomoDone App") - icon_result=":pomodone:" - ;; - "qutebrowser") - icon_result=":qute_browser:" - ;; - "Raindrop.io") - icon_result=":raindrop_io:" - ;; - "Airmail") - icon_result=":airmail:" - ;; - "Affinity Publisher 2") - icon_result=":affinity_publisher_2:" - ;; - "Calendar" | "日历" | "Fantastical" | "Cron" | "Amie") - icon_result=":calendar:" - ;; - "Figma") - icon_result=":figma:" - ;; - "Element") - icon_result=":element:" - ;; - "Signal") - icon_result=":signal:" - ;; - "Mattermost") - icon_result=":mattermost:" - ;; - "Caprine") - icon_result=":caprine:" - ;; - "Microsoft To Do" | "Things") - icon_result=":things:" - ;; - "Godot") - icon_result=":godot:" - ;; - "Android Messages") - icon_result=":android_messages:" - ;; - "Zed") - icon_result=":zed:" - ;; - "Anytype") - icon_result=":anytype:" - ;; - "TeamSpeak 3") - icon_result=":team_speak:" - ;; - "LibreWolf") - icon_result=":libre_wolf:" - ;; - "Neovide" | "neovide") - icon_result=":neovide:" - ;; - "Spotlight") - icon_result=":spotlight:" - ;; - "微信") - icon_result=":wechat:" - ;; - "Dropbox") - icon_result=":dropbox:" - ;; - "Transmit") - icon_result=":transmit:" - ;; - "TickTick") - icon_result=":tick_tick:" - ;; - "Parallels Desktop") - icon_result=":parallels:" - ;; - "Audacity") - icon_result=":audacity:" - ;; - "Rider" | "JetBrains Rider") - icon_result=":rider:" - ;; - "DEVONthink 3") - icon_result=":devonthink3:" - ;; - "Docker" | "Docker Desktop") - icon_result=":docker:" - ;; - "Matlab") - icon_result=":matlab:" - ;; - "VLC") - icon_result=":vlc:" - ;; - "Alacritty") - icon_result=":alacritty:" - ;; - "Pages" | "Pages 文稿") - icon_result=":pages:" - ;; - "Bear") - icon_result=":bear:" - ;; - "Pine") - icon_result=":pine:" - ;; - "Affinity Designer 2") - icon_result=":affinity_designer_2:" - ;; - "Keyboard Maestro") - icon_result=":keyboard_maestro:" - ;; - "Joplin") - icon_result=":joplin:" - ;; - "mpv") - icon_result=":mpv:" - ;; - "zoom.us") - icon_result=":zoom:" - ;; - "Affinity Photo 2") - icon_result=":affinity_photo_2:" - ;; - "Music" | "音乐") - icon_result=":music:" - ;; - "League of Legends") - icon_result=":league_of_legends:" - ;; - "Tor Browser") - icon_result=":tor_browser:" - ;; - "Hyper") - icon_result=":hyper:" - ;; - "WhatsApp") - icon_result=":whats_app:" - ;; - "카카오톡") - icon_result=":kakaotalk:" - ;; - "Discord" | "Discord Canary" | "Discord PTB") - icon_result=":discord:" - ;; - "Neovide" | "MacVim" | "Vim" | "VimR") - icon_result=":vim:" - ;; - "Keynote" | "Keynote 讲演") - icon_result=":keynote:" - ;; - "iTerm") - icon_result=":iterm:" - ;; - "IntelliJ IDEA") - icon_result=":idea:" - ;; - "Finder" | "访达") - icon_result=":finder:" - ;; - "Xcode") - icon_result=":xcode:" - ;; - "GoLand") - icon_result=":goland:" - ;; - "Android Studio") - icon_result=":android_studio:" - ;; - "MoneyMoney") - icon_result=":bank:" - ;; - "Spotify") - icon_result=":spotify:" - ;; - "KeePassXC") - icon_result=":kee_pass_x_c:" - ;; - "Alfred") - icon_result=":alfred:" - ;; - "Color Picker" | "数码测色计") - icon_result=":color_picker:" - ;; - "Microsoft Word") - icon_result=":microsoft_word:" - ;; - "Microsoft PowerPoint") - icon_result=":microsoft_power_point:" - ;; - "Notes" | "备忘录") - icon_result=":notes:" - ;; - "Microsoft Edge") - icon_result=":microsoft_edge:" - ;; - "Sublime Text") - icon_result=":sublime_text:" - ;; - "Sequel Ace") - icon_result=":sequel_ace:" - ;; - "Folx") - icon_result=":folx:" - ;; - "DingTalk" | "钉钉" | "阿里钉") - icon_result=":dingtalk:" - ;; - "WebStorm") - icon_result=":web_storm:" - ;; - "Sequel Pro") - icon_result=":sequel_pro:" - ;; - "Skype") - icon_result=":skype:" - ;; - "网易云音乐") - icon_result=":netease_music:" - ;; - "PyCharm") - icon_result=":pycharm:" - ;; - "Canary Mail" | "HEY" | "Mail" | "Mailspring" | "MailMate" | "邮件") - icon_result=":mail:" - ;; - "Default") - icon_result=":default:" - ;; - "App Store") - icon_result=":app_store:" - ;; - "Calibre") - icon_result=":book:" - ;; - "Todoist") - icon_result=":todoist:" - ;; - "Emacs") - icon_result=":emacs:" - ;; - "Messenger") - icon_result=":messenger:" - ;; - "Tower") - icon_result=":tower:" - ;; - "VSCodium") - icon_result=":vscodium:" - ;; - "Drafts") - icon_result=":drafts:" - ;; - "Cypress") - icon_result=":cypress:" - ;; - "GitHub Desktop") - icon_result=":git_hub:" - ;; - "Telegram") - icon_result=":telegram:" - ;; - "Firefox Developer Edition" | "Firefox Nightly") - icon_result=":firefox_developer_edition:" - ;; - "Min") - icon_result=":min_browser:" - ;; - "Sketch") - icon_result=":sketch:" - ;; - "Affinity Photo") - icon_result=":affinity_photo:" - ;; - "MAMP" | "MAMP PRO") - icon_result=":mamp:" - ;; - "Insomnia") - icon_result=":insomnia:" - ;; - "Bitwarden") - icon_result=":bit_warden:" - ;; - "Warp") - icon_result=":warp:" - ;; - "System Preferences" | "System Settings" | "系统设置") - icon_result=":gear:" - ;; - "Affinity Designer") - icon_result=":affinity_designer:" - ;; - "Live") - icon_result=":ableton:" - ;; - "Arc") - icon_result=":arc:" - ;; - "Chromium" | "Google Chrome" | "Google Chrome Canary") - icon_result=":google_chrome:" - ;; - "Jellyfin Media Player") - icon_result=":jellyfin:" - ;; - "Zulip") - icon_result=":zulip:" - ;; - "1Password") - icon_result=":one_password:" - ;; - "FaceTime" | "FaceTime 通话") - icon_result=":face_time:" - ;; - "Citrix Workspace" | "Citrix Viewer") - icon_result=":citrix:" - ;; - "Logseq") - icon_result=":logseq:" - ;; - "Reeder") - icon_result=":reeder5:" - ;; - "Code" | "Code - Insiders") - icon_result=":code:" - ;; - "Notion") - icon_result=":notion:" - ;; - "Final Cut Pro") - icon_result=":final_cut_pro:" - ;; - "Zotero") - icon_result=":zotero:" - ;; - "Safari" | "Safari浏览器" | "Safari Technology Preview") - icon_result=":safari:" - ;; - "Blender") - icon_result=":blender:" - ;; - "Affinity Publisher") - icon_result=":affinity_publisher:" - ;; - "Spark Desktop") - icon_result=":spark:" - ;; - "Zeplin") - icon_result=":zeplin:" - ;; - "Replit") - icon_result=":replit:" - ;; - "Podcasts" | "播客") - icon_result=":podcasts:" - ;; - "NordVPN") - icon_result=":nord_vpn:" - ;; - "Notability") - icon_result=":notability:" - ;; - "Numbers" | "Numbers 表格") - icon_result=":numbers:" - ;; - "Nova") - icon_result=":nova:" - ;; - "Microsoft Excel") - icon_result=":microsoft_excel:" - ;; - "Trello") - icon_result=":trello:" - ;; - "Pi-hole Remote") - icon_result=":pihole:" - ;; - "Linear") - icon_result=":linear:" - ;; - "CleanMyMac X") - icon_result=":desktop:" - ;; - "GrandTotal" | "Receipts") - icon_result=":dollar:" - ;; - "Evernote Legacy") - icon_result=":evernote_legacy:" - ;; - "OmniFocus") - icon_result=":omni_focus:" - ;; - "Terminal" | "终端") - icon_result=":terminal:" - ;; - "Atom") - icon_result=":atom:" - ;; - "Kakoune") - icon_result=":kakoune:" - ;; - "Reminders" | "提醒事项") - icon_result=":reminders:" - ;; - "Tana") - icon_result=":tana:" - ;; - "OBS") - icon_result=":obsstudio:" - ;; - "VMware Fusion") - icon_result=":vmware_fusion:" - ;; - "Tweetbot" | "Twitter") - icon_result=":twitter:" - ;; - "Microsoft Teams") - icon_result=":microsoft_teams:" - ;; - "Yuque" | "语雀") - icon_result=":yuque:" - ;; - "Slack") - icon_result=":slack:" - ;; - "Vivaldi") - icon_result=":vivaldi:" - ;; - "Setapp") - icon_result=":setapp:" - ;; - "TIDAL") - icon_result=":tidal:" - ;; - "Miro") - icon_result=":miro:" - ;; - "Messages" | "信息" | "Nachrichten") - icon_result=":messages:" - ;; - "Brave Browser") - icon_result=":brave_browser:" - ;; - "Preview" | "预览" | "Skim" | "zathura") - icon_result=":pdf:" - ;; - "Obsidian") - icon_result=":obsidian:" - ;; - "Thunderbird") - icon_result=":thunderbird:" - ;; - "Firefox") - icon_result=":firefox:" - ;; - "WezTerm") - icon_result=":wezterm:" - ;; - *) - icon_result=":default:" - ;; - esac -} - -icon_map "$1" -echo "$icon_result" diff --git a/mac/.config/sketchybar/plugins/kakaotalk.sh b/mac/.config/sketchybar/plugins/kakaotalk.sh deleted file mode 100644 index e959621..0000000 --- a/mac/.config/sketchybar/plugins/kakaotalk.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -TEXT=$(lsappinfo info -only StatusLabel "KakaoTalk" | grep -o '"label"="[0-9]*"' | awk -F'"' '{print $4}') - -if [[ $TEXT -gt 0 ]]; then - sketchybar -m --set $NAME drawing=on label="$TEXT" -else - sketchybar -m --set $NAME drawing=off -fi diff --git a/mac/.config/sketchybar/plugins/keyboard.sh b/mac/.config/sketchybar/plugins/keyboard.sh deleted file mode 100644 index c6b5681..0000000 --- a/mac/.config/sketchybar/plugins/keyboard.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -# this is jank and ugly, I know -LAYOUT="$(defaults read ~/Library/Preferences/com.apple.HIToolbox.plist AppleSelectedInputSources | grep "KeyboardLayout Name" | cut -c 33- | rev | cut -c 2- | rev)" - -# specify short layouts individually. -case "$LAYOUT" in -"\"Dvorak\"") SHORT_LAYOUT="DV" ;; -"\"U.S.\"") SHORT_LAYOUT="US" ;; -*) SHORT_LAYOUT="한" ;; -esac - -sketchybar --set keyboard label="$SHORT_LAYOUT" diff --git a/mac/.config/sketchybar/plugins/mail.sh b/mac/.config/sketchybar/plugins/mail.sh deleted file mode 100644 index 6a74b07..0000000 --- a/mac/.config/sketchybar/plugins/mail.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -TEXT=$(lsappinfo info -only StatusLabel "Mail" | grep -o '"label"="[0-9]*"' | awk -F'"' '{print $4}') - -if [[ $TEXT -gt 0 ]]; then - sketchybar -m --set $NAME drawing=on label="$TEXT" -else - sketchybar -m --set $NAME drawing=off -fi
\ No newline at end of file diff --git a/mac/.config/sketchybar/plugins/memory.sh b/mac/.config/sketchybar/plugins/memory.sh deleted file mode 100644 index 6917458..0000000 --- a/mac/.config/sketchybar/plugins/memory.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -source "$CONFIG_DIR/globalstyles.sh" - -# Get total physical memory in bytes -total_memory=$(sysctl -n hw.memsize) - -# Get memory page size in bytes -page_size=$(vm_stat | grep "page size of" | awk '{print $8}' | sed 's/\.$//') # Correctly strip the period at the end - -# Get various memory statistics from vm_stat -vm_stat=$(vm_stat) -pages_free=$(echo "$vm_stat" | grep "Pages free:" | awk '{print $3}' | sed 's/\.$//') # Remove dot at the end -pages_active=$(echo "$vm_stat" | grep "Pages active:" | awk '{print $3}' | sed 's/\.$//') -pages_inactive=$(echo "$vm_stat" | grep "Pages inactive:" | awk '{print $3}' | sed 's/\.$//') -pages_speculative=$(echo "$vm_stat" | grep "Pages speculative:" | awk '{print $3}' | sed 's/\.$//') -pages_wired_down=$(echo "$vm_stat" | grep "Pages wired down:" | awk '{print $4}' | sed 's/\.$//') -compressed_pages=$(echo "$vm_stat" | grep "Pages occupied by compressor:" | awk '{print $5}' | sed 's/\.$//') - -# Calculate total used memory pages -total_used_pages=$((pages_active + pages_wired_down + compressed_pages)) - -# Convert pages to bytes -total_used_memory_bytes=$((total_used_pages * page_size)) - -# Calculate memory used percentage as an integer -USAGE=$((total_used_memory_bytes * 100 / total_memory)) -COUNT="$(memory_pressure | grep "System-wide memory free percentage:" | awk '{ val = 100 - $5; if (val < 10) printf("%1.0f\n", val); else printf("%02.0f\n", val) }')" - -COLOR=$RED - -case "$COUNT" in -[5-6][0-9]) # 50-69% - COLOR=$YELLOW - ;; -[3-4][0-9]) # 20-49% - COLOR=$GREEN - ;; -[1-2][0-9]) # 10-19% - COLOR=$LAVENDER - ;; -[0-9]) # 0-9% - COLOR=$WHITE - ;; -esac - -sketchybar -m --set "$NAME" \ - label="$COUNT / $USAGE%" \ - icon.color=$COLOR diff --git a/mac/.config/sketchybar/plugins/messages.sh b/mac/.config/sketchybar/plugins/messages.sh deleted file mode 100644 index 1ca1ec1..0000000 --- a/mac/.config/sketchybar/plugins/messages.sh +++ /dev/null @@ -1,7 +0,0 @@ -TEXT=$(sqlite3 ~/Library/Messages/chat.db "SELECT text FROM message WHERE is_read=0 AND is_from_me=0 AND text!='' AND date_read=0" | wc -l | awk '{$1=$1};1') - -if [ $TEXT = 0 ]; then - sketchybar -m --set $NAME drawing=off -else - sketchybar -m --set $NAME drawing=on label="$TEXT" -fi
\ No newline at end of file diff --git a/mac/.config/sketchybar/plugins/mic.sh b/mac/.config/sketchybar/plugins/mic.sh deleted file mode 100644 index 35cde89..0000000 --- a/mac/.config/sketchybar/plugins/mic.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -MIC_VOLUME=$(osascript -e 'input volume of (get volume settings)') - -if [[ $MIC_VOLUME -eq 0 ]]; then - sketchybar -m --set mic icon= -elif [[ $MIC_VOLUME -gt 0 ]]; then - sketchybar -m --set mic icon= -fi diff --git a/mac/.config/sketchybar/plugins/mic_click.sh b/mac/.config/sketchybar/plugins/mic_click.sh deleted file mode 100644 index 90a6ac6..0000000 --- a/mac/.config/sketchybar/plugins/mic_click.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -MIC_VOLUME=$(osascript -e 'input volume of (get volume settings)') - -if [[ $MIC_VOLUME -eq 0 ]]; then - osascript -e 'set volume input volume 25' - sketchybar -m --set mic icon= -elif [[ $MIC_VOLUME -gt 0 ]]; then - osascript -e 'set volume input volume 0' - sketchybar -m --set mic icon= -fi diff --git a/mac/.config/sketchybar/plugins/music.sh b/mac/.config/sketchybar/plugins/music.sh deleted file mode 100644 index ce23701..0000000 --- a/mac/.config/sketchybar/plugins/music.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/sh - -# Load global styles, colors and icons -source "$CONFIG_DIR/globalstyles.sh" - -music_item_defaults=( - align=center - width=240 - label.max_chars=33 -) - -music_cover=( - background.image=media.artwork - background.image.scale=5 - background.image.corner_radius=4 - background.image.padding_left=$PADDINGS - background.image.padding_right=$PADDINGS - background.label.align=center - y_offset=-$PADDINGS - align=center -) - -music_artist=( - "${music_item_defaults[@]}" -) - -music_title=( - "${music_item_defaults[@]}" - label.font.style="Bold" -) - -music_album=( - "${music_item_defaults[@]}" -) - -render_bar_item() { - sketchybar --set $NAME label="$CURRENT_ARTIST: $CURRENT_SONG" -} - -render_popup() { - sketchybar --set $NAME.cover "${music_cover[@]}" \ - --set $NAME.artist "${music_artist[@]}" \ - --set $NAME.title "${music_title[@]}" \ - --set $NAME.album "${music_album[@]}" -} - -update() { - CURRENT_ARTIST="$(echo "$INFO" | jq -r '.artist')" - CURRENT_SONG="$(echo "$INFO" | jq -r '.title')" - CURRENT_ALBUM="$(echo "$INFO" | jq -r '.album')" - PLAYER_STATE="$(echo "$INFO" | jq -r '.state')" - - if [ "$PLAYER_STATE" = "playing" ]; then - sketchybar --set $NAME drawing=on \ - icon= \ - --set $NAME.artist label="$CURRENT_ARTIST" \ - --set $NAME.title label="$CURRENT_SONG" \ - --set $NAME.album label="$CURRENT_ALBUM" - render_bar_item - render_popup - - else - sketchybar --set $NAME icon= - popup off - sketchybar --set $NAME drawing=off - fi - -} - -popup() { - sketchybar --set "$NAME" popup.drawing="$1" -} - -playpause() { - osascript -e 'tell application "Music" to playpause' -} - - -case "$SENDER" in -"routine" | "forced" | "media_change") - update - ;; -"mouse.entered") - popup on - ;; -"mouse.exited" | "mouse.exited.global") - popup off - ;; -"mouse.clicked") - playpause - ;; -esac diff --git a/mac/.config/sketchybar/plugins/music/Cover-Default.png b/mac/.config/sketchybar/plugins/music/Cover-Default.png Binary files differdeleted file mode 100644 index a65c63f..0000000 --- a/mac/.config/sketchybar/plugins/music/Cover-Default.png +++ /dev/null diff --git a/mac/.config/sketchybar/plugins/music/Get-Artwork.applescript b/mac/.config/sketchybar/plugins/music/Get-Artwork.applescript deleted file mode 100644 index ca3ee31..0000000 --- a/mac/.config/sketchybar/plugins/music/Get-Artwork.applescript +++ /dev/null @@ -1,65 +0,0 @@ ---get current path -tell application "Finder" to set current_path to container of (path to me) as alias - ---get artwork -tell application "Music" - try - if player state is not stopped then - set alb to (get album of current track) - tell artwork 1 of current track - if format is JPEG picture then - set imgFormat to ".jpg" - else - set imgFormat to ".png" - end if - end tell - set rawData to (get raw data of artwork 1 of current track) - else - return - end if - on error - return POSIX path of ((current_path as text) & "Cover-Default.png") - return - end try -end tell - ---create path to save image as jpg or png -set newPath to ((current_path as text) & "tmp" & imgFormat) as text - -try - --create file - tell me to set fileRef to (open for access newPath with write permission) - --overwrite existing file - write rawData to fileRef starting at 0 - tell me to close access fileRef - - delay 1 - - --resize image - set the target_length to 500 - try - tell application "Image Events" - -- start the Image Events application - launch - -- open the image file - set this_image to open newPath - -- perform action - scale this_image to size target_length - -- save the changes - save this_image with icon - -- purge the open image data - close this_image - end tell - on error - return POSIX path of ((current_path as text) & "Cover-Default.png") - end try - - return POSIX path of newPath -on error m number n - log n - log m - try - tell me to close access fileRef - end try - return ((current_path as text) & "Cover-Default.png") as text -end try
\ No newline at end of file diff --git a/mac/.config/sketchybar/plugins/network.sh b/mac/.config/sketchybar/plugins/network.sh deleted file mode 100644 index 99fda23..0000000 --- a/mac/.config/sketchybar/plugins/network.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -source "$CONFIG_DIR/colors.sh" # Loads all defined colors -source "$CONFIG_DIR/icons.sh" # Loads all defined icons - -UPDOWN=$(ifstat -i "en0" -b 0.1 1 | tail -n1) -DOWN=$(echo "$UPDOWN" | awk "{ print \$1 }" | cut -f1 -d ".") -UP=$(echo "$UPDOWN" | awk "{ print \$2 }" | cut -f1 -d ".") - -DOWN_FORMAT="" -if [ "$DOWN" -gt "999" ]; then - DOWN_FORMAT=$(echo "$DOWN" | awk '{ printf "%03.0f Mbps", $1 / 1000}') -else - DOWN_FORMAT=$(echo "$DOWN" | awk '{ printf "%03.0f kbps", $1}') -fi - -UP_FORMAT="" -if [ "$UP" -gt "999" ]; then - UP_FORMAT=$(echo "$UP" | awk '{ printf "%03.0f Mbps", $1 / 1000}') -else - UP_FORMAT=$(echo "$UP" | awk '{ printf "%03.0f kbps", $1}') -fi - -sketchybar -m --set network.down label="$DOWN_FORMAT" icon.highlight=$(if [ "$DOWN" -gt "0" ]; then echo "on"; else echo "off"; fi) \ - --set network.up label="$UP_FORMAT" icon.highlight=$(if [ "$UP" -gt "0" ]; then echo "on"; else echo "off"; fi) diff --git a/mac/.config/sketchybar/plugins/nextevent.applescript b/mac/.config/sketchybar/plugins/nextevent.applescript deleted file mode 100644 index 6ffc56a..0000000 --- a/mac/.config/sketchybar/plugins/nextevent.applescript +++ /dev/null @@ -1,19 +0,0 @@ -set input to paragraphs of (do shell script "/opt/homebrew/bin/icalBuddy -ec 'Found in Natural Language,CCSF' -npn -nc -iep 'datetime,title' -po 'datetime,title' -eed -ea -n -li 4 -ps '|: |' -b '' eventsToday") - -set currentTime to date (do shell script "date '+%I:%M %p'") - -set theEvent to "" - -if input is not "" then - repeat with anEvent in input - set text item delimiters to "^" - set eventTime to date (text item 1 of anEvent) - set text item delimiters to "" - if eventTime > currentTime then - set theEvent to anEvent as string - exit repeat - end if - end repeat -end if - -return theEvent
\ No newline at end of file diff --git a/mac/.config/sketchybar/plugins/nextevent.sh b/mac/.config/sketchybar/plugins/nextevent.sh deleted file mode 100644 index 732629a..0000000 --- a/mac/.config/sketchybar/plugins/nextevent.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env bash - -render_item() { - sketchybar --set $NAME label="$(date "+%I:%M %p")" -} - -render_popup() { - - if which "icalBuddy" &>/dev/null; then - input=$(/opt/homebrew/bin/icalBuddy -ec 'Found in Natural Language,CCSF' -npn -nc -iep 'datetime,title' -po 'datetime,title' -eed -ea -n -li 4 -ps '|: |' -b '' eventsToday) - currentTime=$(date '+%I:%M %p') - - # echo "Debug: $NAME #11 $input" - - if [ -n "$input" ]; then - IFS='^' read -ra events <<< "$input" - for anEvent in "${events[@]}"; do - IFS='^' read -ra eventItems <<< "$anEvent" - eventTime=${eventItems[0]} - if [ "$eventTime" '>' "$currentTime" ]; then - theEvent="$anEvent" - break - fi - done - else - theEvent="No events today" - fi - else - theEvent="Please install icalBuddy → brew install ical-buddy." - fi - - - sketchybar --set clock.details label="$theEvent" click_script="sketchybar --set $NAME popup.drawing=off" >/dev/null -} - -update() { - render_item -} - -popup() { - render_popup - sketchybar --set "$NAME" popup.drawing="$1" -} - -case "$SENDER" in -"routine" | "forced") - update - ;; -"mouse.entered") - popup on - ;; -"mouse.exited" | "mouse.exited.global") - popup off - ;; -esac
\ No newline at end of file diff --git a/mac/.config/sketchybar/plugins/space.py b/mac/.config/sketchybar/plugins/space.py deleted file mode 100644 index 7ed3e55..0000000 --- a/mac/.config/sketchybar/plugins/space.py +++ /dev/null @@ -1,199 +0,0 @@ -#!/usr/bin/python3 - -import os, json, re - -ICON_MAP = [ - {"regex": r"1Password", "icon": ":one_password:"}, - {"regex": r"Affinity Designer", "icon": ":affinity_designer:"}, - {"regex": r"Affinity Photo", "icon": ":affinity_photo:"}, - {"regex": r"Affinity Publisher", "icon": ":affinity_publisher:"}, - {"regex": r"Airmail", "icon": ":airmail:"}, - {"regex": r"Alacritty|Hyper|iTerm2|kitty|Terminal|WezTerm", "icon": ":terminal:"}, - {"regex": r"Alfred", "icon": ":alfred:"}, - {"regex": r"Android Messages", "icon": ":android_messages:"}, - {"regex": r"Android Studio", "icon": ":android_studio:"}, - {"regex": r"App Store", "icon": ":app_store:"}, - {"regex": r"Atom", "icon": ":atom:"}, - {"regex": r"Audacity", "icon": ":audacity:"}, - {"regex": r"Bear", "icon": ":bear:"}, - {"regex": r"Bitwarden", "icon": ":bit_warden:"}, - {"regex": r"Blender", "icon": ":blender:"}, - {"regex": r"Brave Browser", "icon": ":brave_browser:"}, - {"regex": r"Calendar|Fantastical|Cron|Morgen", "icon": ":calendar:"}, - {"regex": r"Calibre", "icon": ":book:"}, - { - "regex": r"Canary Mail|HEY|Mail|Mailspring|MailMate|邮件|Outlook|Gmail|Mimestream", - "icon": ":mail:", - }, - {"regex": r"Caprine", "icon": ":caprine:"}, - { - "regex": r"Chromium|Google Chrome|Google Chrome Canary", - "icon": ":google_chrome:", - }, - {"regex": r"CleanMyMac X", "icon": ":desktop:"}, - {"regex": r"ClickUp", "icon": ":click_up:"}, - {"regex": r"Code|Code - Insiders", "icon": ":code:"}, - {"regex": r"Color Picker", "icon": ":color_picker:"}, - {"regex": r"DataGrip", "icon": ":datagrip:"}, - {"regex": r"Default", "icon": ":default:"}, - {"regex": r"DEVONthink 3", "icon": ":devonthink3:"}, - {"regex": r"Discord|Discord Canary|Discord PTB", "icon": ":discord:"}, - {"regex": r"Drafts", "icon": ":drafts:"}, - {"regex": r"Dropbox", "icon": ":dropbox:"}, - {"regex": r"Element", "icon": ":element:"}, - {"regex": r"Emacs", "icon": ":emacs:"}, - {"regex": r"Evernote Legacy", "icon": ":evernote_legacy:"}, - {"regex": r"FaceTime", "icon": ":face_time:"}, - {"regex": r"Figma", "icon": ":figma:"}, - {"regex": r"Final Cut Pro", "icon": ":final_cut_pro:"}, - {"regex": r"Finder|访达", "icon": ":finder:"}, - { - "regex": r"Firefox Developer Edition|Firefox Nightly", - "icon": ":firefox_developer_edition:", - }, - {"regex": r"Firefox", "icon": ":firefox:"}, - {"regex": r"Folx", "icon": ":folx:"}, - {"regex": r"GitHub Desktop", "icon": ":git_hub:"}, - {"regex": r"Grammarly Editor", "icon": ":grammarly:"}, - {"regex": r"GrandTotal|Receipts", "icon": ":dollar:"}, - {"regex": r"IINA", "icon": ":playing:"}, - {"regex": r"Insomnia", "icon": ":insomnia:"}, - {"regex": r"IntelliJ IDEA", "icon": ":idea:"}, - {"regex": r"Iris", "icon": ":iris:"}, - {"regex": r"Joplin", "icon": ":joplin:"}, - {"regex": r"Kakoune", "icon": ":kakoune:"}, - {"regex": r"KeePassXC", "icon": ":kee_pass_x_c:"}, - {"regex": r"Keyboard Maestro", "icon": ":keyboard_maestro:"}, - {"regex": r"Keynote", "icon": ":keynote:"}, - {"regex": r"League of Legends", "icon": ":league_of_legends:"}, - {"regex": r"LibreWolf", "icon": ":libre_wolf:"}, - {"regex": r"Linear", "icon": ":linear:"}, - {"regex": r"Live", "icon": ":ableton:"}, - {"regex": r"MAMP|MAMP PRO", "icon": ":mamp:"}, - {"regex": r"Matlab", "icon": ":matlab:"}, - {"regex": r"Mattermost", "icon": ":mattermost:"}, - {"regex": r"Messages|Nachrichten", "icon": ":messages:"}, - {"regex": r"Microsoft Edge", "icon": ":microsoft_edge:"}, - {"regex": r"Microsoft Excel", "icon": ":microsoft_excel:"}, - {"regex": r"Microsoft PowerPoint", "icon": ":microsoft_power_point:"}, - {"regex": r"Microsoft Teams", "icon": ":microsoft_teams:"}, - {"regex": r"Microsoft To Do|Things", "icon": ":things:"}, - {"regex": r"Microsoft Word", "icon": ":microsoft_word:"}, - {"regex": r"Min", "icon": ":min_browser:"}, - {"regex": r"MoneyMoney", "icon": ":bank:"}, - {"regex": r"mpv", "icon": ":mpv:"}, - {"regex": r"Music", "icon": ":music:"}, - {"regex": r"Neovide|MacVim|Vim|VimR", "icon": ":vim:"}, - {"regex": r"Notability", "icon": ":notability:"}, - {"regex": r"Notes", "icon": ":notes:"}, - {"regex": r"Notion", "icon": ":notion:"}, - {"regex": r"Nova", "icon": ":nova:"}, - {"regex": r"Numbers", "icon": ":numbers:"}, - {"regex": r"OBS", "icon": ":obsstudio:"}, - {"regex": r"Obsidian", "icon": ":obsidian:"}, - {"regex": r"OmniFocus", "icon": ":omni_focus:"}, - {"regex": r"Pages", "icon": ":pages:"}, - {"regex": r"Parallels Desktop", "icon": ":parallels:"}, - {"regex": r"Pi-hole Remote", "icon": ":pihole:"}, - {"regex": r"Pine", "icon": ":pine:"}, - {"regex": r"Podcasts", "icon": ":podcasts:"}, - {"regex": r"PomoDone App", "icon": ":pomodone:"}, - {"regex": r"Preview|Skim|zathura|PDFgear", "icon": ":pdf:"}, - {"regex": r"qutebrowser", "icon": ":qute_browser:"}, - {"regex": r"Reeder", "icon": ":reeder5:"}, - {"regex": r"Reminders", "icon": ":reminders:"}, - {"regex": r"Safari|Safari Technology Preview|Orion", "icon": ":safari:"}, - {"regex": r"Sequel Ace", "icon": ":sequel_ace:"}, - {"regex": r"Sequel Pro", "icon": ":sequel_pro:"}, - {"regex": r"Setapp", "icon": ":setapp:"}, - {"regex": r"Signal", "icon": ":signal:"}, - {"regex": r"Sketch", "icon": ":sketch:"}, - {"regex": r"Skype", "icon": ":skype:"}, - {"regex": r"Slack", "icon": ":slack:"}, - {"regex": r"Spark", "icon": ":spark:"}, - {"regex": r"Spotify", "icon": ":spotify:"}, - {"regex": r"Spotlight", "icon": ":spotlight:"}, - {"regex": r"Sublime Text", "icon": ":sublime_text:"}, - {"regex": r"System Preferences|System Settings", "icon": ":gear:"}, - {"regex": r"TeamSpeak 3", "icon": ":team_speak:"}, - {"regex": r"Telegram", "icon": ":telegram:"}, - {"regex": r"Thunderbird", "icon": ":thunderbird:"}, - {"regex": r"TickTick", "icon": ":tick_tick:"}, - {"regex": r"TIDAL", "icon": ":tidal:"}, - {"regex": r"Todoist", "icon": ":todoist:"}, - {"regex": r"Tor Browser", "icon": ":tor_browser:"}, - {"regex": r"Tower", "icon": ":tower:"}, - {"regex": r"Transmit", "icon": ":transmit:"}, - {"regex": r"Trello", "icon": ":trello:"}, - {"regex": r"Tweetbot|Twitter", "icon": ":twitter:"}, - {"regex": r"Typora", "icon": ":text:"}, - {"regex": r"Vivaldi", "icon": ":vivaldi:"}, - {"regex": r"VLC", "icon": ":vlc:"}, - {"regex": r"VMware Fusion", "icon": ":vmware_fusion:"}, - {"regex": r"VSCodium", "icon": ":vscodium:"}, - {"regex": r"WebStorm", "icon": ":web_storm:"}, - {"regex": r"WhatsApp", "icon": ":whats_app:"}, - {"regex": r"Xcode", "icon": ":xcode:"}, - {"regex": r"Zeplin", "icon": ":zeplin:"}, - {"regex": r"zoom.us", "icon": ":zoom:"}, - {"regex": r"Zotero", "icon": ":zotero:"}, - {"regex": r"Zulip", "icon": ":zulip:"}, - {"regex": r"微信", "icon": ":wechat:"}, - {"regex": r"网易云音乐", "icon": ":netease_music:"}, -] - - -def to_sup(s): - sups = { - "0": "\u2070", - "1": "\xb9", - "2": "\xb2", - "3": "\xb3", - "4": "\u2074", - "5": "\u2075", - "6": "\u2076", - "7": "\u2077", - "8": "\u2078", - "9": "\u2079", - } - - return "".join(sups.get(char, char) for char in str(s)) - - -def to_icon(app): - for x in ICON_MAP: - if re.search(x["regex"], app): - return x["icon"] - return ":default:" - - -def to_formatted_icon(app, c): - cnt = f" {to_sup(c)}" if c > 1 else "" - return f"{to_icon(app)}{cnt}" - - -def to_formatted_icons(apps): - return " ".join([to_formatted_icon(app, cnt) for app, cnt in apps.items()]) - - -spaces = {} -apps = json.loads(os.popen("yabai -m query --windows").read()) -for app in apps: - spaces[app["space"]] = spaces.get(app["space"], {}) - spaces[app["space"]][app["app"]] = spaces[app["space"]].get(app["app"], 0) + 1 - -args = " ".join( - [ - f'--set space.{space} label="{to_formatted_icons(apps)}" label.drawing=on' - for space, apps in spaces.items() - ] -) -default_args = "--set spaces_bracket drawing=off --set '/space\..*/' background.drawing=on --animate sin 10" - -args2 = "" -spaces = json.loads(os.popen("yabai -m query --spaces").read()) -for space in spaces: - if not space["windows"]: - args2 = f'{args2} --set space.{space["index"]} label="" label.drawing=off' - -os.system(f"sketchybar -m {default_args} {args} {args2}") diff --git a/mac/.config/sketchybar/plugins/space.sh b/mac/.config/sketchybar/plugins/space.sh deleted file mode 100644 index 70f3ac4..0000000 --- a/mac/.config/sketchybar/plugins/space.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -source "$CONFIG_DIR/globalstyles.sh" - -if [ "$SELECTED" = "true" ]; then - COLOR=$HIGHLIGHT - OFFSET=-12 # under line - WIDTH="dynamic" -else - COLOR=$TRANSPARENT -fi - -sketchybar --animate tanh 10 \ - --set $NAME icon.highlight=$SELECTED \ - label.highlight=$SELECTED \ - background.color=$COLOR \ - background.y_offset=$OFFSET - -update() { - source "$CONFIG_DIR/colors.sh" - COLOR=$BACKGROUND_2 - WIDTH="dynamic" - - sketchybar --set $NAME icon.highlight=$SELECTED \ - label.highlight=$SELECTED \ - background.border_color=$COLOR \ - sketchybar --animate tanh 8 \ - label.width=$WIDTH \ -} - -set_space_label() { - sketchybar --set $NAME icon="$@" -} - -mouse_clicked() { - if [ "$BUTTON" = "right" ]; then - yabai -m space --destroy $SID - sketchybar --trigger space_change --trigger windows_on_spaces - else - if [ "$MODIFIER" = "shift" ]; then - SPACE_LABEL="$(osascript -e "return (text returned of (display dialog \"Give a name to space $NAME:\" default answer \"\" with icon note buttons {\"Cancel\", \"Continue\"} default button \"Continue\"))")" - if [ $? -eq 0 ]; then - if [ "$SPACE_LABEL" = "" ]; then - set_space_label "${NAME:6}" - else - set_space_label "${NAME:6} ($SPACE_LABEL)" - fi - fi - else - yabai -m space --focus $SID 2>/dev/null - fi - fi -} - -case "$SENDER" in -"mouse.clicked") - mouse_clicked - ;; -*) - update - ;; -esac diff --git a/mac/.config/sketchybar/plugins/space_windows.sh b/mac/.config/sketchybar/plugins/space_windows.sh deleted file mode 100644 index f175891..0000000 --- a/mac/.config/sketchybar/plugins/space_windows.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -if [ "$SENDER" = "space_windows_change" ]; then - args=(--animate sin 10) - - space="$(echo "$INFO" | jq -r '.space')" - apps="$(echo "$INFO" | jq -r '.apps | keys[]')" - - icon_strip=" " - if [ "${apps}" != "" ]; then - while read -r app; do - icon_strip+=" $($CONFIG_DIR/plugins/icon_map.sh "$app")" - done <<<"${apps}" - else - icon_strip="" - fi - args+=(--set space.$space label="$icon_strip") - - sketchybar -m "${args[@]}" -fi diff --git a/mac/.config/sketchybar/plugins/spotify.sh b/mac/.config/sketchybar/plugins/spotify.sh deleted file mode 100644 index 521ac60..0000000 --- a/mac/.config/sketchybar/plugins/spotify.sh +++ /dev/null @@ -1,147 +0,0 @@ -#!/bin/bash - -next () -{ - osascript -e 'tell application "Spotify" to play next track' -} - -back () -{ - osascript -e 'tell application "Spotify" to play previous track' -} - -play () -{ - osascript -e 'tell application "Spotify" to playpause' -} - -repeat () -{ - REPEAT=$(osascript -e 'tell application "Spotify" to get repeating') - if [ "$REPEAT" = "false" ]; then - sketchybar -m --set spotify.repeat icon.highlight=on - osascript -e 'tell application "Spotify" to set repeating to true' - else - sketchybar -m --set spotify.repeat icon.highlight=off - osascript -e 'tell application "Spotify" to set repeating to false' - fi -} - -shuffle () -{ - SHUFFLE=$(osascript -e 'tell application "Spotify" to get shuffling') - if [ "$SHUFFLE" = "false" ]; then - sketchybar -m --set spotify.shuffle icon.highlight=on - osascript -e 'tell application "Spotify" to set shuffling to true' - else - sketchybar -m --set spotify.shuffle icon.highlight=off - osascript -e 'tell application "Spotify" to set shuffling to false' - fi -} - -update () -{ - PLAYING=1 - if [ "$(echo "$INFO" | jq -r '.["Player State"]')" = "Playing" ]; then - PLAYING=0 - TRACK="$(echo "$INFO" | jq -r .Name)" - ARTIST="$(echo "$INFO" | jq -r .Artist)" - ALBUM="$(echo "$INFO" | jq -r .Album)" - SHUFFLE=$(osascript -e 'tell application "Spotify" to get shuffling') - REPEAT=$(osascript -e 'tell application "Spotify" to get repeating') - COVER=$(osascript -e 'tell application "Spotify" to get artwork url of current track') - fi - - args=() - if [ $PLAYING -eq 0 ]; then - curl -s --max-time 20 "$COVER" -o /tmp/cover.jpg - if [ "$ARTIST" == "" ]; then - args+=(--set spotify.title label="$TRACK" - --set spotify.album label="Podcast" - --set spotify.artist label="$ALBUM" ) - else - args+=(--set spotify.title label="$TRACK" - --set spotify.album label="$ALBUM" - --set spotify.artist label="$ARTIST") - fi - args+=(--set spotify.play icon= - --set spotify.shuffle icon.highlight=$SHUFFLE - --set spotify.repeat icon.highlight=$REPEAT - --set spotify.cover background.image="/tmp/cover.jpg" - background.color=0x00000000 - --set spotify.anchor drawing=on ) - else - args+=(--set spotify.anchor drawing=off popup.drawing=off - --set spotify.play icon= ) - fi - sketchybar -m "${args[@]}" -} - -scrubbing() { - DURATION_MS=$(osascript -e 'tell application "Spotify" to get duration of current track') - DURATION=$((DURATION_MS/1000)) - - TARGET=$((DURATION*PERCENTAGE/100)) - osascript -e "tell application \"Spotify\" to set player position to $TARGET" - sketchybar --set spotify.state slider.percentage=$PERCENTAGE -} - -scroll() { - DURATION_MS=$(osascript -e 'tell application "Spotify" to get duration of current track') - DURATION=$((DURATION_MS/1000)) - - FLOAT="$(osascript -e 'tell application "Spotify" to get player position')" - TIME=${FLOAT%.*} - - sketchybar --animate linear 10 \ - --set spotify.state slider.percentage="$((TIME*100/DURATION))" \ - icon="$(date -r $TIME +'%M:%S')" \ - label="$(date -r $DURATION +'%M:%S')" -} - -mouse_clicked () { - case "$NAME" in - "spotify.next") next - ;; - "spotify.back") back - ;; - "spotify.play") play - ;; - "spotify.shuffle") shuffle - ;; - "spotify.repeat") repeat - ;; - "spotify.state") scrubbing - ;; - *) exit - ;; - esac -} - -popup () { - sketchybar --set spotify.anchor popup.drawing=$1 -} - -routine() { - case "$NAME" in - "spotify.state") scroll - ;; - *) update - ;; - esac -} - -case "$SENDER" in - "mouse.clicked") mouse_clicked - ;; - "mouse.entered") popup on - ;; - "mouse.exited"|"mouse.exited.global") popup off - ;; - "routine") routine - ;; - "forced") exit 0 - ;; - *) update - ;; -esac diff --git a/mac/.config/sketchybar/plugins/svim.sh b/mac/.config/sketchybar/plugins/svim.sh deleted file mode 100644 index cb792b8..0000000 --- a/mac/.config/sketchybar/plugins/svim.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -source "$CONFIG_DIR/icons.sh" -source "$CONFIG_DIR/colors.sh" - -if [ "$SENDER" = "svim_update" ]; then - DRAWING=on - DRAW_CMD=off - COLOR=$WHITE - case "$MODE" in - "I") ICON="$MODE_INSERT" DRAWING=off - ;; - "N") ICON="$MODE_NORMAL" - ;; - "V") ICON="$MODE_VISUAL" COLOR=$YELLOW - ;; - "C") ICON="$MODE_CMD" DRAW_CMD=on COLOR=$RED - ;; - "_") ICON="$MODE_PENDING" - ;; - *) DRAWING=off - ;; - esac - - sketchybar --set $NAME drawing="$DRAWING" \ - label.drawing="$DRAW_CMD" \ - icon="$ICON" \ - icon.color="$COLOR" \ - label="$CMDLINE" -fi diff --git a/mac/.config/sketchybar/plugins/thunderbird.sh b/mac/.config/sketchybar/plugins/thunderbird.sh deleted file mode 100644 index 53f8e31..0000000 --- a/mac/.config/sketchybar/plugins/thunderbird.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -TEXT=$(lsappinfo info -only StatusLabel "Thunderbird" | grep -o '"label"="[0-9]*"' | awk -F'"' '{print $4}') - -if [[ $TEXT -gt 0 ]]; then - sketchybar -m --set $NAME drawing=on label="$TEXT" -else - sketchybar -m --set $NAME drawing=off -fi diff --git a/mac/.config/sketchybar/plugins/toggle_stats.sh b/mac/.config/sketchybar/plugins/toggle_stats.sh deleted file mode 100644 index b364c18..0000000 --- a/mac/.config/sketchybar/plugins/toggle_stats.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -stats=( - cpu.top - cpu.percent - cpu.sys - cpu.user - memory - disk - network.up - network.down -) - -hide_stats() { - args=() - for item in "${stats[@]}"; do - args+=(--set "$item" drawing=off) - done - - sketchybar "${args[@]}" \ - --set separator_right \ - icon= \ - icon.font.size=25 \ - padding_right=10 -} - -show_stats() { - args=() - for item in "${stats[@]}"; do - args+=(--set "$item" drawing=on) - done - - sketchybar "${args[@]}" \ - --set separator_right \ - icon= \ - icon.font.size=25 \ - padding_right=10 -} - -toggle_stats() { - state=$(sketchybar --query separator_right | jq -r .icon.value) - - case $state in - "") - show_stats - ;; - "") - hide_stats - ;; - esac -} - -case "$SENDER" in -"hide_stats") - hide_stats - ;; -"show_stats") - show_stats - ;; -"toggle_stats") - toggle_stats - ;; -esac diff --git a/mac/.config/sketchybar/plugins/volume.sh b/mac/.config/sketchybar/plugins/volume.sh deleted file mode 100644 index a03a790..0000000 --- a/mac/.config/sketchybar/plugins/volume.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -WIDTH=100 - -volume_change() { - source "$CONFIG_DIR/icons.sh" - source "$CONFIG_DIR/colors.sh" - - case $INFO in - [6-9][0-9]|100) ICON=$VOLUME_100 - ;; - [3-5][0-9]) ICON=$VOLUME_66 - ;; - [1-2][0-9]) ICON=$VOLUME_33 - ;; - [1-9]) ICON=$VOLUME_10 - ;; - 0) ICON=$VOLUME_0 - ;; - *) ICON=$VOLUME_100 - esac - - sketchybar --set volume_icon icon=$ICON - sketchybar --set $NAME slider.percentage=$INFO --animate tanh 30 --set $NAME slider.width=$WIDTH - sleep 2 - - # Check wether the volume was changed another time while sleeping - FINAL_PERCENTAGE=$(sketchybar --query $NAME | jq -r ".slider.percentage") - if [ "$FINAL_PERCENTAGE" -eq "$INFO" ]; then - sketchybar --animate tanh 30 --set $NAME slider.width=0 - fi -} - -mouse_clicked() { - osascript -e "set volume output volume $PERCENTAGE" -} - -case "$SENDER" in - "volume_change") volume_change - ;; - "mouse.clicked") mouse_clicked - ;; -esac
\ No newline at end of file diff --git a/mac/.config/sketchybar/plugins/volume_click.sh b/mac/.config/sketchybar/plugins/volume_click.sh deleted file mode 100644 index e05c0d8..0000000 --- a/mac/.config/sketchybar/plugins/volume_click.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -WIDTH=100 - -detail_on() { - sketchybar --animate tanh 30 --set volume slider.width=$WIDTH -} - -detail_off() { - sketchybar --animate tanh 30 --set volume slider.width=0 -} - -toggle_detail() { - INITIAL_WIDTH=$(sketchybar --query volume | jq -r ".slider.width") - if [ "$INITIAL_WIDTH" -eq "0" ]; then - detail_on - else - detail_off - fi -} - -toggle_devices() { - which SwitchAudioSource >/dev/null || exit 0 - source "$CONFIG_DIR/colors.sh" - source "$CONFIG_DIR/globalstyles.sh" - - args=(--remove '/volume.device\.*/' --set "$NAME" popup.drawing=toggle "${menu_defaults[@]}") - COUNTER=0 - CURRENT="$(SwitchAudioSource -t output -c)" - while IFS= read -r device; do - COLOR=$WHITE - ICON= - ICON_COLOR=$TRANSPARENT - if [ "${device}" = "$CURRENT" ]; then - COLOR=$HIGHLIGHT - ICON= - ICON_COLOR=$COLOR - fi - - args+=(--add item volume.device.$COUNTER popup."$NAME" \ - --set volume.device.$COUNTER label="${device}" \ - label.color="$COLOR" \ - icon=$ICON \ - icon.color=$ICON_COLOR \ - "${menu_item_defaults[@]}" \ - click_script="SwitchAudioSource -s \"${device}\" && sketchybar --set /volume.device\.*/ label.color=$GREY --set \$NAME label.color=$WHITE --set $NAME popup.drawing=off") - COUNTER=$((COUNTER+1)) - done <<< "$(SwitchAudioSource -a -t output)" - - sketchybar -m "${args[@]}" > /dev/null -} - -if [ "$BUTTON" = "left" ] || [ "$MODIFIER" = "shift" ]; then - toggle_devices -else - toggle_detail -fi
\ No newline at end of file diff --git a/mac/.config/sketchybar/plugins/weather.sh b/mac/.config/sketchybar/plugins/weather.sh deleted file mode 100644 index 61644de..0000000 --- a/mac/.config/sketchybar/plugins/weather.sh +++ /dev/null @@ -1,191 +0,0 @@ -#!/usr/bin/env bash - -# Load global styles, colors and icons -source "$CONFIG_DIR/globalstyles.sh" - -# API_KEY="462eeb49a1b844f191f175554222607" # insert api key here -API_KEY="2aa1a4f60e2542efae051005240402" # insert api key here - -# first comment is description, second is icon number -WEATHER_ICONS_DAY=( - [1000]= # Sunny/113 - [1003]= # Partly cloudy/116 - [1006]= # Cloudy/119 - [1009]= # Overcast/122 - [1030]= # Mist/143 - [1063]= # Patchy rain possible/176 - [1066]= # Patchy snow possible/179 - [1069]= # Patchy sleet possible/182 - [1072]= # Patchy freezing drizzle possible/185 - [1087]= # Thundery outbreaks possible/200 - [1114]= # Blowing snow/227 - [1117]= # Blizzard/230 - [1135]= # Fog/248 - [1147]= # Freezing fog/260 - [1150]= # Patchy light drizzle/263 - [1153]= # Light drizzle/266 - [1168]= # Freezing drizzle/281 - [1171]= # Heavy freezing drizzle/284 - [1180]= # Patchy light rain/293 - [1183]= # Light rain/296 - [1186]= # Moderate rain at times/299 - [1189]= # Moderate rain/302 - [1192]= # Heavy rain at times/305 - [1195]= # Heavy rain/308 - [1198]= # Light freezing rain/311 - [1201]= # Moderate or heavy freezing rain/314 - [1204]= # Light sleet/317 - [1207]= # Moderate or heavy sleet/320 - [1210]= # Patchy light snow/323 - [1213]= # Light snow/326 - [1216]= # Patchy moderate snow/329 - [1219]= # Moderate snow/332 - [1222]= # Patchy heavy snow/335 - [1225]= # Heavy snow/338 - [1237]= # Ice pellets/350 - [1240]= # Light rain shower/353 - [1243]= # Moderate or heavy rain shower/356 - [1246]= # Torrential rain shower/359 - [1249]= # Light sleet showers/362 - [1252]= # Moderate or heavy sleet showers/365 - [1255]= # Light snow showers/368 - [1258]= # Moderate or heavy snow showers/371 - [1261]= # Light showers of ice pellets/374 - [1264]= # Moderate or heavy showers of ice pellets/377 - [1273]= # Patchy light rain with thunder/386 - [1276]= # Moderate or heavy rain with thunder/389 - [1279]= # Patchy light snow with thunder/392 - [1282]= # Moderate or heavy snow with thunder/395 -) - -WEATHER_ICONS_NIGHT=( - [1000]= # Clear/113 - [1003]= # Partly cloudy/116 - [1006]= # Cloudy/119 - [1009]= # Overcast/122 - [1030]= # Mist/143 - [1063]= # Patchy rain possible/176 - [1066]= # Patchy snow possible/179 - [1069]= # Patchy sleet possible/182 - [1072]= # Patchy freezing drizzle possible/185 - [1087]= # Thundery outbreaks possible/200 - [1114]= # Blowing snow/227 - [1117]= # Blizzard/230 - [1135]= # Fog/248 - [1147]= # Freezing fog/260 - [1150]= # Patchy light drizzle/263 - [1153]= # Light drizzle/266 - [1168]= # Freezing drizzle/281 - [1171]= # Heavy freezing drizzle/284 - [1180]= # Patchy light rain/293 - [1183]= # Light rain/296 - [1186]= # Moderate rain at times/299 - [1189]= # Moderate rain/302 - [1192]= # Heavy rain at times/305 - [1195]= # Heavy rain/308 - [1198]= # Light freezing rain/311 - [1201]= # Moderate or heavy freezing rain/314 - [1204]= # Light sleet/317 - [1207]= # Moderate or heavy sleet/320 - [1210]= # Patchy light snow/323 - [1213]= # Light snow/326 - [1216]= # Patchy moderate snow/329 - [1219]= # Moderate snow/332 - [1222]= # Patchy heavy snow/335 - [1225]= # Heavy snow/338 - [1237]= # Ice pellets/350 - [1240]= # Light rain shower/353 - [1243]= # Moderate or heavy rain shower/356 - [1246]= # Torrential rain shower/359 - [1249]= # Light sleet showers/362 - [1252]= # Moderate or heavy sleet showers/365 - [1255]= # Light snow showers/368 - [1258]= # Moderate or heavy snow showers/371 - [1261]= # Light showers of ice pellets/374 - [1264]= # Moderate or heavy showers of ice pellets/377 - [1273]= # Patchy light rain with thunder/386 - [1276]= # Moderate or heavy rain with thunder/389 - [1279]= # Patchy light snow with thunder/392 - [1282]= # Moderate or heavy snow with thunder/395 -) - -render_item() { - if [ "$CITY" = "" ]; then - args+=(--set $NAME icon="" label.drawing=off icon.padding_right=-3) - else - args+=(--set $NAME icon="$ICON" icon.font="Hack Nerd Font:Bold:14.0" label="${TEMP}°C" label.drawing=on icon.padding_right=-3) - fi - - sketchybar "${args[@]}" >/dev/null - -} - -render_popup() { - if [ "$CITY" = "" ]; then - args+=(--set weather.details label="N/A" - click_script="sketchybar --set $NAME popup.drawing=off") - else - args+=(--set weather.details label="$CONDITION_TEXT, Humidity: $HUMIDITY% ($LOCATION)" - click_script="sketchybar --set $NAME popup.drawing=off") - fi - - sketchybar "${args[@]}" >/dev/null - -} - -update() { - CURRENT_WIFI="$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I)" - SSID="$(echo "$CURRENT_WIFI" | grep -o "SSID: .*" | sed 's/^SSID: //')" - - # Attempt to get the city name using the IP info service - CITY="$(curl -s -m 5 ipinfo.io/loc)" - - # Check if the CITY variable is empty or contains an error message - if [ -z "$CITY" ] || echo "$CITY" | grep -q "error"; then - # Default to Birmingham,AL if the curl command failed or returned an error - CITY="Birmingham,AL" - fi - - # Replace spaces with '%20' for URL encoding - CITY=$(echo "$CITY" | sed 's/ /%20/g') - - if [ "$CITY" != "" ]; then - DATA=$(curl -s -m 5 "http://api.weatherapi.com/v1/current.json?key=$API_KEY&q=$CITY") - CONDITION=$(echo $DATA | jq -r '.current.condition.code') - CONDITION_TEXT=$(echo $DATA | jq -r '.current.condition.text') - TEMP=$(echo $DATA | jq -r '.current.temp_c | floor') - FEELSLIKE=$(echo $DATA | jq -r '.current.feelslike_f') - HUMIDITY=$(echo $DATA | jq -r '.current.humidity') - IS_DAY=$(echo $DATA | jq -r '.current.is_day') - LOCATION=$(echo $DATA | jq -r '.location.name' && echo ', ' && echo $DATA | jq -r '.location.country') - - [ "$IS_DAY" = "1" ] && ICON=${WEATHER_ICONS_DAY[$CONDITION]} || ICON=${WEATHER_ICONS_NIGHT[$CONDITION]} - args=() - fi - - render_item - render_popup - - if [ "$SENDER" = "forced" ]; then - sketchybar --set "$NAME" - fi -} - -popup() { - sketchybar --set "$NAME" popup.drawing="$1" -} - -case "$SENDER" in -"routine" | "forced" | "wifi_change") - update - ;; -"mouse.entered") - popup on - ;; -"mouse.exited" | "mouse.exited.global") - popup off - ;; -"mouse.clicked") - popup toggle - ;; -esac diff --git a/mac/.config/sketchybar/plugins/wifi.sh b/mac/.config/sketchybar/plugins/wifi.sh deleted file mode 100644 index 3f78223..0000000 --- a/mac/.config/sketchybar/plugins/wifi.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/bash - -POPUP_OFF="sketchybar --set wifi popup.drawing=off" -POPUP_CLICK_SCRIPT="sketchybar --set wifi popup.drawing=toggle" - -source "$CONFIG_DIR/globalstyles.sh" # Loads defined colors - -INFO="$(/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | awk -F ' SSID: ' '/ SSID: / {print $2}')" -IS_VPN=$(/usr/local/bin/piactl get connectionstate) -CURRENT_WIFI="$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I)" -IP_ADDRESS="$(ipconfig getifaddr en0)" -SSID="$(echo "$CURRENT_WIFI" | grep -o "SSID: .*" | sed 's/^SSID: //')" -CURR_TX="$(echo "$CURRENT_WIFI" | grep -o "lastTxRate: .*" | sed 's/^lastTxRate: //')" - -# ICON="$([ -n "$INFO" ] && echo "$WIFI_CONNECTED" || echo "$WIFI_DISCONNECTED")" - -if [ -n "$INFO" ]; then - ICON_COLOR=$GREEN - ICON="$WIFI_CONNECTED" -elif [ -z "$INFO" ]; then - ICON="$WIFI_DISCONNECTED" -elif [[ $IS_VPN != "Disconnected" ]]; then - ICON_COLOR=$HIGHLIGHT - ICON= -elif [[ $SSID = "Ebrietas" ]]; then - ICON_COLOR=$WHITE - ICON= -elif [[ $SSID != "" ]]; then - ICON_COLOR=$WHITE - ICON= -elif [[ $CURRENT_WIFI = "AirPort: Off" ]]; then - ICON_COLOR=$RED - ICON= -else - ICON_COLOR=$WHITE_25 - ICON= -fi - -render_bar_item() { - sketchybar --set $NAME \ - icon.color=$ICON_COLOR \ - icon=$ICON \ - click_script="$POPUP_CLICK_SCRIPT" -} - -render_popup() { - if [ "$SSID" != "" ]; then - args=( - --set wifi click_script="$POPUP_CLICK_SCRIPT" - --set wifi.ssid label="$SSID" - --set wifi.strength label="$CURR_TX Mbps" - --set wifi.ipaddress label="$IP_ADDRESS" - click_script="printf $IP_ADDRESS | pbcopy;$POPUP_OFF" - ) - else - args=( - --set wifi click_script="") - fi - - sketchybar "${args[@]}" >/dev/null -} - -update() { - render_bar_item - render_popup - source "$CONFIG_DIR/icons.sh" - INFO="$(/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | awk -F ' SSID: ' '/ SSID: / {print $2}')" - LABEL="$INFO ($(ipconfig getifaddr en0))" - ICON="$([ -n "$INFO" ] && echo "$WIFI_CONNECTED" || echo "$WIFI_DISCONNECTED")" - sketchybar --set $NAME icon="$ICON" label="$LABEL" -} - -click() { - CURRENT_WIDTH="$(sketchybar --query $NAME | jq -r .label.width)" - - WIDTH=0 - if [ "$CURRENT_WIDTH" -eq "0" ]; then - WIDTH=dynamic - fi - - sketchybar --animate sin 20 --set $NAME label.width="$WIDTH" -} - -popup() { - sketchybar --set "$NAME" popup.drawing="$1" -} - -case "$SENDER" in -"routine" | "forced") - update - ;; -"mouse.entered") - popup on - ;; -"mouse.exited" | "mouse.exited.global") - popup off - ;; -"wifi_change") - update - ;; -"mouse.clicked") - click - ;; -esac diff --git a/mac/.config/sketchybar/plugins/yabai.sh b/mac/.config/sketchybar/plugins/yabai.sh deleted file mode 100644 index 6027de1..0000000 --- a/mac/.config/sketchybar/plugins/yabai.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash - -# window_state() { -# source "$CONFIG_DIR/globalstyles.sh" -# -# COLOR=$LABEL_COLOR -# -# WINDOW=$(yabai -m query --windows --window) -# read -r FLOATING SPLIT PARENT FULLSCREEN STICKY STACK_INDEX <<<$(echo "$WINDOW" | jq -rc '.["is-floating", "split-type", "has-parent-zoom", "has-fullscreen-zoom", "is-sticky", "stack-index"]') -# -# if [[ $STACK_INDEX -gt 0 ]]; then -# LAST_STACK_INDEX=$(yabai -m query --windows --window stack.last | jq '.["stack-index"]') -# ICON=$YABAI_STACK -# LABEL="$(printf "%s/%s " "$STACK_INDEX" "$LAST_STACK_INDEX")" -# COLOR=$YELLOW -# elif [[ $FLOATING == "true" ]]; then -# ICON=$YABAI_FLOAT -# elif [[ $PARENT == "true" ]]; then -# ICON="" -# elif [[ $FULLSCREEN == "true" ]]; then -# ICON=$YABAI_FULLSCREEN_ZOOM -# elif [[ $SPLIT == "vertical" ]]; then -# ICON=$YABAI_SPLIT_VERTICAL -# elif [[ $SPLIT == "horizontal" ]]; then -# ICON=$YABAI_SPLIT_HORIZONTAL -# else -# ICON=$YABAI_GRID -# fi -# -# args=(--bar border_color=$COLOR --animate sin 10 --set $NAME icon=$ICON icon.color=$COLOR) -# -# [ -z "$LABEL" ] && args+=(label.drawing=off) || -# args+=(label.drawing=on label="$LABEL" label.color=$COLOR) -# -# [ -z "$ICON" ] && args+=(icon.width=0) || -# args+=(icon="$ICON") -# -# sketchybar -m "${args[@]}" -# } -# -# windows_on_spaces() { -# /usr/bin/python3 $CONFIG_DIR/plugins/space.py # New spaces python script to consolidate spaces -# } -# -# mouse_clicked() { -# -# yabai_mode=$(yabai -m query --spaces --space | jq -r .type) -# -# case "$yabai_mode" in -# bsp) -# yabai -m config layout stack -# ;; -# stack) -# yabai -m config layout float -# ;; -# float) -# yabai -m config layout bsp -# ;; -# esac -# -# window_state -# } -# -# case "$SENDER" in -# "mouse.clicked") -# mouse_clicked -# ;; -# "forced") -# exit 0 -# ;; -# "window_focus") -# window_state -# ;; -# "windows_on_spaces" | "space_change") -# windows_on_spaces -# ;; -# esac - -window_state() { - source "$CONFIG_DIR/colors.sh" - source "$CONFIG_DIR/icons.sh" - - COLOR=$ROSEWATER - - WINDOW=$(yabai -m query --windows --window) - read -r FLOATING SPLIT PARENT FULLSCREEN STICKY STACK_INDEX <<<$(echo "$WINDOW" | jq -rc '.["is-floating", "split-type", "has-parent-zoom", "has-fullscreen-zoom", "is-sticky", "stack-index"]') - - if [[ $STACK_INDEX -gt 0 ]]; then - LAST_STACK_INDEX=$(yabai -m query --windows --window stack.last | jq '.["stack-index"]') - ICON=$YABAI_STACK - LABEL="$(printf "%s/%s " "$STACK_INDEX" "$LAST_STACK_INDEX")" - COLOR=$YELLOW - elif [[ $FLOATING == "true" ]]; then - ICON=$YABAI_FLOAT - elif [[ $PARENT == "true" ]]; then - ICON="" - elif [[ $FULLSCREEN == "true" ]]; then - ICON=$YABAI_FULLSCREEN_ZOOM - elif [[ $SPLIT == "vertical" ]]; then - ICON=$YABAI_SPLIT_VERTICAL - elif [[ $SPLIT == "horizontal" ]]; then - ICON=$YABAI_SPLIT_HORIZONTAL - else - ICON=$YABAI_GRID - fi - - args=(--bar --animate sin 10 --set $NAME icon=$ICON icon.color=$COLOR) - # args=(--bar border_color=$COLOR --animate sin 10 --set $NAME icon=$ICON icon.color=$COLOR) - - [ -z "$LABEL" ] && args+=(label.drawing=off) || - args+=(label.drawing=on label="$LABEL" label.color=$COLOR) - - [ -z "$ICON" ] && args+=(icon.width=0) || - args+=(icon="$ICON") - - sketchybar -m "${args[@]}" -} - -windows_on_spaces() { - /usr/bin/python3 $CONFIG_DIR/plugins/space.py # New spaces python script to consolidate spaces -} - -mouse_clicked() { - yabai -m window --toggle float - window_state -} - -case "$SENDER" in -"mouse.clicked") - mouse_clicked - ;; -"forced") - exit 0 - ;; -"window_focus") - window_state - ;; -# "windows_on_spaces" | "space_change") -# windows_on_spaces -# ;; -esac diff --git a/mac/.config/sketchybar/plugins/zen.sh b/mac/.config/sketchybar/plugins/zen.sh deleted file mode 100644 index 38f2291..0000000 --- a/mac/.config/sketchybar/plugins/zen.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -zen_on() { - sketchybar --set wifi drawing=off \ - --set apple.logo drawing=off \ - --set '/cpu.*/' drawing=off \ - --set calendar icon.drawing=off \ - --set separator drawing=off \ - --set front_app drawing=off \ - --set volume_icon drawing=off \ - --set spotify.anchor drawing=off \ - --set spotify.play updates=off \ - --set brew drawing=off \ - --set volume drawing=off \ - --set github.bell drawing=off -} - -zen_off() { - sketchybar --set wifi drawing=on \ - --set apple.logo drawing=on \ - --set '/cpu.*/' drawing=on \ - --set calendar icon.drawing=on \ - --set separator drawing=on \ - --set front_app drawing=on \ - --set volume_icon drawing=on \ - --set spotify.play updates=on \ - --set brew drawing=on \ - --set volume drawing=on \ - --set github.bell drawing=on -} - -if [ "$1" = "on" ]; then - zen_on -elif [ "$1" = "off" ]; then - zen_off -else - if [ "$(sketchybar --query apple.logo | jq -r ".geometry.drawing")" = "on" ]; then - zen_on - else - zen_off - fi -fi - |
