worf: Update yabay/sketchybar/alacritty config

This commit is contained in:
Felix Albrigtsen 2025-02-18 21:41:32 +01:00
parent da2ca7f42e
commit 47db333feb
31 changed files with 1612 additions and 15 deletions

View File

@ -19,7 +19,7 @@
decorations = "none"; # full/none/transparent/buttonless
# Transparency:
# opacity = 0.95;
opacity = 0.95;
};
scrolling = {

View File

@ -48,6 +48,10 @@
emmet-vim # Ctrl+y + ,
];
xdg.configFile = {
"sketchybar".source = ./sketchybar;
};
# Copy Applications to ~/Applications to allow them to be launched from Spotlight
disabledModules = [ "targets/darwin/linkapps.nix" ];
home.activation = lib.mkIf pkgs.stdenv.isDarwin {

26
hosts/worf/sketchybar/colors.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
# Color Palette
export BLACK=0xff181926
export WHITE=0xffcad3f5
export RED=0xffed8796
export GREEN=0xffa6da95
export BLUE=0xff8aadf4
export YELLOW=0xffeed49f
export ORANGE=0xfff5a97f
export MAGENTA=0xffc6a0f6
export GREY=0xff939ab7
export TRANSPARENT=0x00000000
# General bar colors
export BAR_COLOR=0xe62e2e2e
export BAR_BORDER_COLOR=0xff494d64 #0xa024273a
export ICON_COLOR=$WHITE # Color of all icons
export LABEL_COLOR=$WHITE # Color of all labels
export BACKGROUND_1=0x603c3e4f
export BACKGROUND_2=0x60494d64
export POPUP_BACKGROUND_COLOR=0xff1e1e2e
export POPUP_BORDER_COLOR=$WHITE
export SHADOW_COLOR=$BLACK

57
hosts/worf/sketchybar/icons.sh Executable file
View File

@ -0,0 +1,57 @@
#!/bin/bash
# General Icons
LOADING=􀖇
APPLE=􀣺
PREFERENCES=􀺽
ACTIVITY=􀒓
LOCK=􀒳
BELL=􀋚
BELL_DOT=􀝗
# Git Icons
GIT_ISSUE=􀍷
GIT_DISCUSSION=􀒤
GIT_PULL_REQUEST=􀙡
GIT_COMMIT=􀡚
GIT_INDICATOR=􀂓
# Spotify Icons
SPOTIFY_BACK=􀊎
SPOTIFY_PLAY_PAUSE=􀊈
SPOTIFY_NEXT=􀊐
SPOTIFY_SHUFFLE=􀊝
SPOTIFY_REPEAT=􀊞
# Yabai Icons
YABAI_STACK=􀏭
YABAI_FULLSCREEN_ZOOM=􀏜
YABAI_PARENT_ZOOM=􀥃
YABAI_FLOAT=􀢌
YABAI_GRID=􀧍
# Battery Icons
BATTERY_100=􀛨
BATTERY_75=􀺸
BATTERY_50=􀺶
BATTERY_25=􀛩
BATTERY_0=􀛪
BATTERY_CHARGING=􀢋
# Volume Icons
VOLUME_100=􀊩
VOLUME_66=􀊧
VOLUME_33=􀊥
VOLUME_10=􀊡
VOLUME_0=􀊣
# WiFi
WIFI_CONNECTED=􀙇
WIFI_DISCONNECTED=􀙈
# svim
MODE_NORMAL=􀂯
MODE_INSERT=􀂥
MODE_VISUAL=􀂿
MODE_CMD=􀂙
MODE_PENDING=􀈏

View File

@ -0,0 +1,43 @@
#!/bin/bash
# General Icons
LOADING=
APPLE=󰘳
PREFERENCES=
ACTIVITY=
LOCK=
BELL=
BELL_DOT=
# Spotify Icons
SPOTIFY_BACK=􀊎
SPOTIFY_PLAY_PAUSE=􀊈
SPOTIFY_NEXT=􀊐
SPOTIFY_SHUFFLE=􀊝
SPOTIFY_REPEAT=􀊞
# Yabai Icons
YABAI_STACK=
YABAI_FULLSCREEN_ZOOM=
YABAI_PARENT_ZOOM=
YABAI_FLOAT=󰥛
YABAI_GRID=󰋁
# Battery Icons
BATTERY_100=󱈏
BATTERY_75=󰂀
BATTERY_50=󰁾
BATTERY_25=󰁻
BATTERY_0=󱉝
BATTERY_CHARGING=󰂄
# Volume Icons
VOLUME_100=
VOLUME_66=󰕾
VOLUME_33=󰖀
VOLUME_10=󰕿
VOLUME_0=
# WiFi
WIFI_CONNECTED=󰖩
WIFI_DISCONNECTED=󱚵

View File

@ -0,0 +1,44 @@
#!/bin/bash
POPUP_OFF='sketchybar --set apple.logo popup.drawing=off'
POPUP_CLICK_SCRIPT='sketchybar --set $NAME popup.drawing=toggle'
apple_logo=(
icon=$APPLE
icon.font="$FONT:Black:16.0"
icon.color=$GREEN
padding_right=15
label.drawing=off
click_script="$POPUP_CLICK_SCRIPT"
popup.height=35
)
apple_prefs=(
icon=$PREFERENCES
label="Preferences"
click_script="open -a 'System Preferences'; $POPUP_OFF"
)
apple_activity=(
icon=$ACTIVITY
label="Activity"
click_script="open -a 'Activity Monitor'; $POPUP_OFF"
)
apple_lock=(
icon=$LOCK
label="Lock Screen"
click_script="pmset displaysleepnow; $POPUP_OFF"
)
sketchybar --add item apple.logo left \
--set apple.logo "${apple_logo[@]}" \
\
--add item apple.prefs popup.apple.logo \
--set apple.prefs "${apple_prefs[@]}" \
\
--add item apple.activity popup.apple.logo \
--set apple.activity "${apple_activity[@]}" \
\
--add item apple.lock popup.apple.logo \
--set apple.lock "${apple_lock[@]}"

View File

@ -0,0 +1,15 @@
#!/bin/bash
battery=(
script="$PLUGIN_DIR/battery.sh"
icon.font="$FONT:Regular:19.0"
padding_right=5
padding_left=0
label.drawing=off
update_freq=120
updates=on
)
sketchybar --add item battery right \
--set battery "${battery[@]}" \
--subscribe battery power_source_change system_woke

View File

@ -0,0 +1,17 @@
#!/bin/bash
calendar=(
icon=cal
icon.font="$FONT:Black:12.0"
icon.padding_right=0
label.width=45
label.align=right
padding_left=15
update_freq=30
script="$PLUGIN_DIR/calendar.sh"
click_script="$PLUGIN_DIR/zen.sh"
)
sketchybar --add item calendar right \
--set calendar "${calendar[@]}" \
--subscribe calendar system_woke

View File

@ -0,0 +1,53 @@
#!/bin/bash
cpu_top=(
label.font="$FONT:Bold:7"
label=CPU
icon.drawing=off
width=0
padding_right=15
y_offset=6
)
cpu_percent=(
label.font="$FONT:Bold:12"
label=CPU
y_offset=-4
padding_right=15
width=55
icon.drawing=off
update_freq=4
mach_helper="$HELPER"
)
cpu_sys=(
width=0
graph.color=$RED
graph.fill_color=$RED
label.drawing=off
icon.drawing=off
background.height=30
background.drawing=on
background.color=$TRANSPARENT
)
cpu_user=(
graph.color=$BLUE
label.drawing=off
icon.drawing=off
background.height=30
background.drawing=on
background.color=$TRANSPARENT
)
sketchybar --add item cpu.top right \
--set cpu.top "${cpu_top[@]}" \
\
--add item cpu.percent right \
--set cpu.percent "${cpu_percent[@]}" \
\
--add graph cpu.sys right 75 \
--set cpu.sys "${cpu_sys[@]}" \
\
--add graph cpu.user right 75 \
--set cpu.user "${cpu_user[@]}"

View File

@ -0,0 +1,13 @@
#!/bin/bash
front_app=(
label.font="$FONT:Bold:12.0"
icon.background.drawing=on
display=active
script="$PLUGIN_DIR/front_app.sh"
click_script="open -a 'Mission Control'"
)
sketchybar --add item front_app left \
--set front_app "${front_app[@]}" \
--subscribe front_app front_app_switched

View File

@ -0,0 +1,13 @@
media=(
icon.background.drawing=on
icon.background.image=media.artwork
icon.background.image.corner_radius=9
script="$PLUGIN_DIR/media.sh"
label.max_chars=15
scroll_texts=on
updates=on
)
sketchybar --add item media center \
--set media "${media[@]}" \
--subscribe media media_change

View File

@ -0,0 +1,51 @@
#!/bin/bash
SPACE_ICONS=("1" "2" "3" "4" "5" "6" "7" "8" "9")
# Destroy space on right click, focus space on left click.
# New space by left clicking separator (>)
sid=0
spaces=()
for i in "${!SPACE_ICONS[@]}"
do
sid=$(($i+1))
space=(
space=$sid
icon="${SPACE_ICONS[i]}"
icon.padding_left=10
icon.padding_right=10
padding_left=2
padding_right=2
label.padding_right=20
icon.highlight_color=$RED
label.color=$GREY
label.highlight_color=$WHITE
label.font="sketchybar-app-font:Regular:16.0"
label.y_offset=-1
background.color=$BACKGROUND_1
background.border_color=$BACKGROUND_2
script="$PLUGIN_DIR/space.sh"
)
sketchybar --add space space.$sid left \
--set space.$sid "${space[@]}" \
--subscribe space.$sid mouse.clicked
done
space_creator=(
icon=􀆊
icon.font="$FONT:Heavy:16.0"
padding_left=10
padding_right=8
label.drawing=off
display=active
click_script='yabai -m space --create'
script="$PLUGIN_DIR/space_windows.sh"
icon.color=$WHITE
)
sketchybar --add item space_creator left \
--set space_creator "${space_creator[@]}" \
--subscribe space_creator space_windows_change

View File

@ -0,0 +1,202 @@
#!/bin/bash
SPOTIFY_EVENT="com.spotify.client.PlaybackStateChanged"
POPUP_SCRIPT="sketchybar -m --set spotify.anchor popup.drawing=toggle"
spotify_anchor=(
script="$PLUGIN_DIR/spotify.sh"
click_script="$POPUP_SCRIPT"
popup.horizontal=on
popup.align=center
popup.height=150
icon=􁁒
icon.font="$FONT:Regular:25.0"
label.drawing=off
drawing=off
y_offset=2
)
spotify_cover=(
script="$PLUGIN_DIR/spotify.sh"
click_script="open -a 'Spotify'; $POPUP_SCRIPT"
label.drawing=off
icon.drawing=off
padding_left=12
padding_right=10
background.image.scale=0.2
background.image.drawing=on
background.drawing=on
background.image.corner_radius=9
shadow=on
)
spotify_title=(
icon.drawing=off
padding_left=0
padding_right=0
width=0
label.font="$FONT:Heavy:15.0"
label.max_chars=20
y_offset=55
)
spotify_artist=(
icon.drawing=off
y_offset=30
padding_left=0
padding_right=0
width=0
label.max_chars=20
)
spotify_album=(
icon.drawing=off
padding_left=0
padding_right=0
y_offset=15
width=0
label.max_chars=25
)
spotify_state=(
icon.drawing=on
icon.font="$FONT:Light Italic:10.0"
icon.width=35
icon="00:00"
label.drawing=on
label.font="$FONT:Light Italic:10.0"
label.width=35
label="00:00"
padding_left=0
padding_right=0
y_offset=-15
width=0
slider.background.height=6
slider.background.corner_radius=1
slider.background.color=$GREY
slider.highlight_color=$GREEN
slider.percentage=40
slider.width=115
script="$PLUGIN_DIR/spotify.sh"
update_freq=1
updates=when_shown
)
spotify_shuffle=(
icon=􀊝
icon.padding_left=5
icon.padding_right=5
icon.color=$BLACK
icon.highlight_color=$GREY
label.drawing=off
script="$PLUGIN_DIR/spotify.sh"
y_offset=-45
)
spotify_back=(
icon=􀊎
icon.padding_left=5
icon.padding_right=5
icon.color=$BLACK
script="$PLUGIN_DIR/spotify.sh"
label.drawing=off
y_offset=-45
)
spotify_play=(
icon=􀊔
background.height=40
background.corner_radius=20
width=40
align=center
background.color=$POPUP_BACKGROUND_COLOR
background.border_color=$WHITE
background.border_width=0
background.drawing=on
icon.padding_left=4
icon.padding_right=5
updates=on
label.drawing=off
script="$PLUGIN_DIR/spotify.sh"
y_offset=-45
)
spotify_next=(
icon=􀊐
icon.padding_left=5
icon.padding_right=5
icon.color=$BLACK
label.drawing=off
script="$PLUGIN_DIR/spotify.sh"
y_offset=-45
)
spotify_repeat=(
icon=􀊞
icon.highlight_color=$GREY
icon.padding_left=5
icon.padding_right=10
icon.color=$BLACK
label.drawing=off
script="$PLUGIN_DIR/spotify.sh"
y_offset=-45
)
spotify_controls=(
background.color=$GREEN
background.corner_radius=11
background.drawing=on
y_offset=-45
)
sketchybar --add event spotify_change $SPOTIFY_EVENT \
--add item spotify.anchor center \
--set spotify.anchor "${spotify_anchor[@]}" \
--subscribe spotify.anchor mouse.entered mouse.exited \
mouse.exited.global \
\
--add item spotify.cover popup.spotify.anchor \
--set spotify.cover "${spotify_cover[@]}" \
\
--add item spotify.title popup.spotify.anchor \
--set spotify.title "${spotify_title[@]}" \
\
--add item spotify.artist popup.spotify.anchor \
--set spotify.artist "${spotify_artist[@]}" \
\
--add item spotify.album popup.spotify.anchor \
--set spotify.album "${spotify_album[@]}" \
\
--add slider spotify.state popup.spotify.anchor \
--set spotify.state "${spotify_state[@]}" \
--subscribe spotify.state mouse.clicked \
\
--add item spotify.shuffle popup.spotify.anchor \
--set spotify.shuffle "${spotify_shuffle[@]}" \
--subscribe spotify.shuffle mouse.clicked \
\
--add item spotify.back popup.spotify.anchor \
--set spotify.back "${spotify_back[@]}" \
--subscribe spotify.back mouse.clicked \
\
--add item spotify.play popup.spotify.anchor \
--set spotify.play "${spotify_play[@]}" \
--subscribe spotify.play mouse.clicked spotify_change \
\
--add item spotify.next popup.spotify.anchor \
--set spotify.next "${spotify_next[@]}" \
--subscribe spotify.next mouse.clicked \
\
--add item spotify.repeat popup.spotify.anchor \
--set spotify.repeat "${spotify_repeat[@]}" \
--subscribe spotify.repeat mouse.clicked \
\
--add item spotify.spacer popup.spotify.anchor \
--set spotify.spacer width=5 \
\
--add bracket spotify.controls spotify.shuffle \
spotify.back \
spotify.play \
spotify.next \
spotify.repeat \
--set spotify.controls "${spotify_controls[@]}" \

View File

@ -0,0 +1,44 @@
#!/bin/bash
volume_slider=(
script="$PLUGIN_DIR/volume.sh"
updates=on
label.drawing=off
icon.drawing=off
slider.highlight_color=$BLUE
slider.background.height=5
slider.background.corner_radius=3
slider.background.color=$BACKGROUND_2
slider.knob=􀀁
slider.knob.drawing=on
)
volume_icon=(
click_script="$PLUGIN_DIR/volume_click.sh"
padding_left=10
icon=$VOLUME_100
icon.width=0
icon.align=left
icon.color=$GREY
icon.font="$FONT:Regular:14.0"
label.width=25
label.align=left
label.font="$FONT:Regular:14.0"
)
status_bracket=(
background.color=$BACKGROUND_1
background.border_color=$BACKGROUND_2
)
sketchybar --add slider volume right \
--set volume "${volume_slider[@]}" \
--subscribe volume volume_change \
mouse.clicked \
\
--add item volume_icon right \
--set volume_icon "${volume_icon[@]}"
# sketchybar --add bracket status brew github.bell wifi volume_icon \
sketchybar --add bracket status wifi volume_icon \
--set status "${status_bracket[@]}"

View File

@ -0,0 +1,14 @@
#!/bin/bash
source "$CONFIG_DIR/icons.sh"
wifi=(
padding_right=7
label.width=0
icon="$WIFI_DISCONNECTED"
script="$PLUGIN_DIR/wifi.sh"
)
sketchybar --add item wifi right \
--set wifi "${wifi[@]}" \
--subscribe wifi wifi_change mouse.clicked

View File

@ -0,0 +1,15 @@
#!/bin/bash
yabai=(
icon.width=0
label.width=0
script="$PLUGIN_DIR/yabai.sh"
icon.font="$FONT:Bold:16.0"
display=active
)
sketchybar --add event window_focus \
--add item yabai left \
--set yabai "${yabai[@]}" \
--subscribe yabai window_focus \
mouse.clicked

View File

@ -0,0 +1,33 @@
#!/bin/bash
source "$CONFIG_DIR/icons.sh"
source "$CONFIG_DIR/colors.sh"
BATTERY_INFO="$(pmset -g batt)"
PERCENTAGE=$(echo "$BATTERY_INFO" | /usr/bin/grep -Eo "\d+%" | cut -d% -f1)
CHARGING=$(echo "$BATTERY_INFO" | grep 'AC Power')
if [ $PERCENTAGE = "" ]; then
exit 0
fi
DRAWING=on
COLOR=$WHITE
case ${PERCENTAGE} in
9[0-9]|100) ICON=$BATTERY_100; DRAWING=off
;;
[6-8][0-9]) ICON=$BATTERY_75; DRAWING=off
;;
[3-5][0-9]) ICON=$BATTERY_50
;;
[1-2][0-9]) ICON=$BATTERY_25; COLOR=$ORANGE
;;
*) ICON=$BATTERY_0; COLOR=$RED
esac
if [[ $CHARGING != "" ]]; then
ICON=$BATTERY_CHARGING
DRAWING=off
fi
sketchybar --set $NAME drawing=$DRAWING icon="$ICON" icon.color=$COLOR

View File

@ -0,0 +1,3 @@
#!/bin/bash
sketchybar --set $NAME icon="$(date '+%a %d. %b')" label="$(date '+%H:%M')"

View File

@ -0,0 +1,5 @@
#!/bin/bash
if [ "$SENDER" = "front_app_switched" ]; then
sketchybar --set $NAME label="$INFO" icon.background.image="app.$INFO"
fi

View File

@ -0,0 +1,414 @@
case "$1" in
"WhatsApp")
icon_result=":whats_app:"
;;
"Nova")
icon_result=":nova:"
;;
"Signal")
icon_result=":signal:"
;;
"Affinity Photo")
icon_result=":affinity_photo:"
;;
"Sublime Text")
icon_result=":sublime_text:"
;;
"Notion")
icon_result=":notion:"
;;
"Pine")
icon_result=":pine:"
;;
"Alacritty" | "Hyper" | "iTerm2" | "kitty" | "Terminal" | "终端" | "WezTerm")
icon_result=":terminal:"
;;
"Podcasts" | "播客")
icon_result=":podcasts:"
;;
"Spark Desktop")
icon_result=":spark:"
;;
"Dropbox")
icon_result=":dropbox:"
;;
"OmniFocus")
icon_result=":omni_focus:"
;;
"TIDAL")
icon_result=":tidal:"
;;
"Spotlight")
icon_result=":spotlight:"
;;
"Affinity Publisher")
icon_result=":affinity_publisher:"
;;
"Replit")
icon_result=":replit:"
;;
"Kakoune")
icon_result=":kakoune:"
;;
"Code" | "Code - Insiders")
icon_result=":code:"
;;
"Microsoft Excel")
icon_result=":microsoft_excel:"
;;
"League of Legends")
icon_result=":league_of_legends:"
;;
"Obsidian")
icon_result=":obsidian:"
;;
"Typora")
icon_result=":text:"
;;
"Blender")
icon_result=":blender:"
;;
"Microsoft Edge")
icon_result=":microsoft_edge:"
;;
"Caprine")
icon_result=":caprine:"
;;
"Figma")
icon_result=":figma:"
;;
"Folx")
icon_result=":folx:"
;;
"Arc")
icon_result=":arc:"
;;
"TeamSpeak 3")
icon_result=":team_speak:"
;;
"Drafts")
icon_result=":drafts:"
;;
"Jellyfin Media Player")
icon_result=":jellyfin:"
;;
"Element")
icon_result=":element:"
;;
"Numbers" | "Numbers 表格")
icon_result=":numbers:"
;;
"Airmail")
icon_result=":airmail:"
;;
"Preview" | "预览" | "Skim" | "zathura")
icon_result=":pdf:"
;;
"zoom.us")
icon_result=":zoom:"
;;
"IntelliJ IDEA")
icon_result=":idea:"
;;
"Music" | "音乐")
icon_result=":music:"
;;
"Safari" | "Safari浏览器" | "Safari Technology Preview")
icon_result=":safari:"
;;
"Finder" | "访达")
icon_result=":finder:"
;;
"TickTick")
icon_result=":tick_tick:"
;;
"Mattermost")
icon_result=":mattermost:"
;;
"Calendar" | "日历" | "Fantastical" | "Cron" | "Amie")
icon_result=":calendar:"
;;
"Todoist")
icon_result=":todoist:"
;;
"Live")
icon_result=":ableton:"
;;
"Logseq")
icon_result=":logseq:"
;;
"Parallels Desktop")
icon_result=":parallels:"
;;
"App Store")
icon_result=":app_store:"
;;
"ClickUp")
icon_result=":click_up:"
;;
"Docker" | "Docker Desktop")
icon_result=":docker:"
;;
"Trello")
icon_result=":trello:"
;;
"Microsoft To Do" | "Things")
icon_result=":things:"
;;
"Notability")
icon_result=":notability:"
;;
"Brave Browser")
icon_result=":brave_browser:"
;;
"网易云音乐")
icon_result=":netease_music:"
;;
"Messages" | "信息" | "Nachrichten")
icon_result=":messages:"
;;
"DEVONthink 3")
icon_result=":devonthink3:"
;;
"Bear")
icon_result=":bear:"
;;
"Notes" | "备忘录")
icon_result=":notes:"
;;
"GrandTotal" | "Receipts")
icon_result=":dollar:"
;;
"Cypress")
icon_result=":cypress:"
;;
"Sequel Pro")
icon_result=":sequel_pro:"
;;
"Sequel Ace")
icon_result=":sequel_ace:"
;;
"PomoDone App")
icon_result=":pomodone:"
;;
"mpv")
icon_result=":mpv:"
;;
"Orion" | "Orion RC")
icon_result=":orion:"
;;
"System Preferences" | "系统设置")
icon_result=":gear:"
;;
"Reminders" | "提醒事项")
icon_result=":reminders:"
;;
"MoneyMoney")
icon_result=":bank:"
;;
"MAMP" | "MAMP PRO")
icon_result=":mamp:"
;;
"Final Cut Pro")
icon_result=":final_cut_pro:"
;;
"Microsoft PowerPoint")
icon_result=":microsoft_power_point:"
;;
"VLC")
icon_result=":vlc:"
;;
"Chromium" | "Google Chrome" | "Google Chrome Canary")
icon_result=":google_chrome:"
;;
"Xcode")
icon_result=":xcode:"
;;
"Canary Mail" | "HEY" | "Mail" | "Mailspring" | "MailMate" | "邮件")
icon_result=":mail:"
;;
"Vivaldi")
icon_result=":vivaldi:"
;;
"Color Picker" | "数码测色计")
icon_result=":color_picker:"
;;
"Audacity")
icon_result=":audacity:"
;;
"WebStorm")
icon_result=":web_storm:"
;;
"Emacs")
icon_result=":emacs:"
;;
"GitHub Desktop")
icon_result=":git_hub:"
;;
"Setapp")
icon_result=":setapp:"
;;
"微信")
icon_result=":wechat:"
;;
"Alfred")
icon_result=":alfred:"
;;
"Tor Browser")
icon_result=":tor_browser:"
;;
"Skype")
icon_result=":skype:"
;;
"qutebrowser")
icon_result=":qute_browser:"
;;
"Firefox Developer Edition" | "Firefox Nightly")
icon_result=":firefox_developer_edition:"
;;
"Insomnia")
icon_result=":insomnia:"
;;
"LibreWolf")
icon_result=":libre_wolf:"
;;
"Tweetbot" | "Twitter")
icon_result=":twitter:"
;;
"FaceTime" | "FaceTime 通话")
icon_result=":face_time:"
;;
"Zotero")
icon_result=":zotero:"
;;
"1Password 7")
icon_result=":one_password:"
;;
"Slack")
icon_result=":slack:"
;;
"Spotify")
icon_result=":spotify:"
;;
"OBS")
icon_result=":obsstudio:"
;;
"Min")
icon_result=":min_browser:"
;;
"Default")
icon_result=":default:"
;;
"Pi-hole Remote")
icon_result=":pihole:"
;;
"VMware Fusion")
icon_result=":vmware_fusion:"
;;
"CleanMyMac X")
icon_result=":desktop:"
;;
"Telegram")
icon_result=":telegram:"
;;
"Bitwarden")
icon_result=":bit_warden:"
;;
"Iris")
icon_result=":iris:"
;;
"Neovide" | "MacVim" | "Vim" | "VimR")
icon_result=":vim:"
;;
"Warp")
icon_result=":warp:"
;;
"Zulip")
icon_result=":zulip:"
;;
"Thunderbird")
icon_result=":thunderbird:"
;;
"Tower")
icon_result=":tower:"
;;
"Matlab")
icon_result=":matlab:"
;;
"Joplin")
icon_result=":joplin:"
;;
"Android Studio")
icon_result=":android_studio:"
;;
"Keynote" | "Keynote 讲演")
icon_result=":keynote:"
;;
"Grammarly Editor")
icon_result=":grammarly:"
;;
"Firefox")
icon_result=":firefox:"
;;
"Zed")
icon_result=":zed:"
;;
"Sketch")
icon_result=":sketch:"
;;
"Discord" | "Discord Canary" | "Discord PTB")
icon_result=":discord:"
;;
"Evernote Legacy")
icon_result=":evernote_legacy:"
;;
"Zeplin")
icon_result=":zeplin:"
;;
"KeePassXC")
icon_result=":kee_pass_x_c:"
;;
"Microsoft Teams")
icon_result=":microsoft_teams:"
;;
"카카오톡")
icon_result=":kakaotalk:"
;;
"Linear")
icon_result=":linear:"
;;
"Microsoft Word")
icon_result=":microsoft_word:"
;;
"Atom")
icon_result=":atom:"
;;
"Keyboard Maestro")
icon_result=":keyboard_maestro:"
;;
"Transmit")
icon_result=":transmit:"
;;
"Android Messages")
icon_result=":android_messages:"
;;
"Pages" | "Pages 文稿")
icon_result=":pages:"
;;
"Affinity Designer")
icon_result=":affinity_designer:"
;;
"VSCodium")
icon_result=":vscodium:"
;;
"Reeder")
icon_result=":reeder5:"
;;
"Calibre")
icon_result=":book:"
;;
*)
icon_result=":default:"
;;
esac
echo $icon_result

View File

@ -0,0 +1,18 @@
#!/bin/bash
update_media() {
STATE="$(echo "$INFO" | jq -r '.state')"
if [ "$STATE" = "playing" ]; then
APP=$(echo "$INFO" | jq -r '.app')
MEDIA="$(echo "$INFO" | jq -r '.title + " - " + .artist')"
sketchybar --set $NAME label="$MEDIA" drawing=on
else
sketchybar --set $NAME drawing=off
fi
}
case "$SENDER" in
"media_change") update_media
;;
esac

View File

@ -0,0 +1,42 @@
#!/bin/bash
update() {
source "$CONFIG_DIR/colors.sh"
COLOR=$BACKGROUND_2
if [ "$SELECTED" = "true" ]; then
COLOR=$GREY
fi
sketchybar --set $NAME icon.highlight=$SELECTED \
label.highlight=$SELECTED \
background.border_color=$COLOR
}
set_space_label() {
sketchybar --set $NAME icon="$@"
}
mouse_clicked() {
if [ "$BUTTON" = "right" ]; then
yabai -m space --destroy $SID
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

View File

@ -0,0 +1,21 @@
#!/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

View File

@ -0,0 +1,147 @@
#!/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

View File

@ -0,0 +1,44 @@
#!/bin/bash
WIDTH=100
volume_change() {
source "$CONFIG_DIR/icons.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 label=$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

View File

@ -0,0 +1,48 @@
#!/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"
args=(--remove '/volume.device\.*/' --set "$NAME" popup.drawing=toggle)
COUNTER=0
CURRENT="$(SwitchAudioSource -t output -c)"
while IFS= read -r device; do
COLOR=$GREY
if [ "${device}" = "$CURRENT" ]; then
COLOR=$WHITE
fi
args+=(--add item volume.device.$COUNTER popup."$NAME" \
--set volume.device.$COUNTER label="${device}" \
label.color="$COLOR" \
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" = "right" ] || [ "$MODIFIER" = "shift" ]; then
toggle_devices
else
toggle_detail
fi

View File

@ -0,0 +1,28 @@
#!/bin/bash
update() {
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"
}
case "$SENDER" in
"wifi_change") update
;;
"mouse.clicked") click
;;
esac

View File

@ -0,0 +1,51 @@
#!/bin/bash
window_state() {
source "$CONFIG_DIR/colors.sh"
source "$CONFIG_DIR/icons.sh"
WINDOW=$(yabai -m query --windows --window)
STACK_INDEX=$(echo "$WINDOW" | jq '.["stack-index"]')
COLOR=$BAR_BORDER_COLOR
ICON=""
if [ "$(echo "$WINDOW" | jq '.["is-floating"]')" = "true" ]; then
ICON+=$YABAI_FLOAT
COLOR=$MAGENTA
elif [ "$(echo "$WINDOW" | jq '.["has-fullscreen-zoom"]')" = "true" ]; then
ICON+=$YABAI_FULLSCREEN_ZOOM
COLOR=$GREEN
elif [ "$(echo "$WINDOW" | jq '.["has-parent-zoom"]')" = "true" ]; then
ICON+=$YABAI_PARENT_ZOOM
COLOR=$BLUE
elif [[ $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=$RED
fi
args=(--bar border_color=$COLOR --animate sin 10 --set $NAME icon.color=$COLOR)
[ -z "$LABEL" ] && args+=(label.width=0) \
|| args+=(label="$LABEL" label.width=40)
[ -z "$ICON" ] && args+=(icon.width=0) \
|| args+=(icon="$ICON" icon.width=30)
sketchybar -m "${args[@]}"
}
mouse_clicked() {
yabai -m window --toggle float
window_state
}
case "$SENDER" in
"mouse.clicked") mouse_clicked
;;
"window_focus") window_state
;;
esac

View File

@ -0,0 +1,39 @@
#!/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 volume 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 volume 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

View File

@ -0,0 +1,86 @@
export CONFIG_DIR="$HOME/.config/sketchybar"
source "$CONFIG_DIR/colors.sh" # Loads all defined colors
source "$CONFIG_DIR/icons.sh" # Loads all defined icons
ITEM_DIR="$CONFIG_DIR/items" # Directory where the items are configured
PLUGIN_DIR="$CONFIG_DIR/plugins"
FONT="Hack Nerd Font" # Needs to have Regular, Bold, Semibold, Heavy and Black variants
PADDINGS=3 # All paddings use this value (icon, label, background)
# Setting up and starting the helper process
# HELPER=git.felix.helper
# killall helper
# (cd $CONFIG_DIR/helper && make)
# $CONFIG_DIR/helper/helper $HELPER > /dev/null 2>&1 &
# Unload the macOS on screen indicator overlay for volume change
#launchctl unload -F /System/Library/LaunchAgents/com.apple.OSDUIHelper.plist > /dev/null 2>&1 &
# Setting up the general bar appearance of the bar
bar=(
height=40
color=$BAR_COLOR
border_width=2
border_color=$BAR_BORDER_COLOR
shadow=off
position=top
sticky=on
padding_right=10
padding_left=10
margin=0
topmost=window
)
sketchybar --bar "${bar[@]}"
# Setting up default values
defaults=(
updates=when_shown
icon.font="$FONT:Bold:14.0"
icon.color=$ICON_COLOR
icon.padding_left=$PADDINGS
icon.padding_right=$PADDINGS
label.font="$FONT:Semibold:13.0"
label.color=$LABEL_COLOR
label.padding_left=$PADDINGS
label.padding_right=$PADDINGS
padding_right=$PADDINGS
padding_left=$PADDINGS
background.height=26
background.corner_radius=9
background.border_width=2
popup.background.border_width=2
popup.background.border_color=$POPUP_BORDER_COLOR
popup.background.color=$POPUP_BACKGROUND_COLOR
popup.blur_radius=20
popup.background.shadow.drawing=on
scroll_texts=on
)
sketchybar --default "${defaults[@]}"
# Left
source "$ITEM_DIR/apple.sh"
source "$ITEM_DIR/spaces.sh"
source "$ITEM_DIR/yabai.sh"
source "$ITEM_DIR/front_app.sh"
# Center
source "$ITEM_DIR/spotify.sh"
# source "$ITEM_DIR/media.sh"
# Right
source "$ITEM_DIR/calendar.sh"
source "$ITEM_DIR/wifi.sh"
source "$ITEM_DIR/battery.sh"
source "$ITEM_DIR/volume.sh"
# source "$ITEM_DIR/cpu.sh"
sketchybar --hotload on
# Forcing all item scripts to run (never do this outside of sketchybarrc)
sketchybar --update
# vi: ft=bash

View File

@ -7,29 +7,28 @@ in {
enable = true;
package = pkgs.unstable.yabai;
enableScriptingAddition = true;
config = {
layout = "bsp";
debug_output = "on";
focus_follows_mouse = "autoraise";
mouse_follows_focus = "off";
mouse_follows_focus = "on";
window_shadow = "on";
mouse_modifier = "alt";
window_placement = "second_child";
window_opacity = "off";
window_border = "on";
window_border_width = 1;
window_border_blur = "off";
normal_window_border_color = "0xff404066";
active_window_border_color = "0xffff2020";
insert_feedback_color = "#06d6a0";
window_border_radius = 0;
# top_padding = 10;
# bottom_padding = 10;
# left_padding = 10;
# right_padding = 10;
window_gap = 0;
top_padding = 4;
bottom_padding = 4;
left_padding = 4;
right_padding = 4;
window_gap = 10;
external_bar = "all:40:0";
external_bar = "all:30:0";
};
};
@ -119,8 +118,16 @@ in {
services.sketchybar = {
enable = true;
package = pkgs.sketchybar;
# The config is handled outside of nix, and is placed in ~/.config/sketchybar
extraPackages = with pkgs; [ jq ];
# Configuration files are placed in hosts/worf/home.nix
};
services.jankyborders = {
enable = true;
active_color = "0xff76f6c0";
inactive_color = "0xc831dae2";
style = "square";
width = 4.0;
};
fonts.packages = [