mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
chezmoi: macOS
This commit is contained in:
parent
fff9275372
commit
c1a63e4658
39 changed files with 10 additions and 284 deletions
57
home/dot_config/sketchybar/executable_sketchybarrc
Normal file
57
home/dot_config/sketchybar/executable_sketchybarrc
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source "$HOME/.config/sketchybar/variables.sh" # Loads all defined colors
|
||||
|
||||
# General bar and defaults
|
||||
|
||||
sketchybar --bar height=30 \
|
||||
color="$BAR_COLOR" \
|
||||
shadow="$SHADOW" \
|
||||
position=top \
|
||||
sticky=on \
|
||||
padding_right=0 \
|
||||
padding_left=3 \
|
||||
corner_radius="$CORNER_RADIUS" \
|
||||
y_offset=5 \
|
||||
margin=5 \
|
||||
blur_radius=20 \
|
||||
notch_width=200 \
|
||||
--default updates=when_shown \
|
||||
icon.font="$FONT:Bold:13.5" \
|
||||
icon.color="$ICON_COLOR" \
|
||||
icon.padding_left="$PADDINGS" \
|
||||
icon.padding_right="$PADDINGS" \
|
||||
label.font="$FONT:Bold:13.0" \
|
||||
label.color="$LABEL_COLOR" \
|
||||
label.padding_left="$PADDINGS" \
|
||||
label.padding_right="$PADDINGS" \
|
||||
background.padding_right="$PADDINGS" \
|
||||
background.padding_left="$PADDINGS" \
|
||||
popup.background.border_width=1 \
|
||||
popup.background.corner_radius=11 \
|
||||
popup.background.border_color="$POPUP_BORDER_COLOR" \
|
||||
popup.background.color="$POPUP_BACKGROUND_COLOR" \
|
||||
popup.background.shadow.drawing="$SHADOW"
|
||||
|
||||
# Left
|
||||
# source "$ITEM_DIR/apple.sh"
|
||||
source "$ITEM_DIR/spaces.sh"
|
||||
source "$ITEM_DIR/front_app.sh"
|
||||
|
||||
# Center (of notch)
|
||||
source "$ITEM_DIR/spotify.sh"
|
||||
|
||||
# Right
|
||||
source "$ITEM_DIR/clock.sh"
|
||||
source "$ITEM_DIR/calendar.sh"
|
||||
source "$ITEM_DIR/battery.sh"
|
||||
source "$ITEM_DIR/volume.sh"
|
||||
source "$ITEM_DIR/memory.sh"
|
||||
|
||||
#################### Finalizing Setup ####################
|
||||
|
||||
sketchybar --hotload true
|
||||
|
||||
sketchybar --update
|
||||
|
||||
echo "sketchybar configuration loaded.."
|
||||
56
home/dot_config/sketchybar/executable_variables.sh
Normal file
56
home/dot_config/sketchybar/executable_variables.sh
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
# Color Palette
|
||||
# Catppuccin Mocha
|
||||
BLACK=0xff1e1e2e
|
||||
WHITE=0xffcdd6f4
|
||||
MAGENTA=0xffcba6f7 # Mauve
|
||||
BLUE=0xff8aadf4
|
||||
CYAN=0xff7dc4e4 # Sapphire
|
||||
GREEN=0xffa6da95
|
||||
YELLOW=0xffeed49f
|
||||
ORANGE=0xfff5a97f # Peach
|
||||
RED=0xfff38ba8
|
||||
PINK=0xfff5c2e7
|
||||
FLAMINGO=0xfff2cdcd
|
||||
# BAR_COLOR=0xff1a1b26
|
||||
BAR_COLOR=0xff181825
|
||||
COMMENT=0xff565f89
|
||||
ACCENT=$FLAMINGO
|
||||
|
||||
# Tokyonight Day
|
||||
# BLACK=0xffe9e9ed
|
||||
# WHITE=0xff3760bf
|
||||
# MAGENTA=0xff9854f1
|
||||
# BLUE=0xff2e7de9
|
||||
# CYAN=0xff007197
|
||||
# GREEN=0xff587539
|
||||
# YELLOW=0xff8c6c3e
|
||||
# ORANGE=0xffb15c00
|
||||
# RED=0xfff52a65
|
||||
# BAR_COLOR=0xffe1e2e7
|
||||
|
||||
TRANSPARENT=0x00000000
|
||||
|
||||
# General bar colors
|
||||
ICON_COLOR=$WHITE # Color of all icons
|
||||
LABEL_COLOR=$WHITE # Color of all labels
|
||||
|
||||
ITEM_DIR="$HOME/.config/sketchybar/items"
|
||||
PLUGIN_DIR="$HOME/.config/sketchybar/plugins"
|
||||
|
||||
FONT="JetBrainsMono Nerd Font"
|
||||
|
||||
PADDINGS=3
|
||||
|
||||
POPUP_BORDER_WIDTH=2
|
||||
POPUP_CORNER_RADIUS=11
|
||||
POPUP_BACKGROUND_COLOR=$BLACK
|
||||
POPUP_BORDER_COLOR=$COMMENT
|
||||
|
||||
CORNER_RADIUS=999
|
||||
BORDER_WIDTH=2
|
||||
|
||||
SHADOW=on
|
||||
|
||||
SPACE_ICONS=("一" "二" "三" "四" "五" "六" "七" "八" "九" "十" "十一" "十二" "十三" "十四" "十五" "十六" "十七" "十八" "十九" "二十")
|
||||
20
home/dot_config/sketchybar/items/executable_battery.sh
Normal file
20
home/dot_config/sketchybar/items/executable_battery.sh
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
COLOR="$CYAN"
|
||||
|
||||
sketchybar --add item battery right \
|
||||
--set battery \
|
||||
update_freq=60 \
|
||||
icon.color="$COLOR" \
|
||||
icon.padding_left=10 \
|
||||
label.padding_right=10 \
|
||||
label.color="$COLOR" \
|
||||
background.height=26 \
|
||||
background.corner_radius="$CORNER_RADIUS" \
|
||||
background.padding_right=5 \
|
||||
background.border_width="$BORDER_WIDTH" \
|
||||
background.border_color="$COLOR" \
|
||||
background.color="$BAR_COLOR" \
|
||||
background.drawing=on \
|
||||
script="$PLUGIN_DIR/power.sh" \
|
||||
--subscribe battery power_source_change
|
||||
18
home/dot_config/sketchybar/items/executable_calendar.sh
Normal file
18
home/dot_config/sketchybar/items/executable_calendar.sh
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
COLOR="$BLUE"
|
||||
|
||||
sketchybar --add item calendar right \
|
||||
--set calendar update_freq=15 \
|
||||
icon.color="$COLOR" \
|
||||
icon.padding_left=10 \
|
||||
label.color="$COLOR" \
|
||||
label.padding_right=10 \
|
||||
background.height=26 \
|
||||
background.corner_radius="$CORNER_RADIUS" \
|
||||
background.padding_right=5 \
|
||||
background.border_width="$BORDER_WIDTH" \
|
||||
background.border_color="$COLOR" \
|
||||
background.color="$BAR_COLOR" \
|
||||
background.drawing=on \
|
||||
script="$PLUGIN_DIR/calendar.sh"
|
||||
21
home/dot_config/sketchybar/items/executable_clock.sh
Normal file
21
home/dot_config/sketchybar/items/executable_clock.sh
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
COLOR="$MAGENTA"
|
||||
|
||||
sketchybar --add item clock right \
|
||||
--set clock update_freq=1 \
|
||||
icon.padding_left=10 \
|
||||
icon.color="$COLOR" \
|
||||
icon="" \
|
||||
label.color="$COLOR" \
|
||||
label.padding_right=5 \
|
||||
label.width=78 \
|
||||
align=center \
|
||||
background.height=26 \
|
||||
background.corner_radius="$CORNER_RADIUS" \
|
||||
background.padding_right=2 \
|
||||
background.border_width="$BORDER_WIDTH" \
|
||||
background.border_color="$COLOR" \
|
||||
background.color="$BAR_COLOR" \
|
||||
background.drawing=on \
|
||||
script="$PLUGIN_DIR/clock.sh"
|
||||
19
home/dot_config/sketchybar/items/executable_cpu.sh
Normal file
19
home/dot_config/sketchybar/items/executable_cpu.sh
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
COLOR="$YELLOW"
|
||||
|
||||
sketchybar --add item cpu right \
|
||||
--set cpu \
|
||||
update_freq=3 \
|
||||
icon.color="$COLOR" \
|
||||
icon.padding_left=10 \
|
||||
label.color="$COLOR" \
|
||||
label.padding_right=10 \
|
||||
background.height=26 \
|
||||
background.corner_radius="$CORNER_RADIUS" \
|
||||
background.padding_right=5 \
|
||||
background.border_width="$BORDER_WIDTH" \
|
||||
background.border_color="$COLOR" \
|
||||
background.color="$BAR_COLOR" \
|
||||
background.drawing=on \
|
||||
script="$PLUGIN_DIR/cpu.sh"
|
||||
20
home/dot_config/sketchybar/items/executable_front_app.sh
Normal file
20
home/dot_config/sketchybar/items/executable_front_app.sh
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
COLOR="$ACCENT"
|
||||
|
||||
sketchybar \
|
||||
--add item front_app left \
|
||||
--set front_app script="$PLUGIN_DIR/front_app.sh" \
|
||||
icon.drawing=off \
|
||||
background.height=26 \
|
||||
background.padding_left=0 \
|
||||
background.padding_right=10 \
|
||||
background.border_width="$BORDER_WIDTH" \
|
||||
background.border_color="$COLOR" \
|
||||
background.corner_radius="$CORNER_RADIUS" \
|
||||
background.color="$BAR_COLOR" \
|
||||
label.color="$COLOR" \
|
||||
label.padding_left=10 \
|
||||
label.padding_right=10 \
|
||||
associated_display=active \
|
||||
--subscribe front_app front_app_switched
|
||||
19
home/dot_config/sketchybar/items/executable_memory.sh
Normal file
19
home/dot_config/sketchybar/items/executable_memory.sh
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
COLOR="$YELLOW"
|
||||
|
||||
sketchybar --add item cpu right \
|
||||
--set cpu \
|
||||
update_freq=3 \
|
||||
icon.color="$COLOR" \
|
||||
icon.padding_left=10 \
|
||||
label.color="$COLOR" \
|
||||
label.padding_right=10 \
|
||||
background.height=26 \
|
||||
background.corner_radius="$CORNER_RADIUS" \
|
||||
background.padding_right=5 \
|
||||
background.border_width="$BORDER_WIDTH" \
|
||||
background.border_color="$COLOR" \
|
||||
background.color="$BAR_COLOR" \
|
||||
background.drawing=on \
|
||||
script="$PLUGIN_DIR/memory.sh"
|
||||
44
home/dot_config/sketchybar/items/executable_spaces.sh
Normal file
44
home/dot_config/sketchybar/items/executable_spaces.sh
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source "$HOME/.config/sketchybar/variables.sh" # Loads all defined colors
|
||||
|
||||
sketchybar --add item spacer.1 left \
|
||||
--set spacer.1 background.drawing=off \
|
||||
label.drawing=off \
|
||||
icon.drawing=off \
|
||||
width=10
|
||||
|
||||
for i in "${!SPACE_ICONS[@]}"; do
|
||||
sid=$((i + 1))
|
||||
sketchybar --add space space.$sid left \
|
||||
--set space.$sid associated_space=$sid \
|
||||
label.drawing=off \
|
||||
icon.padding_left=10 \
|
||||
icon.padding_right=10 \
|
||||
background.padding_left=-5 \
|
||||
background.padding_right=-5 \
|
||||
script="$PLUGIN_DIR/space.sh"
|
||||
done
|
||||
|
||||
sketchybar --add item spacer.2 left \
|
||||
--set spacer.2 background.drawing=off \
|
||||
label.drawing=off \
|
||||
icon.drawing=off \
|
||||
width=5
|
||||
|
||||
sketchybar --add bracket spaces '/space.*/' \
|
||||
--set spaces background.border_width="$BORDER_WIDTH" \
|
||||
background.border_color="$RED" \
|
||||
background.corner_radius="$CORNER_RADIUS" \
|
||||
background.color="$BAR_COLOR" \
|
||||
background.height=26 \
|
||||
background.drawing=on
|
||||
|
||||
sketchybar --add item separator left \
|
||||
\
|
||||
icon.font="$FONT:Regular:16.0" \
|
||||
background.padding_left=26 \
|
||||
background.padding_right=15 \
|
||||
label.drawing=off \
|
||||
associated_display=active \
|
||||
icon.color="$YELLOW" # --set separator icon= \
|
||||
23
home/dot_config/sketchybar/items/executable_spotify.sh
Normal file
23
home/dot_config/sketchybar/items/executable_spotify.sh
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
COLOR="$ORANGE"
|
||||
|
||||
sketchybar --add item spotify q \
|
||||
--set spotify \
|
||||
scroll_texts=on \
|
||||
icon= \
|
||||
icon.color="$COLOR" \
|
||||
icon.padding_left=10 \
|
||||
background.color="$BAR_COLOR" \
|
||||
background.height=26 \
|
||||
background.corner_radius="$CORNER_RADIUS" \
|
||||
background.border_width="$BORDER_WIDTH" \
|
||||
background.border_color="$COLOR" \
|
||||
background.padding_right=-5 \
|
||||
background.drawing=on \
|
||||
label.padding_right=10 \
|
||||
label.max_chars=20 \
|
||||
associated_display=active \
|
||||
updates=on \
|
||||
script="$PLUGIN_DIR/spotify.sh" \
|
||||
--subscribe spotify media_change
|
||||
20
home/dot_config/sketchybar/items/executable_volume.sh
Normal file
20
home/dot_config/sketchybar/items/executable_volume.sh
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
COLOR="$GREEN"
|
||||
|
||||
sketchybar \
|
||||
--add item sound right \
|
||||
--set sound \
|
||||
icon.color="$COLOR" \
|
||||
icon.padding_left=10 \
|
||||
label.color="$COLOR" \
|
||||
label.padding_right=10 \
|
||||
background.height=26 \
|
||||
background.corner_radius="$CORNER_RADIUS" \
|
||||
background.padding_right=5 \
|
||||
background.border_width="$BORDER_WIDTH" \
|
||||
background.border_color="$COLOR" \
|
||||
background.color="$BAR_COLOR" \
|
||||
background.drawing=on \
|
||||
script="$PLUGIN_DIR/sound.sh" \
|
||||
--subscribe sound volume_change
|
||||
10
home/dot_config/sketchybar/plugins/executable_calendar.sh
Normal file
10
home/dot_config/sketchybar/plugins/executable_calendar.sh
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
# vim:ft=bash
|
||||
|
||||
export LC_TIME=zh_CN.UTF-8
|
||||
|
||||
# 获取当前日期,并格式化为“3月3日 星期一”格式
|
||||
DATE=$(date "+%-m月%-d日 %A")
|
||||
|
||||
# 发送到 SketchyBar
|
||||
sketchybar --set $NAME label="$DATE"
|
||||
4
home/dot_config/sketchybar/plugins/executable_clock.sh
Normal file
4
home/dot_config/sketchybar/plugins/executable_clock.sh
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
LABEL=$(date '+%H:%M:%S')
|
||||
sketchybar --set "$NAME" label="$LABEL"
|
||||
3
home/dot_config/sketchybar/plugins/executable_cpu.sh
Normal file
3
home/dot_config/sketchybar/plugins/executable_cpu.sh
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
sketchybar --set "$NAME" icon="" label="$(ps -A -o %cpu | awk '{s+=$1} END {s /= 8} END {printf "%.1f%%\n", s}')"
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
case "$SENDER" in
|
||||
"front_app_switched")
|
||||
sketchybar --set "$NAME" label="$INFO"
|
||||
;;
|
||||
esac
|
||||
16
home/dot_config/sketchybar/plugins/executable_memory.sh
Normal file
16
home/dot_config/sketchybar/plugins/executable_memory.sh
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
TOTAL_MEM=$(sysctl -n hw.memsize)
|
||||
TOTAL_MEM=$((TOTAL_MEM / 1024 / 1024)) # 转换为 MB
|
||||
|
||||
USED_MEM_RAW=$(top -l 1 | awk '/PhysMem/ {print $2}')
|
||||
|
||||
if [[ $USED_MEM_RAW == *G ]]; then
|
||||
USED_MEM=$(echo "$USED_MEM_RAW" | sed 's/G//' | awk '{print $1 * 1024}') # 转 MB
|
||||
else
|
||||
USED_MEM=$(echo "$USED_MEM_RAW" | sed 's/M//') # 直接取 MB
|
||||
fi
|
||||
|
||||
MEM_PERCENT=$(echo "scale=1; $USED_MEM / $TOTAL_MEM * 100" | bc)
|
||||
|
||||
sketchybar --set $NAME label=" $MEM_PERCENT%"
|
||||
30
home/dot_config/sketchybar/plugins/executable_power.sh
Normal file
30
home/dot_config/sketchybar/plugins/executable_power.sh
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
PERCENTAGE=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)
|
||||
CHARGING=$(pmset -g batt | grep 'AC Power')
|
||||
|
||||
if [ "$PERCENTAGE" = "" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case ${PERCENTAGE} in
|
||||
9[0-9] | 100)
|
||||
ICON=""
|
||||
;;
|
||||
[6-8][0-9])
|
||||
ICON=""
|
||||
;;
|
||||
[3-5][0-9])
|
||||
ICON=""
|
||||
;;
|
||||
[1-2][0-9])
|
||||
ICON=""
|
||||
;;
|
||||
*) ICON="" ;;
|
||||
esac
|
||||
|
||||
if [ "$CHARGING" != "" ]; then
|
||||
ICON=""
|
||||
fi
|
||||
|
||||
sketchybar --set "$NAME" icon="$ICON" label="${PERCENTAGE}% "
|
||||
20
home/dot_config/sketchybar/plugins/executable_sound.sh
Normal file
20
home/dot_config/sketchybar/plugins/executable_sound.sh
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
VOLUME=$(osascript -e "output volume of (get volume settings)")
|
||||
MUTED=$(osascript -e "output muted of (get volume settings)")
|
||||
|
||||
if [ "$MUTED" != "false" ]; then
|
||||
ICON=""
|
||||
VOLUME=0
|
||||
else
|
||||
case ${VOLUME} in
|
||||
100) ICON="" ;;
|
||||
[5-9]*) ICON="" ;;
|
||||
[0-9]*) ICON="" ;;
|
||||
*) ICON="" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
sketchybar -m \
|
||||
--set "$NAME" icon=$ICON \
|
||||
--set "$NAME" label="$VOLUME%"
|
||||
17
home/dot_config/sketchybar/plugins/executable_space.sh
Normal file
17
home/dot_config/sketchybar/plugins/executable_space.sh
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source "$HOME/.config/sketchybar/variables.sh" # Loads all defined colors
|
||||
|
||||
SPACE_CLICK_SCRIPT="yabai -m space --focus $SID 2>/dev/null"
|
||||
|
||||
if [ "$SELECTED" = "true" ]; then
|
||||
sketchybar --animate tanh 5 --set "$NAME" \
|
||||
icon.color="$RED" \
|
||||
icon="${SPACE_ICONS[$SID - 1]}" \
|
||||
click_script="$SPACE_CLICK_SCRIPT"
|
||||
else
|
||||
sketchybar --animate tanh 5 --set "$NAME" \
|
||||
icon.color="$COMMENT" \
|
||||
icon="${SPACE_ICONS[$SID - 1]}" \
|
||||
click_script="$SPACE_CLICK_SCRIPT"
|
||||
fi
|
||||
11
home/dot_config/sketchybar/plugins/executable_spotify.sh
Normal file
11
home/dot_config/sketchybar/plugins/executable_spotify.sh
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
STATE="$(echo "$INFO" | jq -r '.state')"
|
||||
APP="$(echo "$INFO" | jq -r '.app')"
|
||||
|
||||
if [ "$STATE" = "playing" ] && [ "$APP" == "Spotify" ]; then
|
||||
MEDIA="$(echo "$INFO" | jq -r '.title + " - " + .artist')"
|
||||
sketchybar --set "$NAME" label="$MEDIA" drawing=on
|
||||
else
|
||||
sketchybar --set "$NAME" drawing=off
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue