1
0
mirror of https://github.com/sameer1612/.dotfiles.git synced 2024-11-19 18:01:53 +02:00

added sketchybar integration for aerospace

This commit is contained in:
Sameer Kumar 2024-08-24 18:22:30 +05:30
parent 24fd4ba367
commit d3e3fde862
6 changed files with 97 additions and 5 deletions

View File

@ -1,4 +1,5 @@
start-at-login = true
after-startup-command = ['exec-and-forget sketchybar']
enable-normalization-flatten-containers = true
enable-normalization-opposite-orientation-for-nested-containers = true
@ -6,6 +7,9 @@ enable-normalization-opposite-orientation-for-nested-containers = true
on-focused-monitor-changed = ['move-mouse monitor-lazy-center']
on-focus-changed = "move-mouse window-lazy-center"
exec-on-workspace-change = ['/bin/bash', '-c',
'sketchybar --trigger aerospace_workspace_change FOCUSED_WORKSPACE=$AEROSPACE_FOCUSED_WORKSPACE'
]
[mode.main.binding]
alt-q = 'enable off'
@ -25,8 +29,6 @@ alt-comma = 'layout tiles horizontal vertical'
alt-1 = 'workspace 1'
alt-2 = 'workspace 2'
alt-3 = 'workspace 3'
alt-4 = 'workspace 4'
alt-5 = 'workspace 5'
alt-c = 'workspace c'
alt-g = 'workspace g'
alt-w = 'workspace w'
@ -34,8 +36,6 @@ alt-w = 'workspace w'
alt-shift-1 = ['move-node-to-workspace 1', 'workspace 1']
alt-shift-2 = ['move-node-to-workspace 2', 'workspace 2']
alt-shift-3 = ['move-node-to-workspace 3', 'workspace 3']
alt-shift-4 = ['move-node-to-workspace 4', 'workspace 4']
alt-shift-5 = ['move-node-to-workspace 5', 'workspace 5']
alt-shift-c = ['move-node-to-workspace c', 'workspace c']
alt-shift-g = ['move-node-to-workspace g', 'workspace g']
alt-shift-w = ['move-node-to-workspace w', 'workspace w']

View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
if [ "$1" = "$FOCUSED_WORKSPACE" ]; then
sketchybar --set $NAME background.drawing=on
else
sketchybar --set $NAME background.drawing=off
fi

View File

@ -0,0 +1,28 @@
#!/bin/sh
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
# The item invoking this script (name $NAME) will get its icon and label
# updated with the current battery status
sketchybar --set "$NAME" icon="$ICON" label="${PERCENTAGE}%"

View File

@ -0,0 +1,8 @@
#!/bin/sh
# The $NAME variable is passed from sketchybar and holds the name of
# the item invoking this script:
# https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
sketchybar --set "$NAME" label="$(date '+%d/%m %H:%M')"

47
.config/sketchybar/sketchybarrc Executable file
View File

@ -0,0 +1,47 @@
# !/bin/bash
PLUGIN_DIR="$CONFIG_DIR/plugins"
sketchybar --bar position=top height=40 blur_radius=30 color=15ffffff
default=(
padding_left=5
padding_right=5
icon.font="VictorMono Nerd Font:Regular:14.0"
label.font="SF Pro:Semibold:14.0"
icon.color=0xffffffff
label.color=0xffffffff
icon.padding_left=4
icon.padding_right=4
label.padding_left=4
label.padding_right=4
)
sketchybar --default "${default[@]}"
sketchybar --add item chevron left \
--set chevron icon= label.drawing=off \
sketchybar --add event aerospace_workspace_change
for sid in $(aerospace list-workspaces --all); do
sketchybar --add item space.$sid left \
--subscribe space.$sid aerospace_workspace_change \
--set space.$sid \
background.color=0x44ffffff \
background.corner_radius=5 \
background.height=25 \
background.drawing=off \
label.padding_right=15 \
label="$sid" \
click_script="aerospace workspace $sid" \
script="$CONFIG_DIR/plugins/aerospace.sh $sid"
done
sketchybar --add item clock right \
--set clock update_freq=10 icon= script="$PLUGIN_DIR/clock.sh" \
--add item battery right \
--set battery update_freq=120 script="$PLUGIN_DIR/battery.sh" \
--subscribe battery system_woke power_source_change
##### Force all scripts to run the first time (never do this in a script) #####
sketchybar --update

View File

@ -1,10 +1,11 @@
# .dotfiles
> Ninja Mac dotfiles, custom-tailored for awesomeness.
<img width="2056" alt="yabai-splits" src="https://github.com/sameer1612/.dotfiles/assets/39580073/bf096981-b098-418f-a1cc-93d8cb198aa2">
---
## Includes sane configurations for the following:
1. Neovim
@ -20,3 +21,4 @@
11. Zed
12. Tmux
13. Firefox
14. Sketchybar