diff --git a/.gitignore b/.gitignore index 301d47e..5ad4d89 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ flake.lock +.DS_STORE +**/.DS_STORE diff --git a/files/sketchybar/executable_colors.sh b/files/sketchybar/executable_colors.sh old mode 100644 new mode 100755 diff --git a/files/sketchybar/executable_icons.sh b/files/sketchybar/icons.sh similarity index 100% rename from files/sketchybar/executable_icons.sh rename to files/sketchybar/icons.sh diff --git a/files/sketchybar/plugins/executable_yabai.sh b/files/sketchybar/plugins/executable_yabai.sh deleted file mode 100644 index 5ae2ae1..0000000 --- a/files/sketchybar/plugins/executable_yabai.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/sh - -window_state() { - source "$HOME/.config/sketchybar/colors.sh" - source "$HOME/.config/sketchybar/icons.sh" - - WINDOW=$(yabai -m query --windows --window) - CURRENT=$(echo "$WINDOW" | jq '.["stack-index"]') - - args=() - if [[ $CURRENT -gt 0 ]]; then - LAST=$(yabai -m query --windows --window stack.last | jq '.["stack-index"]') - args+=(--set $NAME icon=$YABAI_STACK icon.color=$RED label.drawing=on label=$(printf "[%s/%s]" "$CURRENT" "$LAST")) - yabai -m config active_window_border_color $RED > /dev/null 2>&1 & - - else - args+=(--set $NAME label.drawing=off) - case "$(echo "$WINDOW" | jq '.["is-floating"]')" in - "false") - if [ "$(echo "$WINDOW" | jq '.["has-fullscreen-zoom"]')" = "true" ]; then - args+=(--set $NAME icon=$YABAI_FULLSCREEN_ZOOM icon.color=$GREEN) - yabai -m config active_window_border_color $GREEN > /dev/null 2>&1 & - elif [ "$(echo "$WINDOW" | jq '.["has-parent-zoom"]')" = "true" ]; then - args+=(--set $NAME icon=$YABAI_PARENT_ZOOM icon.color=$BLUE) - yabai -m config active_window_border_color $BLUE > /dev/null 2>&1 & - else - args+=(--set $NAME icon=$YABAI_GRID icon.color=$ORANGE) - yabai -m config active_window_border_color $WHITE > /dev/null 2>&1 & - fi - ;; - "true") - args+=(--set $NAME icon=$YABAI_FLOAT icon.color=$MAGENTA) - yabai -m config active_window_border_color $MAGENTA > /dev/null 2>&1 & - ;; - esac - fi - - sketchybar -m "${args[@]}" -} - -windows_on_spaces () { - CURRENT_SPACES="$(yabai -m query --displays | jq -r '.[].spaces | @sh')" - - args=() - while read -r line - do - for space in $line - do - icon_strip=" " - apps=$(yabai -m query --windows --space $space | jq -r ".[].app") - for app in $apps - do - icon_strip+=" $($HOME/.config/sketchybar/plugins/icon_map.sh "$app")" - done - args+=(--set space.$space label="$icon_strip" label.drawing=on) - done - done <<< "$CURRENT_SPACES" - - sketchybar -m "${args[@]}" -} - -mouse_clicked() { - yabai -m window --toggle float - update -} - -case "$SENDER" in - "mouse.clicked") mouse_clicked - ;; - "forced") exit 0 - ;; - "window_focus") window_state - ;; - "windows_on_spaces") windows_on_spaces - ;; -esac diff --git a/flake.lock b/flake.lock index 8041ecc..7e69580 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,33 @@ { "nodes": { + "apple-fonts": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "ny": "ny", + "sf-arabic": "sf-arabic", + "sf-armenian": "sf-armenian", + "sf-compact": "sf-compact", + "sf-georgian": "sf-georgian", + "sf-hebrew": "sf-hebrew", + "sf-mono": "sf-mono", + "sf-pro": "sf-pro" + }, + "locked": { + "lastModified": 1740961576, + "narHash": "sha256-9L6d3owtajM72YvUOpK1zYle2nM0BpsuopbF9lm9lJs=", + "owner": "Lyndeno", + "repo": "apple-fonts.nix", + "rev": "4df58996ed654f6ce9b71b41c1826484c6870739", + "type": "github" + }, + "original": { + "owner": "Lyndeno", + "repo": "apple-fonts.nix", + "type": "github" + } + }, "base16": { "inputs": { "fromYaml": "fromYaml" @@ -805,8 +833,21 @@ "type": "github" } }, + "ny": { + "flake": false, + "locked": { + "narHash": "sha256-3257NAH4qlan2YHVLpNRy7x8IJqR2pal3OzFo/ykqXs=", + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/NY.dmg" + }, + "original": { + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/NY.dmg" + } + }, "root": { "inputs": { + "apple-fonts": "apple-fonts", "darwin": "darwin", "home-manager": "home-manager", "moonlight": "moonlight", @@ -864,6 +905,90 @@ "type": "github" } }, + "sf-arabic": { + "flake": false, + "locked": { + "narHash": "sha256-/0gjRimqvZyE60xYxxPdlU+7Q2LJnnvtbmwOP0YmS9U=", + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Arabic.dmg" + }, + "original": { + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Arabic.dmg" + } + }, + "sf-armenian": { + "flake": false, + "locked": { + "narHash": "sha256-rRoDkbNMYkzOHZmQm96Zv80TZvRlAeoxkv4pMHP5nUg=", + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Armenian.dmg" + }, + "original": { + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Armenian.dmg" + } + }, + "sf-compact": { + "flake": false, + "locked": { + "narHash": "sha256-J72Lyt2wy83E46wN8w6/Rih9kilM9wEjtY6KnbF0DsA=", + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Compact.dmg" + }, + "original": { + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Compact.dmg" + } + }, + "sf-georgian": { + "flake": false, + "locked": { + "narHash": "sha256-IevVNOC28IiR45YfI3PsZzXLMRxuB5u7UiE53Zn6tRU=", + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Georgian.dmg" + }, + "original": { + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Georgian.dmg" + } + }, + "sf-hebrew": { + "flake": false, + "locked": { + "narHash": "sha256-Dw84kYwMpCtKKKqm8cZcQ9TZ7GayU5MO7W0LJw0Rcwk=", + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Hebrew.dmg" + }, + "original": { + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Hebrew.dmg" + } + }, + "sf-mono": { + "flake": false, + "locked": { + "narHash": "sha256-ICdHRFdNL7PM/fXJUzS7LgZxZiqcyIuCMHLze4En4vg=", + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Mono.dmg" + }, + "original": { + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Mono.dmg" + } + }, + "sf-pro": { + "flake": false, + "locked": { + "narHash": "sha256-Q/pOQ4MGhW/ZtLka+UUQcwSoZFDWW34XvutxL4GvzUY=", + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Pro.dmg" + }, + "original": { + "type": "file", + "url": "https://devimages-cdn.apple.com/design/resources/download/SF-Pro.dmg" + } + }, "stylix": { "inputs": { "base16": "base16", diff --git a/flake.nix b/flake.nix index 1dc8696..07c39d1 100644 --- a/flake.nix +++ b/flake.nix @@ -13,6 +13,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + apple-fonts = { + url = "github:Lyndeno/apple-fonts.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nixvim = { url = "github:nix-community/nixvim"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/modules/macos/homebrew.nix b/modules/macos/homebrew.nix index ac0258f..f149ae8 100644 --- a/modules/macos/homebrew.nix +++ b/modules/macos/homebrew.nix @@ -22,6 +22,7 @@ _: { "zulip" "zen-browser" "supertuxkart" + "sf-symbols" "mediosz/tap/swipeaerospace" ]; diff --git a/modules/macos/tiling/aerospace.nix b/modules/macos/tiling/aerospace.nix index 58d0be3..83aace4 100644 --- a/modules/macos/tiling/aerospace.nix +++ b/modules/macos/tiling/aerospace.nix @@ -110,7 +110,10 @@ up = "volume up"; shift-down = ["volume set 0" "mode main"]; }; - after-startup-command = ["exec-and-forget sketchybar"]; + after-startup-command = [ + "exec-and-forget sketchybar" + "exec-and-forget open /Applications/SwipeAeroSpace.app" + ]; exec-on-workspace-change = [ "/bin/bash" "-c" diff --git a/modules/macos/tiling/sketchybar-home.nix b/modules/macos/tiling/sketchybar-home.nix index 9ed4f47..09ef2c2 100644 --- a/modules/macos/tiling/sketchybar-home.nix +++ b/modules/macos/tiling/sketchybar-home.nix @@ -1,5 +1,11 @@ -{pkgs, ...}: let - folder = "../../../files/sketchybar/"; +{ + pkgs, + config, + ... +}: let + # folder = "${config.home.homeDirectory}.dotfiles/files/sketchybar"; + # folder = "~/.dotfiles/files/sketchybar"; + folder = ../../../files/sketchybar; in { home.file = { sketchybarrc = { @@ -27,16 +33,16 @@ in { # launchctl unload -F /System/Library/LaunchAgents/com.apple.OSDUIHelper.plist > /dev/null 2>&1 & # Setting up the general bar appearance and default values - ${pkgs.sketchybar}/bin/sketchybar --bar height=50 \ + ${pkgs.sketchybar}/bin/sketchybar --bar height=40 \ color=$BAR_COLOR \ shadow=off \ position=top \ sticky=on \ - padding_right=7 \ - padding_left=7 \ + padding_right=0 \ + padding_left=0 \ corner_radius=12 \ - y_offset=20 \ - margin=40 \ + y_offset=0 \ + margin=2 \ blur_radius=0 \ notch_width=0 \ --default updates=when_shown \ @@ -83,7 +89,7 @@ in { icons = { executable = true; target = ".config/sketchybar/icons.sh"; - text = builtins.readFile "${folder}/executable_icons.sh"; + source = folder + /icons.sh; }; colors = { executable = true; @@ -120,12 +126,12 @@ in { items_apple = { executable = true; target = ".config/sketchybar/items/apple.sh"; - text = builtins.readFile "${folder}/items/executable_apple.sh"; + source = folder + /items/executable_apple.sh; }; items_brew = { executable = true; target = ".config/sketchybar/items/brew.sh"; - text = builtins.readFile "${folder}/items/executable_brew.sh"; + source = folder + /items/executable_brew.sh; }; items_calendar = { executable = true; @@ -149,12 +155,12 @@ in { items_cpu = { executable = true; target = ".config/sketchybar/items/cpu.sh"; - text = builtins.readFile "${folder}/items/executable_cpu.sh"; + source = folder + /items/executable_cpu.sh; }; items_divider = { executable = true; target = ".config/sketchybar/items/divider.sh"; - text = builtins.readFile "${folder}/items/executable_divider.sh"; + source = folder + /items/executable_divider.sh; }; items_front_app = { executable = true; @@ -165,7 +171,7 @@ in { sketchybar --add event window_focus \ --add event windows_on_spaces \ --add item system.aerospace left \ - --set system.aerospace script="$PLUGIN_DIR/yabai.sh" \ + --set system.aerospace script="$PLUGIN_DIR/aerospace.sh" \ icon.font="$FONT:Bold:16.0" \ label.drawing=off \ icon.width=30 \ @@ -190,7 +196,7 @@ in { items_github = { executable = true; target = ".config/sketchybar/items/github.sh"; - text = builtins.readFile "${folder}/items/executable_github.sh"; + source = folder + /items/executable_github.sh; }; items_spaces = { executable = true; @@ -216,7 +222,7 @@ in { background.drawing=on \ script="$PLUGIN_DIR/aerospace.sh $sid" \ click_script="aerospace workspace $sid" \ - label.font="JetBrainsMono Nerd Font:Regular:16.0" \ + label.font="Iosevka Nerd Font:Regular:16.0" \ label.padding_right=33 \ label.background.height=26 \ label.background.drawing=on \ @@ -225,7 +231,7 @@ in { done ${pkgs.sketchybar}/bin/sketchybar --add item separator left \ --set separator icon= \ - icon.font="JetBrainsMono Nerd Font:Regular:16.0" \ + icon.font="Iosevka Nerd Font:Regular:16.0" \ background.padding_left=26 \ background.padding_right=15 \ label.drawing=off \ @@ -236,7 +242,7 @@ in { items_spotify = { executable = true; target = ".config/sketchybar/items/spotify.sh"; - text = builtins.readFile "${folder}/items/executable_spotify.sh"; + source = folder + /items/executable_spotify.sh; }; items_volume = { executable = true; @@ -277,32 +283,32 @@ in { plugins_brew = { executable = true; target = ".config/sketchybar/plugins/brew.sh"; - text = builtins.readFile "${folder}/plugins/executable_brew.sh"; + source = folder + /plugins/executable_brew.sh; }; plugins_calendar = { executable = true; target = ".config/sketchybar/plugins/calendar.sh"; - text = builtins.readFile "${folder}/plugins/executable_calendar.sh"; + source = folder + /plugins/executable_calendar.sh; }; plugins_github = { executable = true; target = ".config/sketchybar/plugins/github.sh"; - text = builtins.readFile "${folder}/plugins/executable_github.sh"; + source = folder + /plugins/executable_github.sh; }; plugins_icon_map = { executable = true; target = ".config/sketchybar/plugins/icon_map.sh"; - text = builtins.readFile "${folder}/plugins/executable_icon_map.sh"; + source = folder + /plugins/executable_icon_map.sh; }; plugins_space = { executable = true; target = ".config/sketchybar/plugins/space.sh"; - text = builtins.readFile "${folder}/plugins/executable_space.sh"; + source = folder + /plugins/executable_space.sh; }; plugins_spotify = { executable = true; target = ".config/sketchybar/plugins/spotify.sh"; - text = builtins.readFile "${folder}/plugins/executable_spotify.sh"; + source = folder + /plugins/executable_spotify.sh; }; plugins_volume = { executable = true; @@ -347,15 +353,10 @@ in { fi ''; }; - plugins_yabai = { - executable = true; - target = ".config/sketchybar/plugins/yabai.sh"; - text = builtins.readFile "${folder}/plugins/executable_yabai.sh"; - }; plugins_zen = { executable = true; target = ".config/sketchybar/plugins/zen.sh"; - text = builtins.readFile "${folder}/plugins/executable_zen.sh"; + source = folder + /plugins/executable_zen.sh; }; plugins_aerospace = { executable = true; diff --git a/modules/shared/extras.nix b/modules/shared/extras.nix index 661b60d..d1ba2b5 100644 --- a/modules/shared/extras.nix +++ b/modules/shared/extras.nix @@ -1,4 +1,5 @@ { + inputs, pkgs, userSettings, ... @@ -13,6 +14,7 @@ iosevka nerd-fonts.symbols-only nerd-fonts.iosevka + inputs.apple-fonts.packages.${pkgs.system}.sf-pro ]; # Set your time zone.