| author | |
| committer | |
| log | 69e9b167cbf154160adcdd28dcc7f6c4f901ee97 |
| tree | 3be9a8687743f2fd7f4254d71bd36b4839d9006a |
| parent | 3449484e73eaf94679f490f8c96a7b187997462d |
| signature | Commit is signed but in an unrecognized format. |
12 files changed, 898 insertions(+), 1215 deletions(-)
flake.nix+104-107| ... | ... | @@ -39,72 +39,71 @@ |
| 39 | 39 | nix-index-database.url = "github:nix-community/nix-index-database"; |
| 40 | 40 | nix-index-database.inputs.nixpkgs.follows = "nixpkgs"; |
| 41 | 41 | }; |
| 42 | outputs = | |
| 43 | { | |
| 44 | nixpkgs, | |
| 45 | nixos-cosmic, | |
| 46 | darwin, | |
| 47 | ... | |
| 48 | }@inputs: | |
| 49 | let | |
| 50 | lib = nixpkgs.lib; | |
| 51 | ||
| 52 | # TODO: apply these overlays sooner and remove uses of legacyPackages elsewhere. | |
| 53 | overlays = [ | |
| 54 | inputs.zig.overlays.default | |
| 55 | inputs.rust-overlay.overlays.default | |
| 56 | inputs.nh.overlays.default | |
| 57 | ||
| 58 | # https://github.com/LnL7/nix-darwin/issues/1041 | |
| 59 | (_: prev: { | |
| 60 | karabiner-elements = prev.karabiner-elements.overrideAttrs (old: { | |
| 61 | version = "14.13.0"; | |
| 62 | ||
| 63 | src = prev.fetchurl { | |
| 64 | inherit (old.src) url; | |
| 65 | hash = "sha256-gmJwoht/Tfm5qMecmq1N6PSAIfWOqsvuHU8VDJY8bLw="; | |
| 66 | }; | |
| 67 | }); | |
| 42 | outputs = { | |
| 43 | self, | |
| 44 | nixpkgs, | |
| 45 | nixos-cosmic, | |
| 46 | darwin, | |
| 47 | ... | |
| 48 | } @ inputs: let | |
| 49 | lib = nixpkgs.lib; | |
| 50 | ||
| 51 | # TODO: apply these overlays sooner and remove uses of legacyPackages elsewhere. | |
| 52 | overlays = [ | |
| 53 | inputs.zig.overlays.default | |
| 54 | inputs.rust-overlay.overlays.default | |
| 55 | inputs.nh.overlays.default | |
| 56 | ||
| 57 | # https://github.com/LnL7/nix-darwin/issues/1041 | |
| 58 | (_: prev: { | |
| 59 | karabiner-elements = prev.karabiner-elements.overrideAttrs (old: { | |
| 60 | version = "14.13.0"; | |
| 61 | ||
| 62 | src = prev.fetchurl { | |
| 63 | inherit (old.src) url; | |
| 64 | hash = "sha256-gmJwoht/Tfm5qMecmq1N6PSAIfWOqsvuHU8VDJY8bLw="; | |
| 65 | }; | |
| 66 | }); | |
| 67 | }) | |
| 68 | ]; | |
| 69 | ||
| 70 | # Users of this flake currently use x86_64 Linux and Apple Silicon | |
| 71 | systems = [ | |
| 72 | "x86_64-linux" | |
| 73 | "aarch64-darwin" | |
| 74 | ]; | |
| 75 | forAllSystems = f: | |
| 76 | builtins.listToAttrs ( | |
| 77 | builtins.map (system: { | |
| 78 | name = system; | |
| 79 | value = f ( | |
| 80 | inputs | |
| 81 | // { | |
| 82 | inherit system; | |
| 83 | pkgs = nixpkgs.legacyPackages.${system}; | |
| 84 | } | |
| 85 | ); | |
| 68 | 86 | }) |
| 69 | ]; | |
| 87 | systems | |
| 88 | ); | |
| 70 | 89 | |
| 71 | # Users of this flake currently use x86_64 Linux and Apple Silicon | |
| 72 | systems = [ | |
| 73 | "x86_64-linux" | |
| 74 | "aarch64-darwin" | |
| 75 | ]; | |
| 76 | forAllSystems = | |
| 77 | f: | |
| 78 | builtins.listToAttrs ( | |
| 79 | builtins.map (system: { | |
| 80 | name = system; | |
| 81 | value = f ( | |
| 82 | inputs | |
| 83 | // { | |
| 84 | inherit system; | |
| 85 | pkgs = nixpkgs.legacyPackages.${system}; | |
| 86 | } | |
| 87 | ); | |
| 88 | }) systems | |
| 89 | ); | |
| 90 | ||
| 91 | mkSystem = import ./lib/mkSystem.nix { | |
| 92 | inherit | |
| 93 | overlays | |
| 94 | nixpkgs | |
| 95 | inputs | |
| 96 | mkNeovim | |
| 97 | ; | |
| 98 | }; | |
| 99 | mkNeovim = import ./lib/mkNeovim.nix { | |
| 100 | inherit overlays nixpkgs inputs; | |
| 101 | }; | |
| 102 | in | |
| 103 | rec { | |
| 104 | # "nix fmt" | |
| 105 | formatter = forAllSystems (inputs: inputs.pkgs.nixfmt-tree); | |
| 106 | packages = forAllSystems ( | |
| 107 | { system, ... }: | |
| 90 | mkSystem = import ./lib/mkSystem.nix { | |
| 91 | inherit | |
| 92 | overlays | |
| 93 | nixpkgs | |
| 94 | inputs | |
| 95 | mkNeovim | |
| 96 | ; | |
| 97 | }; | |
| 98 | mkNeovim = import ./lib/mkNeovim.nix { | |
| 99 | inherit self overlays nixpkgs inputs; | |
| 100 | }; | |
| 101 | in rec { | |
| 102 | inherit self; | |
| 103 | # "nix fmt" | |
| 104 | formatter = forAllSystems (inputs: inputs.pkgs.nixfmt-tree); | |
| 105 | packages = forAllSystems ( | |
| 106 | {system, ...}: | |
| 108 | 107 | { |
| 109 | 108 | nvim-chloe = mkNeovim "chloe" system; |
| 110 | 109 | nvim-natalie = mkNeovim "natalie" system; |
| ... | ... | @@ -113,49 +112,47 @@ |
| 113 | 112 | # "nix run .#darwin-rebuild" |
| 114 | 113 | darwin-rebuild = darwin.packages.aarch64-darwin.darwin-rebuild; |
| 115 | 114 | } |
| 116 | ); | |
| 115 | ); | |
| 116 | ||
| 117 | # natalie's desktop computer | |
| 118 | nixosConfigurations.nixos = mkSystem "nixos" { | |
| 119 | user = "natalie"; | |
| 120 | host = "desktop"; | |
| 121 | system = "x86_64-linux"; | |
| 122 | extraModules = [ | |
| 123 | nixos-cosmic.nixosModules.default | |
| 124 | ]; | |
| 125 | }; | |
| 126 | # natalie's laptop | |
| 127 | darwinConfigurations."Natalies-MacBook-Air" = mkSystem "Natalies-MacBook-Air" { | |
| 128 | user = "natalie"; | |
| 129 | host = "laptop"; | |
| 130 | system = "aarch64-darwin"; | |
| 131 | }; | |
| 117 | 132 | |
| 118 | # natalie's desktop computer | |
| 119 | nixosConfigurations.nixos = mkSystem "nixos" { | |
| 120 | user = "natalie"; | |
| 121 | host = "desktop"; | |
| 122 | system = "x86_64-linux"; | |
| 123 | extraModules = [ | |
| 124 | nixos-cosmic.nixosModules.default | |
| 125 | ]; | |
| 126 | }; | |
| 127 | # natalie's laptop | |
| 128 | darwinConfigurations."Natalies-MacBook-Air" = mkSystem "Natalies-MacBook-Air" { | |
| 129 | user = "natalie"; | |
| 130 | host = "laptop"; | |
| 131 | system = "aarch64-darwin"; | |
| 132 | }; | |
| 133 | ||
| 134 | # chloe's mac studio "sandwich" | |
| 135 | darwinConfigurations.sandwich = mkSystem "sandwich" { | |
| 136 | user = "chloe"; | |
| 137 | host = "sandwich"; | |
| 138 | system = "aarch64-darwin"; | |
| 139 | }; | |
| 140 | # chloe's macbook air "paperback" | |
| 141 | darwinConfigurations.paperback = mkSystem "paperback" { | |
| 142 | user = "chloe"; | |
| 143 | host = "paperback"; | |
| 144 | system = "aarch64-darwin"; | |
| 145 | }; | |
| 146 | ||
| 147 | # generate checks for "nix flake check --all-systems --no-build" | |
| 148 | checks.aarch64-darwin = builtins.listToAttrs ( | |
| 149 | builtins.map ( | |
| 150 | name: | |
| 151 | let | |
| 152 | d = darwinConfigurations.${name}.system; | |
| 153 | in | |
| 154 | { | |
| 155 | name = "darwinConfiguration-" + d.name; | |
| 156 | value = d; | |
| 157 | } | |
| 158 | ) (builtins.attrNames darwinConfigurations) | |
| 159 | ); | |
| 133 | # chloe's mac studio "sandwich" | |
| 134 | darwinConfigurations.sandwich = mkSystem "sandwich" { | |
| 135 | user = "chloe"; | |
| 136 | host = "sandwich"; | |
| 137 | system = "aarch64-darwin"; | |
| 138 | }; | |
| 139 | # chloe's macbook air "paperback" | |
| 140 | darwinConfigurations.paperback = mkSystem "paperback" { | |
| 141 | user = "chloe"; | |
| 142 | host = "paperback"; | |
| 143 | system = "aarch64-darwin"; | |
| 160 | 144 | }; |
| 145 | ||
| 146 | # generate checks for "nix flake check --all-systems --no-build" | |
| 147 | checks.aarch64-darwin = builtins.listToAttrs ( | |
| 148 | builtins.map ( | |
| 149 | name: let | |
| 150 | d = darwinConfigurations.${name}.system; | |
| 151 | in { | |
| 152 | name = "darwinConfiguration-" + d.name; | |
| 153 | value = d; | |
| 154 | } | |
| 155 | ) (builtins.attrNames darwinConfigurations) | |
| 156 | ); | |
| 157 | }; | |
| 161 | 158 | } |
lib/mkNeovim.nix+14-14| ... | ... | @@ -1,11 +1,10 @@ |
| 1 | 1 | { |
| 2 | self, | |
| 2 | 3 | nixpkgs, |
| 3 | 4 | # TODO: apply overlays here |
| 4 | 5 | overlays, |
| 5 | 6 | inputs, |
| 6 | }: | |
| 7 | user: system: | |
| 8 | let | |
| 7 | }: user: system: let | |
| 9 | 8 | darwin = nixpkgs.lib.strings.hasSuffix "-darwin" system; |
| 10 | 9 | |
| 11 | 10 | host = { |
| ... | ... | @@ -16,14 +15,15 @@ let |
| 16 | 15 | userDir = ../users + "/${user}"; |
| 17 | 16 | userConfig = import (userDir + "/user.nix"); |
| 18 | 17 | in |
| 19 | (inputs.nvf.lib.neovimConfiguration { | |
| 20 | pkgs = nixpkgs.legacyPackages.${system}; | |
| 21 | modules = builtins.filter (f: f != null) [ | |
| 22 | (../users + ("/" + user + "/vim.nix")) | |
| 23 | ../modules/neovim | |
| 24 | ]; | |
| 25 | extraSpecialArgs = { | |
| 26 | inherit host; | |
| 27 | user = userConfig; | |
| 28 | }; | |
| 29 | }).neovim | |
| 18 | (inputs.nvf.lib.neovimConfiguration { | |
| 19 | pkgs = nixpkgs.legacyPackages.${system}; | |
| 20 | modules = builtins.filter (f: f != null) [ | |
| 21 | (../users + ("/" + user + "/vim.nix")) | |
| 22 | ../modules/neovim | |
| 23 | ]; | |
| 24 | extraSpecialArgs = { | |
| 25 | inherit host; | |
| 26 | flake = self; | |
| 27 | user = userConfig; | |
| 28 | }; | |
| 29 | }).neovim |
lib/mkSystem.nix+78-56| ... | ... | @@ -5,20 +5,29 @@ |
| 5 | 5 | overlays, |
| 6 | 6 | inputs, |
| 7 | 7 | mkNeovim, |
| 8 | }: | |
| 9 | name: | |
| 10 | { | |
| 8 | }: name: { | |
| 11 | 9 | user, # ./users/{name} |
| 12 | 10 | host, # ./users/{name}/{host} (optional) |
| 13 | 11 | system, # arch-os |
| 14 | extraModules ? [ ], | |
| 15 | }: | |
| 16 | let | |
| 12 | extraModules ? [], | |
| 13 | }: let | |
| 17 | 14 | darwin = nixpkgs.lib.strings.hasSuffix "-darwin" system; |
| 18 | getInputModule = a: b: inputs.${a}.${if darwin then "darwinModules" else "nixosModules"}.${b}; | |
| 15 | getInputModule = a: b: | |
| 16 | inputs.${ | |
| 17 | a | |
| 18 | }.${ | |
| 19 | if darwin | |
| 20 | then "darwinModules" | |
| 21 | else "nixosModules" | |
| 22 | }.${ | |
| 23 | b | |
| 24 | }; | |
| 19 | 25 | |
| 20 | 26 | # NixOS vs nix-darwin functions |
| 21 | systemFunc = if darwin then inputs.darwin.lib.darwinSystem else nixpkgs.lib.nixosSystem; | |
| 27 | systemFunc = | |
| 28 | if darwin | |
| 29 | then inputs.darwin.lib.darwinSystem | |
| 30 | else nixpkgs.lib.nixosSystem; | |
| 22 | 31 | |
| 23 | 32 | userDir = ../users + "/${user}"; |
| 24 | 33 | userConfig = import (userDir + "/user.nix"); |
| ... | ... | @@ -29,7 +38,10 @@ let |
| 29 | 38 | hostHomePath = hostDir + "/home.nix"; |
| 30 | 39 | userHomePath = userDir + "/home.nix"; |
| 31 | 40 | |
| 32 | pathOrNull = a: if builtins.pathExists a then a else null; | |
| 41 | pathOrNull = a: | |
| 42 | if builtins.pathExists a | |
| 43 | then a | |
| 44 | else null; | |
| 33 | 45 | |
| 34 | 46 | # Arguments passed to all module files |
| 35 | 47 | args = { |
| ... | ... | @@ -56,14 +68,18 @@ let |
| 56 | 68 | term, # preferred $TERM |
| 57 | 69 | editor, # preferred $EDITOR |
| 58 | 70 | browser ? null, # preferred $BROWSER |
| 59 | }@user: | |
| 60 | user | |
| 71 | } @ user: | |
| 72 | user | |
| 61 | 73 | ) |
| 62 | userConfig; | |
| 74 | userConfig; | |
| 63 | 75 | }; |
| 64 | 76 | systemSettings = rec { |
| 65 | 77 | inherit darwin; |
| 66 | homeDir = "/${if darwin then "Users" else "home"}/${userConfig.username}"; | |
| 78 | homeDir = "/${ | |
| 79 | if darwin | |
| 80 | then "Users" | |
| 81 | else "home" | |
| 82 | }/${userConfig.username}"; | |
| 67 | 83 | }; |
| 68 | 84 | |
| 69 | 85 | mainHomeImports = builtins.filter (f: f != null) [ |
| ... | ... | @@ -76,54 +92,60 @@ let |
| 76 | 92 | } |
| 77 | 93 | ]; |
| 78 | 94 | in |
| 79 | systemFunc { | |
| 80 | inherit system; | |
| 95 | systemFunc { | |
| 96 | inherit system; | |
| 81 | 97 | |
| 82 | modules = | |
| 83 | builtins.filter (f: f != null) [ | |
| 84 | # Apply our overlays. Overlays are keyed by system type so we have | |
| 85 | # to go through and apply our system type. We do this first so | |
| 86 | # the overlays are available globally. | |
| 87 | { nixpkgs.overlays = overlays; } | |
| 98 | modules = | |
| 99 | builtins.filter (f: f != null) [ | |
| 100 | # Apply our overlays. Overlays are keyed by system type so we have | |
| 101 | # to go through and apply our system type. We do this first so | |
| 102 | # the overlays are available globally. | |
| 103 | {nixpkgs.overlays = overlays;} | |
| 88 | 104 | |
| 89 | # Modules shared between nix-darwin and NixOS | |
| 90 | ../modules/shared | |
| 91 | # Modules for the specific OS | |
| 92 | (if darwin then ../modules/macos else ../modules/nixos) | |
| 105 | # Modules shared between nix-darwin and NixOS | |
| 106 | ../modules/shared | |
| 107 | # Modules for the specific OS | |
| 108 | ( | |
| 109 | if darwin | |
| 110 | then ../modules/macos | |
| 111 | else ../modules/nixos | |
| 112 | ) | |
| 93 | 113 | |
| 94 | # The user-wide configuration.nix | |
| 95 | (pathOrNull userConfigPath) | |
| 96 | # The host-wide configuration.nix | |
| 97 | (pathOrNull hostConfigPath) | |
| 114 | # The user-wide configuration.nix | |
| 115 | (pathOrNull userConfigPath) | |
| 116 | # The host-wide configuration.nix | |
| 117 | (pathOrNull hostConfigPath) | |
| 98 | 118 | |
| 99 | # Set up nix-index and enable comma for easy one-shot command use | |
| 100 | # https://github.com/nix-community/comma | |
| 101 | (getInputModule "nix-index-database" "nix-index") | |
| 102 | { programs.nix-index-database.comma.enable = true; } | |
| 119 | # Set up nix-index and enable comma for easy one-shot command use | |
| 120 | # https://github.com/nix-community/comma | |
| 121 | (getInputModule "nix-index-database" "nix-index") | |
| 122 | {programs.nix-index-database.comma.enable = true;} | |
| 103 | 123 | |
| 104 | # Themes for all programs | |
| 105 | (getInputModule "stylix" "stylix") | |
| 124 | # Themes for all programs | |
| 125 | (getInputModule "stylix" "stylix") | |
| 106 | 126 | |
| 107 | # Home manager | |
| 108 | (getInputModule "home-manager" "home-manager") | |
| 109 | { | |
| 110 | home-manager = { | |
| 111 | useGlobalPkgs = true; | |
| 112 | useUserPackages = true; | |
| 113 | backupFileExtension = "hm-backup"; | |
| 114 | # Arguments passed to all module files | |
| 115 | extraSpecialArgs = args // { | |
| 116 | inherit mainHomeImports; | |
| 127 | # Home manager | |
| 128 | (getInputModule "home-manager" "home-manager") | |
| 129 | { | |
| 130 | home-manager = { | |
| 131 | useGlobalPkgs = true; | |
| 132 | useUserPackages = true; | |
| 133 | backupFileExtension = "hm-backup"; | |
| 134 | # Arguments passed to all module files | |
| 135 | extraSpecialArgs = | |
| 136 | args | |
| 137 | // { | |
| 138 | inherit mainHomeImports; | |
| 139 | }; | |
| 140 | # can't find how to make this an array without the param | |
| 141 | users.${userConfig.username} = ../modules/home; | |
| 117 | 142 | }; |
| 118 | # can't find how to make this an array without the param | |
| 119 | users.${userConfig.username} = ../modules/home; | |
| 120 | }; | |
| 121 | users.users.${userConfig.username}.home = systemSettings.homeDir; | |
| 122 | } | |
| 143 | users.users.${userConfig.username}.home = systemSettings.homeDir; | |
| 144 | } | |
| 123 | 145 | |
| 124 | # Arguments passed to all module files | |
| 125 | { config._module.args = args; } | |
| 126 | ] | |
| 127 | # Add extra modules specified from config | |
| 128 | ++ extraModules; | |
| 129 | } | |
| 146 | # Arguments passed to all module files | |
| 147 | {config._module.args = args;} | |
| 148 | ] | |
| 149 | # Add extra modules specified from config | |
| 150 | ++ extraModules; | |
| 151 | } |
modules/home/macos/sketchybar.nix+522-395| ... | ... | @@ -2,407 +2,534 @@ |
| 2 | 2 | pkgs, |
| 3 | 3 | lib, |
| 4 | 4 | config, |
| 5 | host, | |
| 6 | 5 | ... |
| 7 | }: | |
| 8 | let | |
| 9 | # folder = "${config.home.homeDirectory}.dotfiles/files/sketchybar"; | |
| 10 | # folder = "~/.dotfiles/files/sketchybar"; | |
| 11 | folder = ../../../files/sketchybar; | |
| 12 | in | |
| 13 | lib.mkIf (host.darwin) { | |
| 6 | }: { | |
| 14 | 7 | home.file = |
| 15 | lib.attrsets.mapAttrs | |
| 16 | ( | |
| 17 | file: value: (lib.attrsets.overrideExisting value { enable = config.shared.darwin.tiling.enable; }) | |
| 18 | ) | |
| 19 | { | |
| 20 | sketchybarrc = { | |
| 21 | executable = true; | |
| 22 | target = ".config/sketchybar/sketchybarrc"; | |
| 23 | text = '' | |
| 24 | #!/usr/bin/env sh | |
| 25 | ||
| 26 | source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors | |
| 27 | source "$HOME/.config/sketchybar/icons.sh" # Loads all defined icons | |
| 28 | ||
| 29 | ITEM_DIR="$HOME/.config/sketchybar/items" # Directory where the items are configured | |
| 30 | PLUGIN_DIR="$HOME/.config/sketchybar/plugins" # Directory where all the plugin scripts are stored | |
| 31 | ||
| 32 | FONT="SF Pro" # Needs to have Regular, Bold, Semibold, Heavy and Black variants | |
| 33 | PADDINGS=3 # All paddings use this value (icon, label, background) | |
| 34 | ||
| 35 | # Setting up and starting the helper process | |
| 36 | HELPER=git.felix.helper | |
| 37 | killall helper | |
| 38 | cd $HOME/.config/sketchybar/helper && make | |
| 39 | $HOME/.config/sketchybar/helper/helper $HELPER > /dev/null 2>&1 & | |
| 40 | ||
| 41 | # Unload the macOS on screen indicator overlay for volume change | |
| 42 | # launchctl unload -F /System/Library/LaunchAgents/com.apple.OSDUIHelper.plist > /dev/null 2>&1 & | |
| 43 | ||
| 44 | # Setting up the general bar appearance and default values | |
| 45 | ${pkgs.sketchybar}/bin/sketchybar --bar height=40 \ | |
| 46 | color=$BAR_COLOR \ | |
| 47 | shadow=off \ | |
| 48 | position=top \ | |
| 49 | sticky=on \ | |
| 50 | padding_right=0 \ | |
| 51 | padding_left=0 \ | |
| 52 | corner_radius=12 \ | |
| 53 | y_offset=0 \ | |
| 54 | margin=2 \ | |
| 55 | blur_radius=0 \ | |
| 56 | notch_width=0 \ | |
| 57 | --default updates=when_shown \ | |
| 58 | icon.font="$FONT:Bold:14.0" \ | |
| 59 | icon.color=$ICON_COLOR \ | |
| 60 | icon.padding_left=$PADDINGS \ | |
| 61 | icon.padding_right=$PADDINGS \ | |
| 62 | label.font="$FONT:Semibold:13.0" \ | |
| 63 | label.color=$LABEL_COLOR \ | |
| 64 | label.padding_left=$PADDINGS \ | |
| 65 | label.padding_right=$PADDINGS \ | |
| 66 | background.padding_right=$PADDINGS \ | |
| 67 | background.padding_left=$PADDINGS \ | |
| 68 | background.height=26 \ | |
| 69 | background.corner_radius=9 \ | |
| 70 | popup.background.border_width=2 \ | |
| 71 | popup.background.corner_radius=11 \ | |
| 72 | popup.background.border_color=$POPUP_BORDER_COLOR \ | |
| 73 | popup.background.color=$POPUP_BACKGROUND_COLOR \ | |
| 74 | popup.background.shadow.drawing=on | |
| 75 | ||
| 76 | # Left | |
| 77 | source "$ITEM_DIR/apple.sh" | |
| 78 | source "$ITEM_DIR/spaces.sh" | |
| 79 | source "$ITEM_DIR/front_app.sh" | |
| 80 | ||
| 81 | # Center | |
| 82 | # source "$ITEM_DIR/spotify.sh" | |
| 83 | source "$ITEM_DIR/calendar.sh" | |
| 84 | ||
| 85 | # Right | |
| 86 | # source "$ITEM_DIR/brew.sh" | |
| 87 | # source "$ITEM_DIR/github.sh" | |
| 88 | source "$ITEM_DIR/volume.sh" | |
| 89 | # source "$ITEM_DIR/divider.sh" | |
| 90 | # source "$ITEM_DIR/cpu.sh" | |
| 91 | ||
| 92 | # Forcing all item scripts to run (never do this outside of sketchybarrc) | |
| 93 | ${pkgs.sketchybar}/bin/sketchybar --update | |
| 94 | ||
| 95 | echo "sketchybar configuation loaded.." | |
| 96 | ''; | |
| 97 | }; | |
| 98 | icons = { | |
| 99 | executable = true; | |
| 100 | target = ".config/sketchybar/icons.sh"; | |
| 101 | source = folder + /icons.sh; | |
| 102 | }; | |
| 103 | colors = { | |
| 104 | executable = true; | |
| 105 | target = ".config/sketchybar/colors.sh"; | |
| 106 | text = '' | |
| 107 | #!/usr/bin/env sh | |
| 108 | # Color Palette | |
| 109 | export BLACK=0xff4c4f69 | |
| 110 | export WHITE=0xffeff1f5 | |
| 111 | export RED=0xffd20f39 | |
| 112 | export GREEN=0xff40a02b | |
| 113 | export BLUE=0xff1e66f5 | |
| 114 | export YELLOW=0xffdf8e1d | |
| 115 | export ORANGE=0xfffe640b | |
| 116 | export MAGENTA=0xffea76cb | |
| 117 | export GREY=0xff9ca0b0 | |
| 118 | export TRANSPARENT=0xff000000 | |
| 119 | export BLUE2=0xff7287fd | |
| 120 | export FLAMINGO=0xffdd7878 | |
| 121 | ||
| 122 | # General bar colors | |
| 123 | export BAR_COLOR=0xeff1f5ff # Color of the bar | |
| 124 | export ICON_COLOR=0xff4c4f69 | |
| 125 | export LABEL_COLOR=0xff4c4f69 # Color of all labels | |
| 126 | export BACKGROUND_1=0xffbcc0cc | |
| 127 | export BACKGROUND_2=0xffbcc0cc | |
| 128 | ||
| 129 | export POPUP_BACKGROUND_COLOR=$BLACK | |
| 130 | export POPUP_BORDER_COLOR=$WHITE | |
| 131 | ||
| 132 | export SHADOW_COLOR=$BLACK | |
| 133 | ''; | |
| 134 | }; | |
| 135 | items_apple = { | |
| 136 | executable = true; | |
| 137 | target = ".config/sketchybar/items/apple.sh"; | |
| 138 | source = folder + /items/executable_apple.sh; | |
| 139 | }; | |
| 140 | items_brew = { | |
| 141 | executable = true; | |
| 142 | target = ".config/sketchybar/items/brew.sh"; | |
| 143 | source = folder + /items/executable_brew.sh; | |
| 144 | }; | |
| 145 | items_calendar = { | |
| 146 | executable = true; | |
| 147 | target = ".config/sketchybar/items/calendar.sh"; | |
| 148 | text = '' | |
| 149 | #!/usr/bin/env sh | |
| 150 | ||
| 151 | sketchybar --add item calendar center \ | |
| 152 | --set calendar icon=cal \ | |
| 153 | display=1 \ | |
| 154 | icon.font="$FONT:Black:12.0" \ | |
| 155 | icon.padding_right=0 \ | |
| 156 | label.width=50 \ | |
| 157 | label.align=right \ | |
| 158 | background.padding_left=15 \ | |
| 159 | update_freq=30 \ | |
| 160 | script="$PLUGIN_DIR/calendar.sh" \ | |
| 161 | click_script="$PLUGIN_DIR/zen.sh" | |
| 162 | ''; | |
| 163 | }; | |
| 164 | items_cpu = { | |
| 165 | executable = true; | |
| 166 | target = ".config/sketchybar/items/cpu.sh"; | |
| 167 | source = folder + /items/executable_cpu.sh; | |
| 168 | }; | |
| 169 | items_divider = { | |
| 170 | executable = true; | |
| 171 | target = ".config/sketchybar/items/divider.sh"; | |
| 172 | source = folder + /items/executable_divider.sh; | |
| 173 | }; | |
| 174 | items_front_app = { | |
| 175 | executable = true; | |
| 176 | target = ".config/sketchybar/items/front_app.sh"; | |
| 177 | text = '' | |
| 178 | #!/usr/bin/env sh | |
| 179 | FRONT_APP_SCRIPT='sketchybar --set $NAME label="$INFO"' | |
| 180 | sketchybar --add event window_focus \ | |
| 181 | --add event windows_on_spaces \ | |
| 182 | --add item system.aerospace left \ | |
| 183 | --set system.aerospace script="$PLUGIN_DIR/aerospace.sh" \ | |
| 184 | icon.font="$FONT:Bold:16.0" \ | |
| 185 | label.drawing=off \ | |
| 186 | icon.width=30 \ | |
| 187 | icon=$YABAI_GRID \ | |
| 188 | icon.color=$BLACK \ | |
| 189 | updates=on \ | |
| 190 | display=active \ | |
| 191 | --subscribe system.aerospace window_focus \ | |
| 192 | windows_on_spaces \ | |
| 193 | mouse.clicked \ | |
| 194 | --add item front_app left \ | |
| 195 | --set front_app script="$FRONT_APP_SCRIPT" \ | |
| 196 | icon.drawing=off \ | |
| 197 | background.padding_left=0 \ | |
| 198 | background.padding_right=10 \ | |
| 199 | label.color=$BLACK \ | |
| 200 | label.font="$FONT:Black:12.0" \ | |
| 201 | display=active \ | |
| 202 | --subscribe front_app front_app_switched | |
| 203 | ''; | |
| 204 | }; | |
| 205 | items_github = { | |
| 206 | executable = true; | |
| 207 | target = ".config/sketchybar/items/github.sh"; | |
| 208 | source = folder + /items/executable_github.sh; | |
| 209 | }; | |
| 210 | items_spaces = { | |
| 211 | executable = true; | |
| 212 | target = ".config/sketchybar/items/spaces.sh"; | |
| 213 | # label.background.color=$BACKGROUND_2 | |
| 214 | text = '' | |
| 215 | ${pkgs.sketchybar}/bin/sketchybar --add event aerospace_workspace_change | |
| 216 | ${pkgs.sketchybar}/bin/sketchybar --add event aerospace_mode_change | |
| 217 | for sid in $(${pkgs.aerospace}/bin/aerospace list-workspaces --all); do | |
| 218 | ${pkgs.sketchybar}/bin/sketchybar --add item space.$sid left \ | |
| 219 | --subscribe space.$sid aerospace_workspace_change \ | |
| 220 | --subscribe space.$sid aerospace_mode_change \ | |
| 221 | --set space.$sid \ | |
| 222 | icon=$sid \ | |
| 223 | icon.padding_left=22 \ | |
| 224 | icon.padding_right=22 \ | |
| 225 | icon.highlight_color=$WHITE \ | |
| 226 | icon.highlight=off \ | |
| 227 | icon.color=0xff4c566a \ | |
| 228 | background.padding_left=-8 \ | |
| 229 | background.padding_right=-8 \ | |
| 230 | background.color=$BACKGROUND_1 \ | |
| 231 | background.drawing=on \ | |
| 232 | script="$PLUGIN_DIR/aerospace.sh $sid" \ | |
| 233 | click_script="aerospace workspace $sid" \ | |
| 234 | label.font="Iosevka Nerd Font:Regular:16.0" \ | |
| 235 | label.padding_right=33 \ | |
| 236 | label.background.height=26 \ | |
| 237 | label.background.drawing=on \ | |
| 238 | label.background.corner_radius=9 \ | |
| 239 | label.drawing=off | |
| 8 | lib.attrsets.mapAttrs (file: value: ( | |
| 9 | lib.attrsets.overrideExisting value {enable = config.shared.darwin.tiling.enable;} | |
| 10 | )) { | |
| 11 | sketchybarrc = { | |
| 12 | executable = true; | |
| 13 | target = ".config/sketchybar/sketchybarrc"; | |
| 14 | text = '' | |
| 15 | #!/usr/bin/env sh | |
| 16 | ||
| 17 | source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors | |
| 18 | ||
| 19 | ITEM_DIR="$HOME/.config/sketchybar/items" # Directory where the items are configured | |
| 20 | PLUGIN_DIR="$HOME/.config/sketchybar/plugins" # Directory where all the plugin scripts are stored | |
| 21 | ||
| 22 | FONT="SF Pro" # Needs to have Regular, Bold, Semibold, Heavy and Black variants | |
| 23 | PADDINGS=3 # All paddings use this value (icon, label, background) | |
| 24 | ||
| 25 | ||
| 26 | # Setting up the general bar appearance and default values | |
| 27 | ${pkgs.sketchybar}/bin/sketchybar --bar height=40 \ | |
| 28 | blur_radius=30 \ | |
| 29 | position=top \ | |
| 30 | sticky=on \ | |
| 31 | padding_left=10 \ | |
| 32 | padding_right=10 | |
| 33 | ||
| 34 | ||
| 35 | ${pkgs.sketchybar}/bin/sketchybar --default icon.font="SF Pro:Semibold:12.0" \ | |
| 36 | icon.color=$ITEM_COLOR \ | |
| 37 | label.font="SF Pro:Semibold:12.0" \ | |
| 38 | label.color=$ITEM_COLOR \ | |
| 39 | background.color=$ACCENT_COLOR \ | |
| 40 | background.corner_radius=10 \ | |
| 41 | background.height=20 \ | |
| 42 | padding_left=4 \ | |
| 43 | padding_right=4 \ | |
| 44 | icon.padding_left=6 \ | |
| 45 | icon.padding_right=3 \ | |
| 46 | label.padding_left=3 \ | |
| 47 | label.padding_right=6 | |
| 48 | ||
| 49 | ||
| 50 | # Left | |
| 51 | # source "$ITEM_DIR/apple.sh" | |
| 52 | source "$ITEM_DIR/spaces.sh" | |
| 53 | source "$ITEM_DIR/front_app.sh" | |
| 54 | ||
| 55 | # Center | |
| 56 | # source "$ITEM_DIR/spotify.sh" | |
| 57 | source "$ITEM_DIR/calendar.sh" | |
| 58 | ||
| 59 | # Right | |
| 60 | source $ITEM_DIR/calendar.sh | |
| 61 | source $ITEM_DIR/wifi.sh | |
| 62 | source $ITEM_DIR/battery.sh | |
| 63 | source $ITEM_DIR/volume.sh | |
| 64 | ||
| 65 | # Forcing all item scripts to run (never do this outside of sketchybarrc) | |
| 66 | ${pkgs.sketchybar}/bin/sketchybar --update | |
| 67 | ||
| 68 | echo "sketchybar configuation loaded.." | |
| 69 | ''; | |
| 70 | }; | |
| 71 | icons = { | |
| 72 | executable = true; | |
| 73 | target = ".config/sketchybar/plugins/icons.sh"; | |
| 74 | text = '' | |
| 75 | #!/usr/bin/env sh | |
| 76 | ||
| 77 | # Source the icon map with all the application icons | |
| 78 | source ${pkgs.sketchybar-app-font}/bin/icon_map.sh | |
| 79 | ||
| 80 | # Create a cache directory if it doesn't exist | |
| 81 | CACHE_DIR="$HOME/.cache/sketchybar" | |
| 82 | mkdir -p "$CACHE_DIR" | |
| 83 | ||
| 84 | # Cache file for icon mappings | |
| 85 | ICON_CACHE="$CACHE_DIR/icon_cache.txt" | |
| 86 | ||
| 87 | # Create the cache file if it doesn't exist | |
| 88 | if [ ! -f "$ICON_CACHE" ]; then | |
| 89 | touch "$ICON_CACHE" | |
| 90 | fi | |
| 91 | ||
| 92 | # Check if the app is already in cache | |
| 93 | APP_NAME=$(if [ "$1" = "Zen" ]; then echo "Zen Browser"; else echo "$1"; fi) | |
| 94 | ||
| 95 | CACHED_ICON=$(grep "^$APP_NAME|" "$ICON_CACHE" | cut -d '|' -f2) | |
| 96 | ||
| 97 | if [ -n "$CACHED_ICON" ]; then | |
| 98 | # Cache hit, return the icon | |
| 99 | echo "$CACHED_ICON" | |
| 100 | exit 0 | |
| 101 | fi | |
| 102 | ||
| 103 | # Get icon from the mapping function | |
| 104 | __icon_map "$APP_NAME" | |
| 105 | ||
| 106 | if [ -n "$icon_result" ]; then | |
| 107 | echo "$APP_NAME|$icon_result" >>"$ICON_CACHE" | |
| 108 | fi | |
| 109 | ||
| 110 | echo "$icon_result" | |
| 111 | ''; | |
| 112 | }; | |
| 113 | colors = { | |
| 114 | executable = true; | |
| 115 | target = ".config/sketchybar/colors.sh"; | |
| 116 | text = '' | |
| 117 | ||
| 118 | export TRANSPARENT=0x00ffffff | |
| 119 | ||
| 120 | # -- Gray Scheme -- | |
| 121 | export ITEM_COLOR=0xff000000 | |
| 122 | export ACCENT_COLOR=0xffc3c6cb | |
| 123 | ||
| 124 | # -- White Scheme -- | |
| 125 | # export ITEM_COLOR=0xff000000 | |
| 126 | # export ACCENT_COLOR=0xffffffff | |
| 127 | ||
| 128 | # -- Teal Scheme -- | |
| 129 | # export ITEM_COLOR=0xff000000 | |
| 130 | # export ACCENT_COLOR=0xff2cf9ed | |
| 131 | ||
| 132 | # -- Purple Scheme -- | |
| 133 | # export ITEM_COLOR=0xff000000 | |
| 134 | # export ACCENT_COLOR=0xffeb46f9 | |
| 135 | ||
| 136 | # -- Red Scheme --- | |
| 137 | # export ITEM_COLOR=0xff000000 | |
| 138 | # export ACCENT_COLOR=0xffff2453 | |
| 139 | ||
| 140 | # -- Blue Scheme --- | |
| 141 | # export ITEM_COLOR=0xff000000 | |
| 142 | # export ACCENT_COLOR=0xff15bdf9 | |
| 143 | ||
| 144 | # -- Green Scheme -- | |
| 145 | # export ITEM_COLOR=0xff000000 | |
| 146 | # export ACCENT_COLOR=0xff1dfca1 | |
| 147 | ||
| 148 | # -- Orange Scheme -- | |
| 149 | # export ITEM_COLOR=0xffffffff | |
| 150 | # export ACCENT_COLOR=0xfff97716 | |
| 151 | ||
| 152 | # -- Yellow Scheme -- | |
| 153 | # export ITEM_COLOR=0xff000000 | |
| 154 | # export ACCENT_COLOR=0xfff7fc17 | |
| 155 | ''; | |
| 156 | }; | |
| 157 | items_wifi = { | |
| 158 | executable = true; | |
| 159 | target = ".config/sketchybar/items/wifi.sh"; | |
| 160 | text = '' | |
| 161 | #!/usr/bin/env/ sh | |
| 162 | ||
| 163 | sketchybar --add item wifi right \ | |
| 164 | --set wifi \ | |
| 165 | icon="" \ | |
| 166 | label="Updating..." \ | |
| 167 | script="$PLUGIN_DIR/wifi.sh" \ | |
| 168 | --subscribe wifi wifi_change | |
| 169 | ''; | |
| 170 | }; | |
| 171 | items_battery = { | |
| 172 | executable = true; | |
| 173 | target = ".config/sketchybar/items/battery.sh"; | |
| 174 | text = '' | |
| 175 | #!/usr/bin/env/ sh | |
| 176 | sketchybar --add item battery right \ | |
| 177 | --set battery update_freq=180 \ | |
| 178 | script="$PLUGIN_DIR/battery.sh" \ | |
| 179 | --subscribe battery system_woke power_source_change | |
| 180 | ''; | |
| 181 | }; | |
| 182 | items_calendar = { | |
| 183 | executable = true; | |
| 184 | target = ".config/sketchybar/items/calendar.sh"; | |
| 185 | text = '' | |
| 186 | #!/usr/bin/env sh | |
| 187 | sketchybar --add item calendar right \ | |
| 188 | --set calendar icon= \ | |
| 189 | update_freq=15 \ | |
| 190 | script="$PLUGIN_DIR/calendar.sh" | |
| 191 | ''; | |
| 192 | }; | |
| 193 | items_front_app = { | |
| 194 | executable = true; | |
| 195 | target = ".config/sketchybar/items/front_app.sh"; | |
| 196 | text = '' | |
| 197 | #!/usr/bin/env sh | |
| 198 | ||
| 199 | sketchybar --add item front_app left \ | |
| 200 | --set front_app background.color=$ACCENT_COLOR \ | |
| 201 | icon.color=$ITEM_COLOR \ | |
| 202 | label.color=$ITEM_COLOR \ | |
| 203 | icon.font="sketchybar-app-font:Regular:12.0" \ | |
| 204 | label.font="SF Pro:Semibold:12.0" \ | |
| 205 | script="$PLUGIN_DIR/front_app.sh" \ | |
| 206 | --subscribe front_app front_app_switched | |
| 207 | ''; | |
| 208 | }; | |
| 209 | items_spaces = { | |
| 210 | executable = true; | |
| 211 | target = ".config/sketchybar/items/spaces.sh"; | |
| 212 | text = '' | |
| 213 | sketchybar --add event aerospace_workspace_change | |
| 214 | ||
| 215 | sketchybar --add item aerospace_dummy left \ | |
| 216 | --set aerospace_dummy display=0 \ | |
| 217 | script="$PLUGIN_DIR/spaces.sh" \ | |
| 218 | --subscribe aerospace_dummy aerospace_workspace_change | |
| 219 | ||
| 220 | for m in $(aerospace list-monitors | awk '{print $1}'); do | |
| 221 | for sid in $(aerospace list-workspaces --monitor $m); do | |
| 222 | sketchybar --add space space.$sid left \ | |
| 223 | --set space.$sid space=$sid \ | |
| 224 | icon=$sid \ | |
| 225 | background.color=$TRANSPARENT \ | |
| 226 | label.color=$ACCENT_COLOR \ | |
| 227 | icon.color=$ACCENT_COLOR \ | |
| 228 | display=$m \ | |
| 229 | label.font="sketchybar-app-font:Regular:12.0" \ | |
| 230 | icon.font="SF Pro:Semibold:12.0" \ | |
| 231 | label.padding_right=10 \ | |
| 232 | label.y_offset=-1 \ | |
| 233 | click_script="$PLUGIN_DIR/space_click.sh $sid" | |
| 234 | ||
| 235 | apps=$(aerospace list-windows --monitor "$m" --workspace "$sid" | | |
| 236 | awk -F '|' '{gsub(/^ *| *$/, "", $2); if (!seen[$2]++) print $2}') | |
| 237 | ||
| 238 | icon_strip="" | |
| 239 | if [ "''${apps}" != "" ]; then | |
| 240 | while read -r app; do | |
| 241 | icon_strip+=" $($PLUGIN_DIR/icons.sh "$app")" | |
| 242 | done <<<"''${apps}" | |
| 243 | else | |
| 244 | icon_strip=" —" | |
| 245 | fi | |
| 246 | ||
| 247 | sketchybar --set space.$sid label="$icon_strip" | |
| 248 | ||
| 240 | 249 | done |
| 241 | ${pkgs.sketchybar}/bin/sketchybar --add item separator left \ | |
| 242 | --set separator icon= \ | |
| 243 | icon.font="Iosevka Nerd Font:Regular:16.0" \ | |
| 244 | background.padding_left=26 \ | |
| 245 | background.padding_right=15 \ | |
| 246 | label.drawing=off \ | |
| 247 | display=active \ | |
| 248 | icon.color=$GREEN | |
| 249 | ''; | |
| 250 | }; | |
| 251 | items_spotify = { | |
| 252 | executable = true; | |
| 253 | target = ".config/sketchybar/items/spotify.sh"; | |
| 254 | source = folder + /items/executable_spotify.sh; | |
| 255 | }; | |
| 256 | items_volume = { | |
| 257 | executable = true; | |
| 258 | target = ".config/sketchybar/items/volume.sh"; | |
| 259 | text = '' | |
| 260 | INITIAL_WIDTH=$(osascript -e 'set ovol to output volume of (get volume settings)') | |
| 261 | ${pkgs.sketchybar}/bin/sketchybar --add item volume right \ | |
| 262 | --subscribe volume volume_change \ | |
| 263 | --set volume script="$PLUGIN_DIR/volume.sh" \ | |
| 264 | updates=on \ | |
| 265 | icon.background.drawing=on \ | |
| 266 | icon.background.color=$FLAMINGO \ | |
| 267 | icon.background.height=8 \ | |
| 268 | icon.background.corner_radius=3 \ | |
| 269 | icon.width=$INITIAL_WIDTH \ | |
| 270 | width=100 \ | |
| 271 | icon.align=right \ | |
| 272 | label.drawing=off \ | |
| 273 | background.drawing=on \ | |
| 274 | background.color=$BACKGROUND_2 \ | |
| 275 | background.height=8 \ | |
| 276 | background.corner_radius=3 \ | |
| 277 | align=left | |
| 278 | ||
| 279 | ${pkgs.sketchybar}/bin/sketchybar --add alias "Control Center,Sound" right \ | |
| 280 | --rename "Control Center,Sound" volume_alias \ | |
| 281 | --set volume_alias icon.drawing=off \ | |
| 282 | label.drawing=off \ | |
| 283 | alias.color=$BLUE2 \ | |
| 284 | background.padding_right=0 \ | |
| 285 | background.padding_left=5 \ | |
| 286 | width=50 \ | |
| 287 | align=right \ | |
| 288 | click_script="$PLUGIN_DIR/volume_click.sh" | |
| 289 | ||
| 290 | ''; | |
| 291 | }; | |
| 292 | plugins_brew = { | |
| 293 | executable = true; | |
| 294 | target = ".config/sketchybar/plugins/brew.sh"; | |
| 295 | source = folder + /plugins/executable_brew.sh; | |
| 296 | }; | |
| 297 | plugins_calendar = { | |
| 298 | executable = true; | |
| 299 | target = ".config/sketchybar/plugins/calendar.sh"; | |
| 300 | source = folder + /plugins/executable_calendar.sh; | |
| 301 | }; | |
| 302 | plugins_github = { | |
| 303 | executable = true; | |
| 304 | target = ".config/sketchybar/plugins/github.sh"; | |
| 305 | source = folder + /plugins/executable_github.sh; | |
| 306 | }; | |
| 307 | plugins_icon_map = { | |
| 308 | executable = true; | |
| 309 | target = ".config/sketchybar/plugins/icon_map.sh"; | |
| 310 | source = folder + /plugins/executable_icon_map.sh; | |
| 311 | }; | |
| 312 | plugins_space = { | |
| 313 | executable = true; | |
| 314 | target = ".config/sketchybar/plugins/space.sh"; | |
| 315 | source = folder + /plugins/executable_space.sh; | |
| 316 | }; | |
| 317 | plugins_spotify = { | |
| 318 | executable = true; | |
| 319 | target = ".config/sketchybar/plugins/spotify.sh"; | |
| 320 | source = folder + /plugins/executable_spotify.sh; | |
| 321 | }; | |
| 322 | plugins_volume = { | |
| 323 | executable = true; | |
| 324 | target = ".config/sketchybar/plugins/volume.sh"; | |
| 325 | text = '' | |
| 326 | #!/usr/bin/env sh | |
| 327 | WIDTH=100 | |
| 328 | ||
| 329 | volume_change() { | |
| 330 | # INITIAL_WIDTH=$(${pkgs.sketchybar}/bin/sketchybar --query $NAME | ${pkgs.jq}/bin/jq ".icon.width") | |
| 331 | # if [ "$INITIAL_WIDTH" -eq "0" ]; then | |
| 332 | # ${pkgs.sketchybar}/bin/sketchybar --animate tanh 30 --set $NAME width=$WIDTH icon.width=$INFO | |
| 333 | # else | |
| 334 | # ${pkgs.sketchybar}/bin/sketchybar --set $NAME icon.width=$INFO width=$WIDTH | |
| 335 | # fi | |
| 336 | ${pkgs.sketchybar}/bin/sketchybar --set $NAME icon.width=$INFO | |
| 337 | ||
| 338 | ||
| 339 | # sleep 5 | |
| 340 | # FINAL_WIDTH=$(${pkgs.sketchybar}/bin/sketchybar --query $NAME | ${pkgs.jq}/bin/jq ".icon.width") | |
| 341 | # if [ "$FINAL_WIDTH" -eq "$INFO" ]; then | |
| 342 | # ${pkgs.sketchybar}/bin/sketchybar --animate tanh 30 --set $NAME width=0 icon.width=0 | |
| 343 | # fi | |
| 344 | } | |
| 345 | ||
| 346 | case "$SENDER" in | |
| 347 | "volume_change") volume_change | |
| 348 | ;; | |
| 349 | esac | |
| 350 | ''; | |
| 351 | }; | |
| 352 | plugins_volume_click = { | |
| 353 | executable = true; | |
| 354 | target = ".config/sketchybar/plugins/volume_click.sh"; | |
| 355 | text = '' | |
| 356 | #!/usr/bin/env sh | |
| 357 | MUTED=$(osascript -e 'output muted of (get volume settings)') | |
| 358 | if [ "$MUTED" = "false" ]; then | |
| 359 | osascript -e 'set volume output muted true' | |
| 250 | ||
| 251 | for empty_space in $(aerospace list-workspaces --monitor $m --empty); do | |
| 252 | sketchybar --set space.$empty_space display=0 | |
| 253 | done | |
| 254 | for focus in $(aerospace list-workspaces --focused); do | |
| 255 | sketchybar --set space.$focus background.drawing=on \ | |
| 256 | background.color=$ACCENT_COLOR \ | |
| 257 | label.color=$ITEM_COLOR \ | |
| 258 | icon.color=$ITEM_COLOR | |
| 259 | done | |
| 260 | done | |
| 261 | ''; | |
| 262 | }; | |
| 263 | ||
| 264 | items_volume = { | |
| 265 | executable = true; | |
| 266 | target = ".config/sketchybar/items/volume.sh"; | |
| 267 | text = '' | |
| 268 | #/usr/bin/env sh | |
| 269 | ||
| 270 | sketchybar --add item volume right \ | |
| 271 | --set volume script="$PLUGIN_DIR/volume.sh" \ | |
| 272 | --subscribe volume volume_change | |
| 273 | ''; | |
| 274 | }; | |
| 275 | plugins_wifi = { | |
| 276 | executable = true; | |
| 277 | target = ".config/sketchybar/plugins/wifi.sh"; | |
| 278 | text = '' | |
| 279 | #/usr/bin/env sh | |
| 280 | ||
| 281 | SSID=$(system_profiler SPAirPortDataType | awk '/Current Network Information:/ { getline; print substr($0, 13, (length($0) - 13)); exit }') | |
| 282 | ||
| 283 | if [ "$SSID" = "" ]; then | |
| 284 | sketchybar --set $NAME icon="" label="Disconnected" | |
| 285 | else | |
| 286 | sketchybar --set $NAME icon="" label="$SSID" | |
| 287 | fi | |
| 288 | ||
| 289 | ''; | |
| 290 | }; | |
| 291 | plugins_calendar = { | |
| 292 | executable = true; | |
| 293 | target = ".config/sketchybar/plugins/calendar.sh"; | |
| 294 | ||
| 295 | text = '' | |
| 296 | #/usr/bin/env sh | |
| 297 | ||
| 298 | sketchybar --set $NAME label="$(date +'%a %d %b %I:%M %p')" | |
| 299 | ''; | |
| 300 | }; | |
| 301 | plugins_spaces = { | |
| 302 | executable = true; | |
| 303 | target = ".config/sketchybar/plugins/spaces.sh"; | |
| 304 | text = '' | |
| 305 | #!/usr/bin/env sh | |
| 306 | ||
| 307 | source "$CONFIG_DIR/colors.sh" | |
| 308 | ||
| 309 | update_workspace_appearance() { | |
| 310 | local sid=$1 | |
| 311 | local is_focused=$2 | |
| 312 | ||
| 313 | if [ "$is_focused" = "true" ]; then | |
| 314 | sketchybar --set space.$sid background.drawing=on \ | |
| 315 | background.color=$ACCENT_COLOR \ | |
| 316 | label.color=$ITEM_COLOR \ | |
| 317 | icon.color=$ITEM_COLOR | |
| 360 | 318 | else |
| 361 | osascript -e 'set volume output muted false' | |
| 319 | sketchybar --set space.$sid background.drawing=off \ | |
| 320 | label.color=$ACCENT_COLOR \ | |
| 321 | icon.color=$ACCENT_COLOR | |
| 362 | 322 | fi |
| 363 | ''; | |
| 364 | }; | |
| 365 | plugins_zen = { | |
| 366 | executable = true; | |
| 367 | target = ".config/sketchybar/plugins/zen.sh"; | |
| 368 | source = folder + /plugins/executable_zen.sh; | |
| 369 | }; | |
| 370 | plugins_aerospace = { | |
| 371 | executable = true; | |
| 372 | target = ".config/sketchybar/plugins/aerospace.sh"; | |
| 373 | text = '' | |
| 374 | #!/usr/bin/env bash | |
| 375 | source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors | |
| 376 | ||
| 377 | highlight_focused_workspace() { | |
| 378 | if [[ "$1" = "$FOCUSED_WORKSPACE" ]] | |
| 379 | then | |
| 380 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=on label.width=0 | |
| 381 | else | |
| 382 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=off label.width=dynamic | |
| 383 | fi | |
| 384 | } | |
| 385 | ||
| 386 | illuminate_mode() { | |
| 387 | if [[ "$mode" = "service" ]] | |
| 388 | then | |
| 389 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$ORANGE | |
| 390 | elif [[ "$mode" = "resize" ]] | |
| 391 | then | |
| 392 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$GREEN | |
| 393 | else | |
| 394 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$BACKGROUND_1 | |
| 323 | } | |
| 324 | ||
| 325 | update_icons() { | |
| 326 | m=$1 | |
| 327 | sid=$2 | |
| 328 | ||
| 329 | apps=$(aerospace list-windows --monitor "$m" --workspace "$sid" \ | |
| 330 | | awk -F '|' '{gsub(/^ *| *$/, "", $2); if (!seen[$2]++) print $2}' \ | |
| 331 | | sort) | |
| 332 | ||
| 333 | icon_strip="" | |
| 334 | if [ "''${apps}" != "" ]; then | |
| 335 | while read -r app; do | |
| 336 | icon_strip+=" $($CONFIG_DIR/plugins/icons.sh "$app")" | |
| 337 | done <<<"''${apps}" | |
| 338 | else | |
| 339 | icon_strip=" —" | |
| 340 | fi | |
| 341 | ||
| 342 | sketchybar --animate sin 10 --set space.$sid label="$icon_strip" | |
| 343 | } | |
| 344 | ||
| 345 | update_workspace_appearance "$PREV_WORKSPACE" "false" | |
| 346 | update_workspace_appearance "$FOCUSED_WORKSPACE" "true" | |
| 347 | ||
| 348 | for m in $(aerospace list-monitors | awk '{print $1}'); do | |
| 349 | for sid in $(aerospace list-workspaces --monitor $m --visible); do | |
| 350 | sketchybar --set space.$sid display=$m | |
| 351 | ||
| 352 | update_icons "$m" "$sid" | |
| 353 | ||
| 354 | update_icons "$m" "$PREV_WORKSPACE" | |
| 355 | ||
| 356 | apps=$(aerospace list-windows --monitor "$m" --workspace "$sid" | wc -l) | |
| 357 | if [ "''${apps}" -eq 0 ]; then | |
| 358 | sketchybar --set space.$sid display=0 | |
| 395 | 359 | fi |
| 396 | } | |
| 397 | case "$SENDER" in | |
| 398 | "aerospace_workspace_change") | |
| 399 | highlight_focused_workspace $1 | |
| 400 | ;; | |
| 401 | "aerospace_mode_change") | |
| 402 | illuminate_mode | |
| 403 | ;; | |
| 360 | done | |
| 361 | done | |
| 362 | ''; | |
| 363 | }; | |
| 364 | ||
| 365 | plugins_space_click = { | |
| 366 | executable = true; | |
| 367 | target = ".config/sketchybar/plugins/space_click.sh"; | |
| 368 | text = '' | |
| 369 | #/usr/bin/env/ sh | |
| 370 | ||
| 371 | apps=$(aerospace list-windows --workspace $1 | awk -F '|' '{gsub(/^ *| *$/, "", $2); print $2}') | |
| 372 | focused=$(aerospace list-workspaces --focused) | |
| 373 | ||
| 374 | if [ "''${apps}" = "" ] && [ "''${focused}" != "$1" ]; then | |
| 375 | sketchybar --set space.$1 display=0 | |
| 376 | else | |
| 377 | aerospace workspace $1 | |
| 378 | fi | |
| 379 | ''; | |
| 380 | }; | |
| 381 | plugins_volume = { | |
| 382 | executable = true; | |
| 383 | target = ".config/sketchybar/plugins/volume.sh"; | |
| 384 | text = '' | |
| 385 | #!/usr/bin/env sh | |
| 386 | ||
| 387 | # The volume_change event supplies a $INFO variable in which the current volume | |
| 388 | # percentage is passed to the script. | |
| 389 | ||
| 390 | if [ "$SENDER" = "volume_change" ]; then | |
| 391 | ||
| 392 | VOLUME=$INFO | |
| 393 | ||
| 394 | case $VOLUME in | |
| 395 | [6-9][0-9] | 100) | |
| 396 | ICON="" | |
| 397 | ;; | |
| 398 | [3-5][0-9]) | |
| 399 | ICON="" | |
| 400 | ;; | |
| 401 | [1-9] | [1-2][0-9]) | |
| 402 | ICON="" | |
| 403 | ;; | |
| 404 | *) ICON="" ;; | |
| 404 | 405 | esac |
| 405 | ''; | |
| 406 | }; | |
| 406 | ||
| 407 | sketchybar --set $NAME icon="$ICON" label="$VOLUME%" | |
| 408 | fi | |
| 409 | ''; | |
| 410 | }; | |
| 411 | plugins_front_app = { | |
| 412 | executable = true; | |
| 413 | target = ".config/sketchybar/plugins/front_app.sh"; | |
| 414 | text = '' | |
| 415 | # Some events send additional information specific to the event in the $INFO | |
| 416 | # variable. E.g. the front_app_switched event sends the name of the newly | |
| 417 | # focused application in the $INFO variable: | |
| 418 | # https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting | |
| 419 | ||
| 420 | app_switched() { | |
| 421 | for m in $(aerospace list-monitors | awk '{print $1}'); do | |
| 422 | for sid in $(aerospace list-workspaces --monitor $m --visible); do | |
| 423 | ||
| 424 | apps=$( (echo "$INFO"; aerospace list-windows --monitor "$m" --workspace "$sid" \ | |
| 425 | | awk -F '|' '{gsub(/^ *| *$/, "", $2); print $2}') \ | |
| 426 | | awk '!seen[$0]++' | sort) | |
| 427 | ||
| 428 | icon_strip="" | |
| 429 | if [ "''${apps}" != "" ]; then | |
| 430 | while read -r app; do | |
| 431 | icon_strip+=" $($CONFIG_DIR/plugins/icons.sh "$app")" | |
| 432 | done <<<"''${apps}" | |
| 433 | else | |
| 434 | icon_strip=" —" | |
| 435 | fi | |
| 436 | ||
| 437 | sketchybar --animate sin 10 --set space.$sid label="$icon_strip" | |
| 438 | done | |
| 439 | done | |
| 440 | } | |
| 441 | ||
| 442 | if [ "$SENDER" = "front_app_switched" ]; then | |
| 443 | ||
| 444 | sketchybar --set $NAME label="$INFO" icon="$($CONFIG_DIR/plugins/icons.sh "$INFO")" | |
| 445 | ||
| 446 | app_switched | |
| 447 | fi | |
| 448 | ''; | |
| 449 | }; | |
| 450 | plugins_battery = { | |
| 451 | executable = true; | |
| 452 | target = ".config/sketchybar/plugins/battery.sh"; | |
| 453 | text = '' | |
| 454 | #!/usr/bin/env sh | |
| 455 | source "$CONFIG_DIR/colors.sh" | |
| 456 | ||
| 457 | PERCENTAGE=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1) | |
| 458 | CHARGING=$(pmset -g batt | grep 'AC Power') | |
| 459 | ||
| 460 | if [ $PERCENTAGE = "" ]; then | |
| 461 | exit 0 | |
| 462 | fi | |
| 463 | ||
| 464 | case ''${PERCENTAGE} in | |
| 465 | 9[0-9] | 100) | |
| 466 | ICON="" | |
| 467 | COLOR=$ITEM_COLOR | |
| 468 | ;; | |
| 469 | [6-8][0-9]) | |
| 470 | ICON="" | |
| 471 | COLOR=$ITEM_COLOR | |
| 472 | ;; | |
| 473 | [3-5][0-9]) | |
| 474 | ICON="" | |
| 475 | COLOR="0xFFd97706" | |
| 476 | ;; | |
| 477 | [1-2][0-9]) | |
| 478 | ICON="" | |
| 479 | COLOR="0xFFf97316" | |
| 480 | ;; | |
| 481 | *) | |
| 482 | ICON="" | |
| 483 | COLOR="0xFFef4444" | |
| 484 | ;; | |
| 485 | esac | |
| 486 | ||
| 487 | if [[ $CHARGING != "" ]]; then | |
| 488 | ICON="" | |
| 489 | COLOR=$ITEM_COLOR | |
| 490 | fi | |
| 491 | ||
| 492 | # The item invoking this script (name $NAME) will get its icon and label | |
| 493 | # updated with the current battery status | |
| 494 | sketchybar --set $NAME icon="$ICON" label="''${PERCENTAGE}%" icon.color="$COLOR" | |
| 495 | ''; | |
| 496 | }; | |
| 497 | plugins_aerospace = { | |
| 498 | executable = true; | |
| 499 | target = ".config/sketchybar/plugins/aerospace.sh"; | |
| 500 | text = '' | |
| 501 | #!/usr/bin/env bash | |
| 502 | source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors | |
| 503 | ||
| 504 | highlight_focused_workspace() { | |
| 505 | if [[ "$1" = "$FOCUSED_WORKSPACE" ]] | |
| 506 | then | |
| 507 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=on label.width=0 | |
| 508 | else | |
| 509 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=off label.width=dynamic | |
| 510 | fi | |
| 511 | } | |
| 512 | ||
| 513 | illuminate_mode() { | |
| 514 | if [[ "$mode" = "service" ]] | |
| 515 | then | |
| 516 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$ORANGE | |
| 517 | elif [[ "$mode" = "resize" ]] | |
| 518 | then | |
| 519 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$GREEN | |
| 520 | else | |
| 521 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$BACKGROUND_1 | |
| 522 | fi | |
| 523 | } | |
| 524 | case "$SENDER" in | |
| 525 | "aerospace_workspace_change") | |
| 526 | highlight_focused_workspace $1 | |
| 527 | ;; | |
| 528 | "aerospace_mode_change") | |
| 529 | illuminate_mode | |
| 530 | ;; | |
| 531 | esac | |
| 532 | ''; | |
| 407 | 533 | }; |
| 534 | }; | |
| 408 | 535 | } |
modules/macos/default.nix+5-4| ... | ... | @@ -2,7 +2,8 @@ |
| 2 | 2 | pkgs, |
| 3 | 3 | lib, |
| 4 | 4 | ... |
| 5 | }: { | |
| 5 | }: | |
| 6 | { | |
| 6 | 7 | imports = [ |
| 7 | 8 | # sort-lines: start |
| 8 | 9 | ./mac-app-store.nix |
| ... | ... | @@ -13,8 +14,8 @@ |
| 13 | 14 | ]; |
| 14 | 15 | # make 'shared.linux' not an error to define. |
| 15 | 16 | options.shared.linux = lib.mkOption { |
| 16 | type = lib.types.anything; | |
| 17 | default = {}; | |
| 18 | description = "no-op on darwin"; | |
| 17 | type = lib.types.anything; | |
| 18 | default = { }; | |
| 19 | description = "no-op on darwin"; | |
| 19 | 20 | }; |
| 20 | 21 | } |
modules/macos/services/sketchybar/default.nix deleted-95| ... | ... | @@ -1,95 +0,0 @@ |
| 1 | { | |
| 2 | config, | |
| 3 | pkgs, | |
| 4 | colors, | |
| 5 | }: let | |
| 6 | template = pkgs.substituteAllFiles { | |
| 7 | src = ./config; | |
| 8 | files = [ | |
| 9 | "colors.lua" | |
| 10 | "settings.lua" | |
| 11 | "items/cpu.lua" | |
| 12 | "items/spaces.lua" | |
| 13 | ]; | |
| 14 | timeout = "${pkgs.coreutils}/bin/timeout"; | |
| 15 | ping = "${pkgs.inetutils}/bin/ping"; | |
| 16 | sketchybar_cpu = "${pkgs.sketchybar-helpers}/bin/sketchybar-cpu"; | |
| 17 | colors_blue = colors.nominal.blue; | |
| 18 | colors_red = colors.nominal.red; | |
| 19 | colors_unifying = colors.semantic.unifying; | |
| 20 | colors_good = colors.semantic.good; | |
| 21 | colors_info = colors.semantic.info; | |
| 22 | colors_warning = colors.semantic.warning; | |
| 23 | colors_urgent = colors.semantic.urgent; | |
| 24 | colors_primary_bg = colors.semantic.background; | |
| 25 | colors_primary_fg = colors.semantic.foreground; | |
| 26 | colors_secondary_bg = colors.semantic.background_highlighted; | |
| 27 | colors_secondary_fg = colors.semantic.foreground; | |
| 28 | colors_unselected_bg = colors.window.unselected.background; | |
| 29 | colors_unselected_fg = colors.window.unselected.text; | |
| 30 | colors_selected_focused_bg = colors.window.selected.focused.background; | |
| 31 | colors_selected_focused_fg = colors.window.selected.focused.text; | |
| 32 | colors_selected_unfocused_bg = colors.window.selected.unfocused.background; | |
| 33 | colors_selected_unfocused_fg = colors.window.selected.unfocused.text; | |
| 34 | font_family = config.theme.fonts.proportional.name; | |
| 35 | }; | |
| 36 | ||
| 37 | appIconNames = pkgs.runCommand "sketchybar-app-icon-names" {} '' | |
| 38 | mkdir -p "$out" | |
| 39 | { | |
| 40 | echo "return {" | |
| 41 | "${pkgs.findutils}/bin/find" \ | |
| 42 | "${pkgs.sources.sketchybar-font-src}/mappings" \ | |
| 43 | -type f \ | |
| 44 | -mindepth 1 \ | |
| 45 | -maxdepth 1 | while read -r f | |
| 46 | do cat $f | sed 's/ *| */\n/g;s/[*]//g' | while read -r s | |
| 47 | do echo " [$s]" = \"''${f##*/}\", | |
| 48 | done | |
| 49 | done | |
| 50 | echo ' [".kitty-wrapped"] = ":kitty:",' | |
| 51 | echo ' ["iTerm2"] = ":iterm:",' | |
| 52 | echo ' ["Google Chrome Beta"] = ":google_chrome:",' | |
| 53 | echo ' ["Microsoft Edge Beta"] = ":microsoft_edge:",' | |
| 54 | echo "}" | |
| 55 | } > "$out/app_icon_names.lua" | |
| 56 | ''; | |
| 57 | ||
| 58 | combined = pkgs.symlinkJoin { | |
| 59 | name = "sketchybar-config"; | |
| 60 | paths = [template appIconNames ./config]; | |
| 61 | }; | |
| 62 | ||
| 63 | luaposix = pkgs.lua5_4.pkgs.buildLuarocksPackage { | |
| 64 | pname = "luaposix"; | |
| 65 | version = "36.3-1"; | |
| 66 | src = pkgs.sources.luaposix; | |
| 67 | }; | |
| 68 | ||
| 69 | lua = pkgs.lua5_4.withPackages (ps: [ | |
| 70 | ps.lua-cjson | |
| 71 | luaposix | |
| 72 | ]); | |
| 73 | in { | |
| 74 | enable = true; | |
| 75 | package = pkgs.sketchybar; | |
| 76 | config = '' | |
| 77 | #!${lua}/bin/lua | |
| 78 | ||
| 79 | package.cpath = package.cpath .. ";${pkgs.sketchybar-lua}/?.so" | |
| 80 | package.path = package.path .. ";${combined}/?.lua;${combined}/?/init.lua" | |
| 81 | ||
| 82 | local Aerospace = require("aerospace") | |
| 83 | local aerospace = Aerospace.new() | |
| 84 | while not aerospace:is_initialized() do | |
| 85 | os.execute("sleep 0.1") | |
| 86 | end | |
| 87 | sbar = require("sketchybar") | |
| 88 | sbar.aerospace = aerospace | |
| 89 | sbar.begin_config() | |
| 90 | require("init") | |
| 91 | sbar.hotload(false) | |
| 92 | sbar.end_config() | |
| 93 | sbar.event_loop() | |
| 94 | ''; | |
| 95 | } |
modules/macos/tiling/sketchybar-home.nix deleted-539| ... | ... | @@ -1,539 +0,0 @@ |
| 1 | { | |
| 2 | pkgs, | |
| 3 | lib, | |
| 4 | config, | |
| 5 | ... | |
| 6 | }: let | |
| 7 | # folder = "${config.home.homeDirectory}.dotfiles/files/sketchybar"; | |
| 8 | # folder = "~/.dotfiles/files/sketchybar"; | |
| 9 | folder = ../../../files/sketchybar; | |
| 10 | in { | |
| 11 | home.file = | |
| 12 | lib.attrsets.mapAttrs (file: value: ( | |
| 13 | lib.attrsets.overrideExisting value {enable = config.shared.darwin.tiling.enable;} | |
| 14 | )) { | |
| 15 | sketchybarrc = { | |
| 16 | executable = true; | |
| 17 | target = ".config/sketchybar/sketchybarrc"; | |
| 18 | text = '' | |
| 19 | #!/usr/bin/env sh | |
| 20 | ||
| 21 | source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors | |
| 22 | ||
| 23 | ITEM_DIR="$HOME/.config/sketchybar/items" # Directory where the items are configured | |
| 24 | PLUGIN_DIR="$HOME/.config/sketchybar/plugins" # Directory where all the plugin scripts are stored | |
| 25 | ||
| 26 | FONT="SF Pro" # Needs to have Regular, Bold, Semibold, Heavy and Black variants | |
| 27 | PADDINGS=3 # All paddings use this value (icon, label, background) | |
| 28 | ||
| 29 | ||
| 30 | # Setting up the general bar appearance and default values | |
| 31 | ${pkgs.sketchybar}/bin/sketchybar --bar height=40 \ | |
| 32 | blur_radius=30 \ | |
| 33 | position=top \ | |
| 34 | sticky=on \ | |
| 35 | padding_left=10 \ | |
| 36 | padding_right=10 | |
| 37 | ||
| 38 | ||
| 39 | ${pkgs.sketchybar}/bin/sketchybar --default icon.font="SF Pro:Semibold:12.0" \ | |
| 40 | icon.color=$ITEM_COLOR \ | |
| 41 | label.font="SF Pro:Semibold:12.0" \ | |
| 42 | label.color=$ITEM_COLOR \ | |
| 43 | background.color=$ACCENT_COLOR \ | |
| 44 | background.corner_radius=10 \ | |
| 45 | background.height=20 \ | |
| 46 | padding_left=4 \ | |
| 47 | padding_right=4 \ | |
| 48 | icon.padding_left=6 \ | |
| 49 | icon.padding_right=3 \ | |
| 50 | label.padding_left=3 \ | |
| 51 | label.padding_right=6 | |
| 52 | ||
| 53 | ||
| 54 | # Left | |
| 55 | # source "$ITEM_DIR/apple.sh" | |
| 56 | source "$ITEM_DIR/spaces.sh" | |
| 57 | source "$ITEM_DIR/front_app.sh" | |
| 58 | ||
| 59 | # Center | |
| 60 | # source "$ITEM_DIR/spotify.sh" | |
| 61 | source "$ITEM_DIR/calendar.sh" | |
| 62 | ||
| 63 | # Right | |
| 64 | source $ITEM_DIR/calendar.sh | |
| 65 | source $ITEM_DIR/wifi.sh | |
| 66 | source $ITEM_DIR/battery.sh | |
| 67 | source $ITEM_DIR/volume.sh | |
| 68 | ||
| 69 | # Forcing all item scripts to run (never do this outside of sketchybarrc) | |
| 70 | ${pkgs.sketchybar}/bin/sketchybar --update | |
| 71 | ||
| 72 | echo "sketchybar configuation loaded.." | |
| 73 | ''; | |
| 74 | }; | |
| 75 | icons = { | |
| 76 | executable = true; | |
| 77 | target = ".config/sketchybar/plugins/icons.sh"; | |
| 78 | text = '' | |
| 79 | #!/usr/bin/env sh | |
| 80 | ||
| 81 | # Source the icon map with all the application icons | |
| 82 | source ${pkgs.sketchybar-app-font}/bin/icon_map.sh | |
| 83 | ||
| 84 | # Create a cache directory if it doesn't exist | |
| 85 | CACHE_DIR="$HOME/.cache/sketchybar" | |
| 86 | mkdir -p "$CACHE_DIR" | |
| 87 | ||
| 88 | # Cache file for icon mappings | |
| 89 | ICON_CACHE="$CACHE_DIR/icon_cache.txt" | |
| 90 | ||
| 91 | # Create the cache file if it doesn't exist | |
| 92 | if [ ! -f "$ICON_CACHE" ]; then | |
| 93 | touch "$ICON_CACHE" | |
| 94 | fi | |
| 95 | ||
| 96 | # Check if the app is already in cache | |
| 97 | APP_NAME=$(if [ "$1" = "Zen" ]; then echo "Zen Browser"; else echo "$1"; fi) | |
| 98 | ||
| 99 | CACHED_ICON=$(grep "^$APP_NAME|" "$ICON_CACHE" | cut -d '|' -f2) | |
| 100 | ||
| 101 | if [ -n "$CACHED_ICON" ]; then | |
| 102 | # Cache hit, return the icon | |
| 103 | echo "$CACHED_ICON" | |
| 104 | exit 0 | |
| 105 | fi | |
| 106 | ||
| 107 | # Get icon from the mapping function | |
| 108 | __icon_map "$APP_NAME" | |
| 109 | ||
| 110 | if [ -n "$icon_result" ]; then | |
| 111 | echo "$APP_NAME|$icon_result" >>"$ICON_CACHE" | |
| 112 | fi | |
| 113 | ||
| 114 | echo "$icon_result" | |
| 115 | ''; | |
| 116 | }; | |
| 117 | colors = { | |
| 118 | executable = true; | |
| 119 | target = ".config/sketchybar/colors.sh"; | |
| 120 | text = '' | |
| 121 | ||
| 122 | export TRANSPARENT=0x00ffffff | |
| 123 | ||
| 124 | # -- Gray Scheme -- | |
| 125 | export ITEM_COLOR=0xff000000 | |
| 126 | export ACCENT_COLOR=0xffc3c6cb | |
| 127 | ||
| 128 | # -- White Scheme -- | |
| 129 | # export ITEM_COLOR=0xff000000 | |
| 130 | # export ACCENT_COLOR=0xffffffff | |
| 131 | ||
| 132 | # -- Teal Scheme -- | |
| 133 | # export ITEM_COLOR=0xff000000 | |
| 134 | # export ACCENT_COLOR=0xff2cf9ed | |
| 135 | ||
| 136 | # -- Purple Scheme -- | |
| 137 | # export ITEM_COLOR=0xff000000 | |
| 138 | # export ACCENT_COLOR=0xffeb46f9 | |
| 139 | ||
| 140 | # -- Red Scheme --- | |
| 141 | # export ITEM_COLOR=0xff000000 | |
| 142 | # export ACCENT_COLOR=0xffff2453 | |
| 143 | ||
| 144 | # -- Blue Scheme --- | |
| 145 | # export ITEM_COLOR=0xff000000 | |
| 146 | # export ACCENT_COLOR=0xff15bdf9 | |
| 147 | ||
| 148 | # -- Green Scheme -- | |
| 149 | # export ITEM_COLOR=0xff000000 | |
| 150 | # export ACCENT_COLOR=0xff1dfca1 | |
| 151 | ||
| 152 | # -- Orange Scheme -- | |
| 153 | # export ITEM_COLOR=0xffffffff | |
| 154 | # export ACCENT_COLOR=0xfff97716 | |
| 155 | ||
| 156 | # -- Yellow Scheme -- | |
| 157 | # export ITEM_COLOR=0xff000000 | |
| 158 | # export ACCENT_COLOR=0xfff7fc17 | |
| 159 | ''; | |
| 160 | }; | |
| 161 | items_wifi = { | |
| 162 | executable = true; | |
| 163 | target = ".config/sketchybar/items/wifi.sh"; | |
| 164 | text = '' | |
| 165 | #!/usr/bin/env/ sh | |
| 166 | ||
| 167 | sketchybar --add item wifi right \ | |
| 168 | --set wifi \ | |
| 169 | icon="" \ | |
| 170 | label="Updating..." \ | |
| 171 | script="$PLUGIN_DIR/wifi.sh" \ | |
| 172 | --subscribe wifi wifi_change | |
| 173 | ''; | |
| 174 | }; | |
| 175 | items_battery = { | |
| 176 | executable = true; | |
| 177 | target = ".config/sketchybar/items/battery.sh"; | |
| 178 | text = '' | |
| 179 | #!/usr/bin/env/ sh | |
| 180 | sketchybar --add item battery right \ | |
| 181 | --set battery update_freq=180 \ | |
| 182 | script="$PLUGIN_DIR/battery.sh" \ | |
| 183 | --subscribe battery system_woke power_source_change | |
| 184 | ''; | |
| 185 | }; | |
| 186 | items_calendar = { | |
| 187 | executable = true; | |
| 188 | target = ".config/sketchybar/items/calendar.sh"; | |
| 189 | text = '' | |
| 190 | #!/usr/bin/env sh | |
| 191 | sketchybar --add item calendar right \ | |
| 192 | --set calendar icon= \ | |
| 193 | update_freq=15 \ | |
| 194 | script="$PLUGIN_DIR/calendar.sh" | |
| 195 | ''; | |
| 196 | }; | |
| 197 | items_front_app = { | |
| 198 | executable = true; | |
| 199 | target = ".config/sketchybar/items/front_app.sh"; | |
| 200 | text = '' | |
| 201 | #!/usr/bin/env sh | |
| 202 | ||
| 203 | sketchybar --add item front_app left \ | |
| 204 | --set front_app background.color=$ACCENT_COLOR \ | |
| 205 | icon.color=$ITEM_COLOR \ | |
| 206 | label.color=$ITEM_COLOR \ | |
| 207 | icon.font="sketchybar-app-font:Regular:12.0" \ | |
| 208 | label.font="SF Pro:Semibold:12.0" \ | |
| 209 | script="$PLUGIN_DIR/front_app.sh" \ | |
| 210 | --subscribe front_app front_app_switched | |
| 211 | ''; | |
| 212 | }; | |
| 213 | items_spaces = { | |
| 214 | executable = true; | |
| 215 | target = ".config/sketchybar/items/spaces.sh"; | |
| 216 | text = '' | |
| 217 | sketchybar --add event aerospace_workspace_change | |
| 218 | ||
| 219 | sketchybar --add item aerospace_dummy left \ | |
| 220 | --set aerospace_dummy display=0 \ | |
| 221 | script="$PLUGIN_DIR/spaces.sh" \ | |
| 222 | --subscribe aerospace_dummy aerospace_workspace_change | |
| 223 | ||
| 224 | for m in $(aerospace list-monitors | awk '{print $1}'); do | |
| 225 | for sid in $(aerospace list-workspaces --monitor $m); do | |
| 226 | sketchybar --add space space.$sid left \ | |
| 227 | --set space.$sid space=$sid \ | |
| 228 | icon=$sid \ | |
| 229 | background.color=$TRANSPARENT \ | |
| 230 | label.color=$ACCENT_COLOR \ | |
| 231 | icon.color=$ACCENT_COLOR \ | |
| 232 | display=$m \ | |
| 233 | label.font="sketchybar-app-font:Regular:12.0" \ | |
| 234 | icon.font="SF Pro:Semibold:12.0" \ | |
| 235 | label.padding_right=10 \ | |
| 236 | label.y_offset=-1 \ | |
| 237 | click_script="$PLUGIN_DIR/space_click.sh $sid" | |
| 238 | ||
| 239 | apps=$(aerospace list-windows --monitor "$m" --workspace "$sid" | | |
| 240 | awk -F '|' '{gsub(/^ *| *$/, "", $2); if (!seen[$2]++) print $2}') | |
| 241 | ||
| 242 | icon_strip="" | |
| 243 | if [ "''${apps}" != "" ]; then | |
| 244 | while read -r app; do | |
| 245 | icon_strip+=" $($PLUGIN_DIR/icons.sh "$app")" | |
| 246 | done <<<"''${apps}" | |
| 247 | else | |
| 248 | icon_strip=" —" | |
| 249 | fi | |
| 250 | ||
| 251 | sketchybar --set space.$sid label="$icon_strip" | |
| 252 | ||
| 253 | done | |
| 254 | ||
| 255 | for empty_space in $(aerospace list-workspaces --monitor $m --empty); do | |
| 256 | sketchybar --set space.$empty_space display=0 | |
| 257 | done | |
| 258 | for focus in $(aerospace list-workspaces --focused); do | |
| 259 | sketchybar --set space.$focus background.drawing=on \ | |
| 260 | background.color=$ACCENT_COLOR \ | |
| 261 | label.color=$ITEM_COLOR \ | |
| 262 | icon.color=$ITEM_COLOR | |
| 263 | done | |
| 264 | done | |
| 265 | ''; | |
| 266 | }; | |
| 267 | ||
| 268 | items_volume = { | |
| 269 | executable = true; | |
| 270 | target = ".config/sketchybar/items/volume.sh"; | |
| 271 | text = '' | |
| 272 | #/usr/bin/env sh | |
| 273 | ||
| 274 | sketchybar --add item volume right \ | |
| 275 | --set volume script="$PLUGIN_DIR/volume.sh" \ | |
| 276 | --subscribe volume volume_change | |
| 277 | ''; | |
| 278 | }; | |
| 279 | plugins_wifi = { | |
| 280 | executable = true; | |
| 281 | target = ".config/sketchybar/plugins/wifi.sh"; | |
| 282 | text = '' | |
| 283 | #/usr/bin/env sh | |
| 284 | ||
| 285 | SSID=$(system_profiler SPAirPortDataType | awk '/Current Network Information:/ { getline; print substr($0, 13, (length($0) - 13)); exit }') | |
| 286 | ||
| 287 | if [ "$SSID" = "" ]; then | |
| 288 | sketchybar --set $NAME icon="" label="Disconnected" | |
| 289 | else | |
| 290 | sketchybar --set $NAME icon="" label="$SSID" | |
| 291 | fi | |
| 292 | ||
| 293 | ''; | |
| 294 | }; | |
| 295 | plugins_calendar = { | |
| 296 | executable = true; | |
| 297 | target = ".config/sketchybar/plugins/calendar.sh"; | |
| 298 | ||
| 299 | text = '' | |
| 300 | #/usr/bin/env sh | |
| 301 | ||
| 302 | sketchybar --set $NAME label="$(date +'%a %d %b %I:%M %p')" | |
| 303 | ''; | |
| 304 | }; | |
| 305 | plugins_spaces = { | |
| 306 | executable = true; | |
| 307 | target = ".config/sketchybar/plugins/spaces.sh"; | |
| 308 | text = '' | |
| 309 | #!/usr/bin/env sh | |
| 310 | ||
| 311 | source "$CONFIG_DIR/colors.sh" | |
| 312 | ||
| 313 | update_workspace_appearance() { | |
| 314 | local sid=$1 | |
| 315 | local is_focused=$2 | |
| 316 | ||
| 317 | if [ "$is_focused" = "true" ]; then | |
| 318 | sketchybar --set space.$sid background.drawing=on \ | |
| 319 | background.color=$ACCENT_COLOR \ | |
| 320 | label.color=$ITEM_COLOR \ | |
| 321 | icon.color=$ITEM_COLOR | |
| 322 | else | |
| 323 | sketchybar --set space.$sid background.drawing=off \ | |
| 324 | label.color=$ACCENT_COLOR \ | |
| 325 | icon.color=$ACCENT_COLOR | |
| 326 | fi | |
| 327 | } | |
| 328 | ||
| 329 | update_icons() { | |
| 330 | m=$1 | |
| 331 | sid=$2 | |
| 332 | ||
| 333 | apps=$(aerospace list-windows --monitor "$m" --workspace "$sid" \ | |
| 334 | | awk -F '|' '{gsub(/^ *| *$/, "", $2); if (!seen[$2]++) print $2}' \ | |
| 335 | | sort) | |
| 336 | ||
| 337 | icon_strip="" | |
| 338 | if [ "''${apps}" != "" ]; then | |
| 339 | while read -r app; do | |
| 340 | icon_strip+=" $($CONFIG_DIR/plugins/icons.sh "$app")" | |
| 341 | done <<<"''${apps}" | |
| 342 | else | |
| 343 | icon_strip=" —" | |
| 344 | fi | |
| 345 | ||
| 346 | sketchybar --animate sin 10 --set space.$sid label="$icon_strip" | |
| 347 | } | |
| 348 | ||
| 349 | update_workspace_appearance "$PREV_WORKSPACE" "false" | |
| 350 | update_workspace_appearance "$FOCUSED_WORKSPACE" "true" | |
| 351 | ||
| 352 | for m in $(aerospace list-monitors | awk '{print $1}'); do | |
| 353 | for sid in $(aerospace list-workspaces --monitor $m --visible); do | |
| 354 | sketchybar --set space.$sid display=$m | |
| 355 | ||
| 356 | update_icons "$m" "$sid" | |
| 357 | ||
| 358 | update_icons "$m" "$PREV_WORKSPACE" | |
| 359 | ||
| 360 | apps=$(aerospace list-windows --monitor "$m" --workspace "$sid" | wc -l) | |
| 361 | if [ "''${apps}" -eq 0 ]; then | |
| 362 | sketchybar --set space.$sid display=0 | |
| 363 | fi | |
| 364 | done | |
| 365 | done | |
| 366 | ''; | |
| 367 | }; | |
| 368 | ||
| 369 | plugins_space_click = { | |
| 370 | executable = true; | |
| 371 | target = ".config/sketchybar/plugins/space_click.sh"; | |
| 372 | text = '' | |
| 373 | #/usr/bin/env/ sh | |
| 374 | ||
| 375 | apps=$(aerospace list-windows --workspace $1 | awk -F '|' '{gsub(/^ *| *$/, "", $2); print $2}') | |
| 376 | focused=$(aerospace list-workspaces --focused) | |
| 377 | ||
| 378 | if [ "''${apps}" = "" ] && [ "''${focused}" != "$1" ]; then | |
| 379 | sketchybar --set space.$1 display=0 | |
| 380 | else | |
| 381 | aerospace workspace $1 | |
| 382 | fi | |
| 383 | ''; | |
| 384 | ; | |
| 385 | plugins_volume = { | |
| 386 | executable = true; | |
| 387 | target = ".config/sketchybar/plugins/volume.sh"; | |
| 388 | text = '' | |
| 389 | #!/usr/bin/env sh | |
| 390 | ||
| 391 | # The volume_change event supplies a $INFO variable in which the current volume | |
| 392 | # percentage is passed to the script. | |
| 393 | ||
| 394 | if [ "$SENDER" = "volume_change" ]; then | |
| 395 | ||
| 396 | VOLUME=$INFO | |
| 397 | ||
| 398 | case $VOLUME in | |
| 399 | [6-9][0-9] | 100) | |
| 400 | ICON="" | |
| 401 | ;; | |
| 402 | [3-5][0-9]) | |
| 403 | ICON="" | |
| 404 | ;; | |
| 405 | [1-9] | [1-2][0-9]) | |
| 406 | ICON="" | |
| 407 | ;; | |
| 408 | *) ICON="" ;; | |
| 409 | esac | |
| 410 | ||
| 411 | sketchybar --set $NAME icon="$ICON" label="$VOLUME%" | |
| 412 | fi | |
| 413 | ''; | |
| 414 | }; | |
| 415 | plugins_front_app = { | |
| 416 | executable = true; | |
| 417 | target = ".config/sketchybar/plugins/front_app.sh"; | |
| 418 | text = '' | |
| 419 | # Some events send additional information specific to the event in the $INFO | |
| 420 | # variable. E.g. the front_app_switched event sends the name of the newly | |
| 421 | # focused application in the $INFO variable: | |
| 422 | # https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting | |
| 423 | ||
| 424 | app_switched() { | |
| 425 | for m in $(aerospace list-monitors | awk '{print $1}'); do | |
| 426 | for sid in $(aerospace list-workspaces --monitor $m --visible); do | |
| 427 | ||
| 428 | apps=$( (echo "$INFO"; aerospace list-windows --monitor "$m" --workspace "$sid" \ | |
| 429 | | awk -F '|' '{gsub(/^ *| *$/, "", $2); print $2}') \ | |
| 430 | | awk '!seen[$0]++' | sort) | |
| 431 | ||
| 432 | icon_strip="" | |
| 433 | if [ "''${apps}" != "" ]; then | |
| 434 | while read -r app; do | |
| 435 | icon_strip+=" $($CONFIG_DIR/plugins/icons.sh "$app")" | |
| 436 | done <<<"''${apps}" | |
| 437 | else | |
| 438 | icon_strip=" —" | |
| 439 | fi | |
| 440 | ||
| 441 | sketchybar --animate sin 10 --set space.$sid label="$icon_strip" | |
| 442 | done | |
| 443 | done | |
| 444 | } | |
| 445 | ||
| 446 | if [ "$SENDER" = "front_app_switched" ]; then | |
| 447 | ||
| 448 | sketchybar --set $NAME label="$INFO" icon="$($CONFIG_DIR/plugins/icons.sh "$INFO")" | |
| 449 | ||
| 450 | app_switched | |
| 451 | fi | |
| 452 | ''; | |
| 453 | }; | |
| 454 | plugins_battery = { | |
| 455 | executable = true; | |
| 456 | target = ".config/sketchybar/plugins/battery.sh"; | |
| 457 | text = '' | |
| 458 | #!/usr/bin/env sh | |
| 459 | source "$CONFIG_DIR/colors.sh" | |
| 460 | ||
| 461 | PERCENTAGE=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1) | |
| 462 | CHARGING=$(pmset -g batt | grep 'AC Power') | |
| 463 | ||
| 464 | if [ $PERCENTAGE = "" ]; then | |
| 465 | exit 0 | |
| 466 | fi | |
| 467 | ||
| 468 | case ''${PERCENTAGE} in | |
| 469 | 9[0-9] | 100) | |
| 470 | ICON="" | |
| 471 | COLOR=$ITEM_COLOR | |
| 472 | ;; | |
| 473 | [6-8][0-9]) | |
| 474 | ICON="" | |
| 475 | COLOR=$ITEM_COLOR | |
| 476 | ;; | |
| 477 | [3-5][0-9]) | |
| 478 | ICON="" | |
| 479 | COLOR="0xFFd97706" | |
| 480 | ;; | |
| 481 | [1-2][0-9]) | |
| 482 | ICON="" | |
| 483 | COLOR="0xFFf97316" | |
| 484 | ;; | |
| 485 | *) | |
| 486 | ICON="" | |
| 487 | COLOR="0xFFef4444" | |
| 488 | ;; | |
| 489 | esac | |
| 490 | ||
| 491 | if [[ $CHARGING != "" ]]; then | |
| 492 | ICON="" | |
| 493 | COLOR=$ITEM_COLOR | |
| 494 | fi | |
| 495 | ||
| 496 | # The item invoking this script (name $NAME) will get its icon and label | |
| 497 | # updated with the current battery status | |
| 498 | sketchybar --set $NAME icon="$ICON" label="''${PERCENTAGE}%" icon.color="$COLOR" | |
| 499 | ''; | |
| 500 | }; | |
| 501 | plugins_aerospace = { | |
| 502 | executable = true; | |
| 503 | target = ".config/sketchybar/plugins/aerospace.sh"; | |
| 504 | text = '' | |
| 505 | #!/usr/bin/env bash | |
| 506 | source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors | |
| 507 | ||
| 508 | highlight_focused_workspace() { | |
| 509 | if [[ "$1" = "$FOCUSED_WORKSPACE" ]] | |
| 510 | then | |
| 511 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=on label.width=0 | |
| 512 | else | |
| 513 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=off label.width=dynamic | |
| 514 | fi | |
| 515 | } | |
| 516 | ||
| 517 | illuminate_mode() { | |
| 518 | if [[ "$mode" = "service" ]] | |
| 519 | then | |
| 520 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$ORANGE | |
| 521 | elif [[ "$mode" = "resize" ]] | |
| 522 | then | |
| 523 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$GREEN | |
| 524 | else | |
| 525 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$BACKGROUND_1 | |
| 526 | fi | |
| 527 | } | |
| 528 | case "$SENDER" in | |
| 529 | "aerospace_workspace_change") | |
| 530 | highlight_focused_workspace $1 | |
| 531 | ;; | |
| 532 | "aerospace_mode_change") | |
| 533 | illuminate_mode | |
| 534 | ;; | |
| 535 | esac | |
| 536 | ''; | |
| 537 | }; | |
| 538 | }; | |
| 539 | } |
modules/neovim/default.nix+58-3| ... | ... | @@ -3,8 +3,7 @@ |
| 3 | 3 | lib, |
| 4 | 4 | host, |
| 5 | 5 | ... |
| 6 | }: | |
| 7 | { | |
| 6 | }: { | |
| 8 | 7 | # based on default options from upstream: |
| 9 | 8 | # https://github.com/NotAShelf/nvf/blob/main/configuration.nix |
| 10 | 9 | # |
| ... | ... | @@ -68,6 +67,7 @@ |
| 68 | 67 | rust.enable = true; |
| 69 | 68 | ts.enable = true; |
| 70 | 69 | zig.enable = true; |
| 70 | markdown.enable = true; | |
| 71 | 71 | # sort-lines: off |
| 72 | 72 | |
| 73 | 73 | nix.format.type = "nixfmt"; # looks so much nicer |
| ... | ... | @@ -81,7 +81,16 @@ |
| 81 | 81 | nvimBufferline.enable = true; |
| 82 | 82 | }; |
| 83 | 83 | autocomplete = { |
| 84 | blink-cmp.enable = true; | |
| 84 | blink-cmp = { | |
| 85 | enable = true; | |
| 86 | sourcePlugins = { | |
| 87 | ripgrep.enable = true; | |
| 88 | }; | |
| 89 | friendly-snippets.enable = true; | |
| 90 | setupOpts = { | |
| 91 | keymap.preset = "super-tab"; | |
| 92 | }; | |
| 93 | }; | |
| 85 | 94 | }; |
| 86 | 95 | statusline = { |
| 87 | 96 | lualine = { |
| ... | ... | @@ -93,6 +102,52 @@ |
| 93 | 102 | }; |
| 94 | 103 | }; |
| 95 | 104 | }; |
| 105 | ||
| 106 | utility = { | |
| 107 | snacks-nvim = { | |
| 108 | enable = true; | |
| 109 | setupOpts = { | |
| 110 | bigfile.enable = true; | |
| 111 | explorer.replace_netrw = true; | |
| 112 | dashboard = { | |
| 113 | sections = [ | |
| 114 | {section = "header";} | |
| 115 | { | |
| 116 | icon = " "; | |
| 117 | title = "Keymaps"; | |
| 118 | section = "keys"; | |
| 119 | indent = 2; | |
| 120 | padding = 1; | |
| 121 | } | |
| 122 | { | |
| 123 | icon = " "; | |
| 124 | title = "Recent Files"; | |
| 125 | section = "recent_files"; | |
| 126 | indent = 2; | |
| 127 | padding = 1; | |
| 128 | } | |
| 129 | { | |
| 130 | icon = " "; | |
| 131 | title = "Projects"; | |
| 132 | section = "projects"; | |
| 133 | indent = 2; | |
| 134 | padding = 1; | |
| 135 | } | |
| 136 | {section = "startup";} | |
| 137 | ]; | |
| 138 | }; | |
| 139 | image.enable = true; | |
| 140 | notifier.timeout = 3000; | |
| 141 | picker = { | |
| 142 | enable = true; | |
| 143 | sources = { | |
| 144 | explorer = {}; | |
| 145 | }; | |
| 146 | }; | |
| 147 | }; | |
| 148 | }; | |
| 149 | }; | |
| 150 | ||
| 96 | 151 | binds = { |
| 97 | 152 | whichKey.enable = true; |
| 98 | 153 | cheatsheet.enable = true; |
users/natalie/vim.nix+4-2| ... | ... | @@ -1,5 +1,7 @@ |
| 1 | { ... }: | |
| 2 | { | |
| 1 | {...}: { | |
| 2 | imports = [ | |
| 3 | ./vim/default.nix | |
| 4 | ]; | |
| 3 | 5 | vim = { |
| 4 | 6 | theme = { |
| 5 | 7 | name = "catppuccin"; |
users/natalie/vim/default.nix created+6| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | {...}: { | |
| 2 | imports = [ | |
| 3 | ./keybinds.nix | |
| 4 | ./languages.nix | |
| 5 | ]; | |
| 6 | } |
users/natalie/vim/keybinds.nix created+34| ... | ... | @@ -0,0 +1,34 @@ |
| 1 | {...}: let | |
| 2 | mkKeymap = mode: key: action: desc: { | |
| 3 | inherit | |
| 4 | mode | |
| 5 | key | |
| 6 | action | |
| 7 | desc | |
| 8 | ; | |
| 9 | }; | |
| 10 | in { | |
| 11 | vim = { | |
| 12 | keymaps = [ | |
| 13 | (mkKeymap "n" "<leader>e" "<cmd>lua require('snacks').explorer()<cr>" "File Explorer") | |
| 14 | ||
| 15 | # Snacks Picker Replaces Telescope!? | |
| 16 | (mkKeymap "n" "<leader><space>" "<cmd>lua require('snacks').picker.smart()" "Smart Find Files") | |
| 17 | (mkKeymap "n" "<leader>ff" "<cmd>lua require('snacks').picker.files()<cr>" "Find File") | |
| 18 | # (mkKeymap "n" "<leader>fr" "<cmd>lua require('snacks').picker.recent()<cr>" "Open Recent File") | |
| 19 | (mkKeymap "n" "<leader>fg" "<cmd>lua require('snacks').picker.grep()<cr>" "Grep Files") | |
| 20 | # (mkKeymap "n" "<leader>fb" "<cmd>lua require('snacks').picker.buffers()<cr>" "Grep Buffers") | |
| 21 | # (mkKeymap "n" "<leader>fh" "<cmd>lua require('snacks').picker.help()<cr>" "Grep Help Tags") | |
| 22 | # (mkKeymap "n" "<leader>fg" "<cmd>lua require('snacks').picker.git_files()<cr>" "Grep Git Files") | |
| 23 | # (mkKeymap "n" "<leader>fd" "<cmd>lua require('snacks').picker.diagnostics()<cr>" "Grep Diagnostics") | |
| 24 | # (mkKeymap "n" "<leader>fc" "<cmd>lua require('aerial').snacks_picker()<cr>" "Code Outline") | |
| 25 | ||
| 26 | # Lsp | |
| 27 | (mkKeymap "n" "gd" "<cmd>lua require('snacks').picker.lsp_definitions<cr>" "Goto Definition") | |
| 28 | (mkKeymap "n" "gD" "<cmd>lua require('snacks').picker.lsp_declarations<cr>" "Goto Declarations") | |
| 29 | (mkKeymap "n" "gI" "<cmd>lua require('snacks').picker.lsp_implementations<cr>" "Goto Implementation") | |
| 30 | (mkKeymap "n" "gr" "<cmd>lua require('snacks').picker.lsp_references<cr>" "Goto References") | |
| 31 | (mkKeymap "n" "gy" "<cmd>lua require('snacks').picker.lsp_type_definitions<cr>" "Goto T[y]pe Definition") | |
| 32 | ]; | |
| 33 | }; | |
| 34 | } |
users/natalie/vim/languages.nix created+73| ... | ... | @@ -0,0 +1,73 @@ |
| 1 | {flake, ...}: { | |
| 2 | vim = { | |
| 3 | lsp.servers.nixd.settings = { | |
| 4 | nixd.nixpkgs.expr = "import '${flake.inputs.nixpkgs}' { }"; | |
| 5 | }; | |
| 6 | languages = { | |
| 7 | enableDAP = true; | |
| 8 | haskell.enable = true; | |
| 9 | lua.enable = true; | |
| 10 | python.enable = true; | |
| 11 | python.format.type = "ruff"; | |
| 12 | # markdown.extensions.markview-nvim = { | |
| 13 | # enable = true; | |
| 14 | # setupOpts = { | |
| 15 | # }; | |
| 16 | # }; | |
| 17 | nix = { | |
| 18 | lsp = { | |
| 19 | server = "nixd"; | |
| 20 | options = { | |
| 21 | nixos = { | |
| 22 | expr = "(let | |
| 23 | pkgs = import '${flake.inputs.nixpkgs}' {}; | |
| 24 | inherit (pkgs) lib; | |
| 25 | in (lib.evalModules { | |
| 26 | modules = import '${flake.inputs.nixpkgs}/nixos/modules/module-list.nix'; | |
| 27 | check = false; | |
| 28 | })).options"; | |
| 29 | }; | |
| 30 | nix_darwin = { | |
| 31 | expr = "(let | |
| 32 | pkgs = import ''${flake.inputs.nixpkgs}' {}; | |
| 33 | inherit (pkgs) lib; | |
| 34 | in (lib.evalModules { | |
| 35 | modules = import '${flake.inputs.darwin}/modules/module-list.nix'; | |
| 36 | check = false; | |
| 37 | })).options"; | |
| 38 | }; | |
| 39 | home_manager = { | |
| 40 | expr = "(let | |
| 41 | pkgs = import '${flake.inputs.nixpkgs}' {}; | |
| 42 | lib = import '${flake.inputs.home-manager}/modules/lib/stdlib-extended.nix' pkgs.lib; | |
| 43 | in (lib.evalModules { | |
| 44 | modules = (import '${flake.inputs.home-manager}/modules/modules.nix') { | |
| 45 | inherit lib pkgs; | |
| 46 | check = false; | |
| 47 | }; | |
| 48 | })).options"; | |
| 49 | }; | |
| 50 | }; | |
| 51 | }; | |
| 52 | }; | |
| 53 | }; | |
| 54 | formatter.conform-nvim = { | |
| 55 | enable = true; | |
| 56 | setupOpts = { | |
| 57 | formatters_by_ft = { | |
| 58 | fish = ["fish_indent"]; | |
| 59 | tex = ["latexindent"]; | |
| 60 | }; | |
| 61 | }; | |
| 62 | }; | |
| 63 | ||
| 64 | diagnostics.nvim-lint = { | |
| 65 | enable = true; | |
| 66 | linters_by_ft = { | |
| 67 | nix = ["statix"]; | |
| 68 | tex = ["chktex"]; | |
| 69 | haskell = ["hlint"]; | |
| 70 | }; | |
| 71 | }; | |
| 72 | }; | |
| 73 | } |