add sketchybar file and do more modularity stuff

This commit is contained in:
Natalie 2025-05-01 23:42:32 -07:00
parent 0959c9c2c3
commit 403c03dfb1
No known key found for this signature in database
GPG key ID: 61F4EAEB0C9C3D5F
6 changed files with 176 additions and 7 deletions

View file

@ -79,6 +79,9 @@
# ----- USER SETTINGS ----- #
userSettings = rec {
#enable if you want to use a tiling wm on macos
darwinTiling = true;
username = "nmarks"; # username
name = "Natalie"; # name/identifier
email = "nmarks413@gmail.com"; # email (used for certain configurations)

View file

@ -1,4 +1,8 @@
{pkgs, ...}: {
{
pkgs,
userSettings,
...
}: {
imports = [
../../modules/macos
];

View file

@ -53,6 +53,11 @@ in
systemFunc rec {
inherit system;
#gross and ugly hack do NOT like
specialArgs = {
inherit (userSettings) darwinTiling;
};
modules =
[
# Apply our overlays. Overlays are keyed by system type so we have

View file

@ -1,7 +1,13 @@
{pkgs, ...}: {
imports = [
./homebrew.nix
./system.nix
# ./tiling
];
{
pkgs,
lib,
darwinTiling,
...
}: {
imports =
[
./homebrew.nix
./system.nix
]
++ lib.optionals darwinTiling [./tiling];
}

View file

@ -1,5 +1,6 @@
{pkgs, ...}: {
imports = [
./aerospace.nix
./sketchybar.nix
];
}

View file

@ -0,0 +1,150 @@
{pkgs, ...}: {
services.sketchybar = {
enable = true;
config = ''
# This is a demo config to showcase some of the most important commands.
# It is meant to be changed and configured, as it is intentionally kept sparse.
# For a (much) more advanced configuration example see my dotfiles:
# https://github.com/FelixKratz/dotfiles
PLUGIN_DIR="$CONFIG_DIR/plugins"
##### Bar Appearance #####
# Configuring the general appearance of the bar.
# These are only some of the options available. For all options see:
# https://felixkratz.github.io/SketchyBar/config/bar
# If you are looking for other colors, see the color picker:
# https://felixkratz.github.io/SketchyBar/config/tricks#color-picker
sketchybar --bar position=top height=40 blur_radius=30 color=0x04313244
# Colours
SURFACE=0xff313244
##### Changing Defaults #####
# We now change some default values, which are applied to all further items.
# For a full list of all available item properties see:
# https://felixkratz.github.io/SketchyBar/config/items
default=(
padding_left=5
padding_right=5
icon.font="Hack Nerd Font:Bold:17.0"
label.font="Hack Nerd Font:Bold:14.0"
icon.color=0xffcdd6f4
label.color=0xffcdd6f4
icon.padding_left=8
icon.padding_right=4
label.padding_left=4
label.padding_right=8
background.padding_left=2
background.padding_right=2
background.color=$SURFACE \
background.corner_radius=10 \
background.height=30 \
background.border_width=1 \
)
sketchybar --default "$\{default[@]}"
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.border_width=1 \
background.border_color=0xffb4befe \
background.corner_radius=5 \
background.height=20 \
icon.padding_left=0 \
icon.padding_right=0 \
label.padding_right=6 \
label="$sid" \
click_script="aerospace workspace $sid" \
script="$CONFIG_DIR/plugins/aerospace.sh $sid"
done
##### Adding Left Items #####
# We add some regular items to the left side of the bar, where
# only the properties deviating from the current defaults need to be set
sketchybar --add item chevron left \
--set chevron icon= label.drawing=off background.drawing=off \
icon.color=0xfff5e0dc \
--add item front_app left \
--set front_app icon.drawing=off script="$PLUGIN_DIR/front_app.sh" \
label.color=0xff94e2d5 \
label.padding_left=8 \
background.border_color=0xff94e2d5 \
--subscribe front_app front_app_switched
##### Adding Right Items #####
# In the same way as the left items we can add items to the right side.
# Additional position (e.g. center) are available, see:
# https://felixkratz.github.io/SketchyBar/config/items#adding-items-to-sketchybar
# Some items refresh on a fixed cycle, e.g. the clock runs its script once
# every 10s. Other items respond to events they subscribe to, e.g. the
# volume.sh script is only executed once an actual change in system audio
# volume is registered. More info about the event system can be found here:
# https://felixkratz.github.io/SketchyBar/config/events
sketchybar --add item clock right \
--set clock update_freq=10 icon=󰃰 script="$PLUGIN_DIR/clock.sh" \
icon.color=0xfffab387 \
label.color=0xffcdd6f4 \
background.color=$SURFACE \
background.corner_radius=10 \
background.height=30 \
--add item volume right \
--set volume script="$PLUGIN_DIR/volume.sh" \
label.color=0xffcdd6f4 \
background.color=$SURFACE \
background.corner_radius=10 \
background.height=30 \
--subscribe volume volume_change \
--add item battery right \
--set battery update_freq=120 script="$PLUGIN_DIR/battery.sh" \
label.color=0xffcdd6f4 \
background.color=$SURFACE \
background.corner_radius=10 \
background.height=30 \
--subscribe battery system_woke power_source_change
sketchybar -m --add item mullvad right \
--set mullvad icon= \
icon.color=0xfff38ba8 \
background.color=$SURFACE \
background.corner_radius=10 \
background.height=30 \
background.border_width=1 \
background.border_color=0xfff38ba8 \
label.padding_left=0 \
label.padding_right=0 \
icon.padding_left=6 \
update_freq=5 \
script="$PLUGIN_DIR/mullvad.sh"
# Add event
sketchybar -m --add event song_update com.apple.iTunes.playerInfo
# Add Music Item
sketchybar -m --add item music right \
--set music script="$PLUGIN_DIR/music.sh" \
click_script="$PLUGIN_DIR/music_click.sh" \
label.padding_right=10 \
label.color=0xffcdd6f4 \
background.color=$SURFACE \
background.corner_radius=10 \
background.height=30 \
background.border_width=1 \
background.border_color=0xfff38ba8 \
drawing=off \
--subscribe music song_update
##### Force all scripts to run the first time (never do this in a script) #####
sketchybar --update
'';
};
}