chezmoi: macOS

This commit is contained in:
whoami 2025-09-27 16:00:34 +01:00
parent fff9275372
commit c1a63e4658
39 changed files with 10 additions and 284 deletions

View file

@ -15,13 +15,21 @@ scripts
.config/waybar
.config/wlogout
.config/krunnerrc
.config/systemd
.config/user-dirs.dirs
.config/user-dirs.locale
{{ end }}
{{ if eq .chezmoi.os "linux" }}
{{ if ne .chezmoi.osRelease.id "arch" }}
.config/*-flags.conf
{{ end }}
{{ end }}
{{ if ne .chezmoi.os "darwin" }}
Library
.config/karabiner
.config/sketchybar
.config/skhd
.config/yabai
{{ end}}

View file

@ -0,0 +1,997 @@
{
"title": "Fn -> Hyper",
"rules": [
{
"description": "Fn + Letter -> Left_Shift + Left_Option + Left_Control + Left_Command + Letter",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "grave_accent_and_tilde",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "grave_accent_and_tilde",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "1",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "1",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "2",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "2",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "3",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "3",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "4",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "4",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "5",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "5",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "6",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "6",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "7",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "7",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "8",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "8",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "9",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "9",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "0",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "0",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "hyphen",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "hyphen",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "equal_sign",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "equal_sign",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "q",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "q",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "w",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "w",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "e",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "e",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "r",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "r",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "t",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "t",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "y",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "y",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "u",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "u",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "i",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "i",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "o",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "o",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "p",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "p",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "open_bracket",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "open_bracket",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "close_bracket",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "close_bracket",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "backslash",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "backslash",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "a",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "a",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "s",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "s",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "d",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "d",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "f",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "f",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "g",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "g",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "h",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "h",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "j",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "j",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "k",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "k",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "l",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "l",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "semicolon",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "semicolon",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "quote",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "quote",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "z",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "z",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "x",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "x",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "c",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "c",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "v",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "v",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "b",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "b",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "n",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "n",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "m",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "m",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "comma",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "comma",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "period",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "period",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "slash",
"modifiers": {
"mandatory": ["fn"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "slash",
"modifiers": [
"left_shift",
"left_option",
"left_control",
"left_command"
]
}
]
}
]
}
]
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
automatic_backups

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,4 @@
# Karabiner
- `karabiner.json` is the configuration file for Karabiner-Elements, located in `~/.config/karabiner/`.
- Other files are considered as snippets for the configuration file.

View 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.."

View 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=("一" "二" "三" "四" "五" "六" "七" "八" "九" "十" "十一" "十二" "十三" "十四" "十五" "十六" "十七" "十八" "十九" "二十")

View 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

View 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"

View 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"

View 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"

View 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

View 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"

View 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= \

View 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

View 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

View 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"

View file

@ -0,0 +1,4 @@
#!/usr/bin/env bash
LABEL=$(date '+%H:%M:%S')
sketchybar --set "$NAME" label="$LABEL"

View 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}')"

View file

@ -0,0 +1,7 @@
#!/usr/bin/env bash
case "$SENDER" in
"front_app_switched")
sketchybar --set "$NAME" label="$INFO"
;;
esac

View 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%"

View 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}% "

View 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%"

View 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

View 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

172
home/dot_config/skhd/skhdrc Normal file
View file

@ -0,0 +1,172 @@
# $DOTFILES/platforms/mac/skhdrc
# Date: 2024-11-30
# Author: js0ny
# Location: $XDG_CONFIG_HOME/skhd/skhdrc
# Linking:
# ln -sf $DOTFILES/platforms/mac/skhdrc $XDG_CONFIG_HOME/skhd/skhdrc
# Navigation
fn - h : yabai -m window --focus west
fn - n : yabai -m window --focus south
fn - e : yabai -m window --focus north
fn - i : yabai -m window --focus east
# Moving windows
shift + fn - h : yabai -m window --warp west
shift + fn - n : yabai -m window --warp south
shift + fn - e : yabai -m window --warp north
shift + fn - i : yabai -m window --warp east
fn - 1 : yabai -m space --focus 1
fn - 2 : yabai -m space --focus 2
fn - 3 : yabai -m space --focus 3
fn - 4 : yabai -m space --focus 4
fn - 5 : yabai -m space --focus 5
fn - 6 : yabai -m space --focus 6
fn - 7 : yabai -m space --focus 7
fn - 8 : yabai -m space --focus 8
fn - 9 : yabai -m space --focus 9
fn - 0 : yabai -m space --focus 10
# minimize window
fn - m : yabai -m window --minimize
# float / unfloat window and center on screen
fn - f : yabai -m window --toggle float
# toggle window native fullscreen
shift + ctrl - f : yabai -m window --toggle native-fullscreen
# send window to a space
shift + fn - 1 : yabai -m window --space 1
shift + fn - 2 : yabai -m window --space 2
shift + fn - 3 : yabai -m window --space 3
shift + fn - 4 : yabai -m window --space 4
shift + fn - 5 : yabai -m window --space 5
shift + fn - 6 : yabai -m window --space 6
shift + fn - 7 : yabai -m window --space 7
shift + fn - 8 : yabai -m window --space 8
shift + fn - 9 : yabai -m window --space 9
shift + fn - 0 : yabai -m window --space 10
# open terminal
fn - r: wezterm-gui
# # moves focus between windows in the current focused display
# ctrl - h : yabai -m window --focus west
# ctrl - n : yabai -m window --focus south
# ctrl - e : yabai -m window --focus north
# ctrl - i : yabai -m window --focus east
#
# # moves focus between spaces
# cmd + ctrl + alt + shift - 1 : yabai -m space --focus 1
# cmd + ctrl + alt + shift - 2 : yabai -m space --focus 2
# cmd + ctrl + alt + shift - 3 : yabai -m space --focus 3
# cmd + ctrl + alt + shift - 4 : yabai -m space --focus 4
# cmd + ctrl + alt + shift - 5 : yabai -m space --focus 5
# cmd + ctrl + alt + shift - 6 : yabai -m space --focus 6
# cmd + ctrl + alt + shift - 7 : yabai -m space --focus 7
# cmd + ctrl + alt + shift - 8 : yabai -m space --focus 8
# cmd + ctrl + alt + shift - 9 : yabai -m space --focus 9
# cmd + ctrl + alt + shift - 0 : yabai -m space --focus 10
#
# # delete focused space
# cmd + ctrl + alt + shift - q : yabai -m space --destroy
#
# # toggle window split type
# alt - e : yabai -m window --toggle split
#
# # close window
# alt - x : yabai -m window --close
#
# # minimize window
# alt - m : yabai -m window --minimize
#
# # rotate tree
# alt - r : yabai -m space --rotate 90
#
# # mirror tree y-axis
# alt - y : yabai -m space --mirror y-axis
#
# # toggle desktop offset
# alt - a : yabai -m space --toggle padding; yabai -m space --toggle gap
#
# # toggle window parent zoom
# alt - d : yabai -m window --focus mouse && \
# yabai -m window --toggle zoom-parent
#
# # float / unfloat window and center on screen
# alt - t : yabai -m window --toggle float;\
# yabai -m window --grid 4:4:1:1:2:2
#
# # toggle window fullscreen zoom
# alt - f : yabai -m window --focus mouse && \
# yabai -m window --toggle zoom-fullscreen
#
# # toggle window native fullscreen
# shift + alt - f : yabai -m window --toggle native-fullscreen
#
# # increase gap in focused space
# alt - g : yabai -m space --gap rel:10
#
# # decrease gap in focused space
# shift + alt - g : yabai -m space --gap rel:-10
#
# # create a new space and follow focus
# alt - n : yabai -m space --create && \
# index="$(yabai -m query --displays --display | jq '.spaces[-1]')" && \
# yabai -m space --focus "${index}"
#
# # create a new space, move window and follow focus
# shift + alt - n : yabai -m space --create && \
# index="$(yabai -m query --displays --display | jq '.spaces[-1]')" && \
# yabai -m window --space "${index}" && \
# yabai -m space --focus "${index}"
#
# # balance size of windows
# shift + alt - 0 : yabai -m space --balance
#
# # swap window
# shift + alt - h : yabai -m window --swap west
# shift + alt - n : yabai -m window --swap south
# shift + alt - e : yabai -m window --swap north
# shift + alt - i : yabai -m window --swap east
#
# # move window
# shift + cmd - h : yabai -m window --warp west
# shift + cmd - n : yabai -m window --warp south
# shift + cmd - e : yabai -m window --warp north
# shift + cmd - i : yabai -m window --warp east
#
# # send window to a space
# shift + alt - 1 : yabai -m window --space 1
# shift + alt - 2 : yabai -m window --space 2
# shift + alt - 3 : yabai -m window --space 3
# shift + alt - 4 : yabai -m window --space 4
# shift + alt - 5 : yabai -m window --space 5
# shift + alt - 6 : yabai -m window --space 6
# shift + alt - 7 : yabai -m window --space 7
# shift + alt - 8 : yabai -m window --space 8
# shift + alt - 9 : yabai -m window --space 9
# shift + alt - 0 : yabai -m window --space 10
#
# # change layout of desktop
# ctrl + alt - a : yabai -m space --layout bsp
# ctrl + alt - d : yabai -m space --layout float
#
# # increase window size
# ctrl + alt - h : yabai -m window --resize left:-40:0
# ctrl + alt - n : yabai -m window --resize bottom:0:40
# ctrl + alt - e : yabai -m window --resize top:0:-40
# ctrl + alt - i : yabai -m window --resize right:40:0
#
# # decrease window size
# ctrl + alt + cmd - h : yabai -m window --resize left:40:0
# ctrl + alt + cmd - n : yabai -m window --resize bottom:0:-40
# ctrl + alt + cmd - e : yabai -m window --resize top:0:40
# ctrl + alt + cmd - i : yabai -m window --resize right:-40:0
#
# # restart yabai
# ctrl + alt + cmd - r : launchctl kickstart -k "gui/${UID}/homebrew.mxcl.yabai"
#

View file

@ -0,0 +1,61 @@
#!/usr/bin/env sh
# $DOTFILES/platforms/mac/yabairc
# Date: 2024-11-30
# Author: js0ny
#
# for this to work you must configure sudo such that
# it will be able to run the command without password
#
# see this wiki page for information:
# - https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(latest-release)#configure-scripting-addition
#
yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"
sudo yabai --load-sa
#
# global settings
yabai -m config \
top_padding 40 \
external_bar off:40:0 \
menubar_opacity 1.0 \
mouse_follows_focus off \
focus_follows_mouse off \
display_arrangement_order default \
window_origin_display default \
window_placement second_child \
window_zoom_persist on \
window_shadow on \
window_animation_duration 0.0 \
window_animation_easing ease_out_circ \
window_opacity_duration 0.0 \
active_window_opacity 1.0 \
normal_window_opacity 0.95 \
window_opacity on \
insert_feedback_color 0xffd75f5f \
split_ratio 0.50 \
split_type auto \
auto_balance off \
bottom_padding 12 \
left_padding 12 \
right_padding 12 \
window_gap 06 \
layout bsp \
mouse_modifier fn \
mouse_action1 move \
mouse_action2 resize \
mouse_drop_action swap \
focus_follows_mouse autofocus \
mouse_follows_focus on
# Application-Specific Settings
# Use iTerm2 only for Hotkey Window (aka quake/drop-down terminal)
yabai -m rule --add app="iTerm2" manage=off
yabai -m rule --add app="Raycast" manage=off
yabai -m rule --add app="^System Information$" sticky=on manage=off
yabai -m rule --add app="^System Settings$" sticky=on manage=off
yabai -m rule --add title="^Zotero Settings$" sticky=on manage=off
borders active_color="gradient(top_left=0xffff9e64,bottom_right=0xffbb9af7)" inactive_color="gradient(top_left=0x40ff9e64,bottom_right=0x40bb9af7)" width=5 2>/dev/null 1>&2 &
echo "yabai configuration loaded.."

View file

@ -0,0 +1,29 @@
// ~/Library/Keybindings/DefaultKeyBinding.dict
{
"~a" = ();
"~b" = ();
"~c" = ();
"~d" = ();
"~e" = ();
"~f" = ();
"~g" = ();
"~h" = ();
"~i" = ();
"~j" = ();
"~k" = ();
"~l" = ();
"~m" = ();
"~n" = ();
"~o" = ();
"~p" = ();
"~q" = ();
"~r" = ();
"~s" = ();
"~t" = ();
"~u" = ();
"~v" = ();
"~w" = ();
"~x" = ();
"~y" = ();
"~z" = ();
}