authorgravatar for nmarks413@gmail.comNatalie Marks <nmarks413@gmail.com> 2025-05-28 08:31:42-07:00
committergravatar for nmarks413@gmail.comNatalie Marks <nmarks413@gmail.com> 2025-05-28 08:31:42-07:00
log800f63b000bebf518dad1b6e6e85e99640e95ec6
tree67db8e01a8434907287f7f2503103b286688c198
parentb9e231d72f6a18b719440657b0048dcd9699c442
signature Commit is signed but in an unrecognized format.

made config work on nixos


7 files changed, 640 insertions(+), 725 deletions(-)

flake.lock+6-83
...@@ -50,22 +50,6 @@...@@ -50,22 +50,6 @@
50 }50 }
51 },51 },
52 "flake-compat": {52 "flake-compat": {
53 "flake": false,
54 "locked": {
55 "lastModified": 1746162366,
56 "narHash": "sha256-5SSSZ/oQkwfcAz/o/6TlejlVGqeK08wyREBQ5qFFPhM=",
57 "owner": "nix-community",
58 "repo": "flake-compat",
59 "rev": "0f158086a2ecdbb138cd0429410e44994f1b7e4b",
60 "type": "github"
61 },
62 "original": {
63 "owner": "nix-community",
64 "repo": "flake-compat",
65 "type": "github"
66 }
67 },
68 "flake-compat_2": {
69 "flake": false,53 "flake": false,
70 "locked": {54 "locked": {
71 "lastModified": 1696426674,55 "lastModified": 1696426674,
...@@ -81,7 +65,7 @@...@@ -81,7 +65,7 @@
81 "type": "github"65 "type": "github"
82 }66 }
83 },67 },
84 "flake-compat_3": {68 "flake-compat_2": {
85 "flake": false,69 "flake": false,
86 "locked": {70 "locked": {
87 "lastModified": 1696426674,71 "lastModified": 1696426674,
...@@ -427,7 +411,7 @@...@@ -427,7 +411,7 @@
427 "nvf",411 "nvf",
428 "nixpkgs"412 "nixpkgs"
429 ],413 ],
430 "rust-overlay": "rust-overlay_2"414 "rust-overlay": "rust-overlay"
431 },415 },
432 "locked": {416 "locked": {
433 "lastModified": 1741118843,417 "lastModified": 1741118843,
...@@ -483,29 +467,6 @@...@@ -483,29 +467,6 @@
483 "type": "github"467 "type": "github"
484 }468 }
485 },469 },
486 "nixos-cosmic": {
487 "inputs": {
488 "flake-compat": "flake-compat",
489 "nixpkgs": [
490 "nixpkgs"
491 ],
492 "nixpkgs-stable": "nixpkgs-stable",
493 "rust-overlay": "rust-overlay"
494 },
495 "locked": {
496 "lastModified": 1747826251,
497 "narHash": "sha256-Fe4AXmnnAKnh/wIe1ao4Pv/8m6WGA1ujwp6VApgos30=",
498 "owner": "lilyinstarlight",
499 "repo": "nixos-cosmic",
500 "rev": "9a67b4a289cd8994080398d40b57cfde8e8cfb0a",
501 "type": "github"
502 },
503 "original": {
504 "owner": "lilyinstarlight",
505 "repo": "nixos-cosmic",
506 "type": "github"
507 }
508 },
509 "nixpkgs": {470 "nixpkgs": {
510 "locked": {471 "locked": {
511 "lastModified": 1736012469,472 "lastModified": 1736012469,
...@@ -537,22 +498,6 @@...@@ -537,22 +498,6 @@
537 "type": "github"498 "type": "github"
538 }499 }
539 },500 },
540 "nixpkgs-stable": {
541 "locked": {
542 "lastModified": 1747676747,
543 "narHash": "sha256-LXkWBVqilgx7Pohwqu/ABxDVw+Cmi5/Mj2S2mpUH0Fw=",
544 "owner": "NixOS",
545 "repo": "nixpkgs",
546 "rev": "72841a4a8761d1aed92ef6169a636872c986c76d",
547 "type": "github"
548 },
549 "original": {
550 "owner": "NixOS",
551 "ref": "nixos-24.11",
552 "repo": "nixpkgs",
553 "type": "github"
554 }
555 },
556 "nixpkgs_2": {501 "nixpkgs_2": {
557 "locked": {502 "locked": {
558 "lastModified": 1747744144,503 "lastModified": 1747744144,
...@@ -647,36 +592,14 @@...@@ -647,36 +592,14 @@
647 "nh": "nh",592 "nh": "nh",
648 "nix-index-database": "nix-index-database",593 "nix-index-database": "nix-index-database",
649 "nix-options-search": "nix-options-search",594 "nix-options-search": "nix-options-search",
650 "nixos-cosmic": "nixos-cosmic",
651 "nixpkgs": "nixpkgs_2",595 "nixpkgs": "nixpkgs_2",
652 "nvf": "nvf",596 "nvf": "nvf",
653 "rust-overlay": "rust-overlay_3",597 "rust-overlay": "rust-overlay_2",
654 "zig": "zig",598 "zig": "zig",
655 "zls": "zls"599 "zls": "zls"
656 }600 }
657 },601 },
658 "rust-overlay": {602 "rust-overlay": {
659 "inputs": {
660 "nixpkgs": [
661 "nixos-cosmic",
662 "nixpkgs"
663 ]
664 },
665 "locked": {
666 "lastModified": 1747795013,
667 "narHash": "sha256-c7i0xJ+xFhgjO9SWHYu5dF/7lq63RPDvwKAdjc6VCE4=",
668 "owner": "oxalica",
669 "repo": "rust-overlay",
670 "rev": "6b1cf12374361859242a562e1933a7930649131a",
671 "type": "github"
672 },
673 "original": {
674 "owner": "oxalica",
675 "repo": "rust-overlay",
676 "type": "github"
677 }
678 },
679 "rust-overlay_2": {
680 "inputs": {603 "inputs": {
681 "nixpkgs": [604 "nixpkgs": [
682 "nvf",605 "nvf",
...@@ -698,7 +621,7 @@...@@ -698,7 +621,7 @@
698 "type": "github"621 "type": "github"
699 }622 }
700 },623 },
701 "rust-overlay_3": {624 "rust-overlay_2": {
702 "inputs": {625 "inputs": {
703 "nixpkgs": [626 "nixpkgs": [
704 "nixpkgs"627 "nixpkgs"
...@@ -924,7 +847,7 @@...@@ -924,7 +847,7 @@
924 },847 },
925 "zig": {848 "zig": {
926 "inputs": {849 "inputs": {
927 "flake-compat": "flake-compat_2",850 "flake-compat": "flake-compat",
928 "flake-utils": "flake-utils_5",851 "flake-utils": "flake-utils_5",
929 "nixpkgs": "nixpkgs_3"852 "nixpkgs": "nixpkgs_3"
930 },853 },
...@@ -944,7 +867,7 @@...@@ -944,7 +867,7 @@
944 },867 },
945 "zig-overlay": {868 "zig-overlay": {
946 "inputs": {869 "inputs": {
947 "flake-compat": "flake-compat_3",870 "flake-compat": "flake-compat_2",
948 "flake-utils": "flake-utils_7",871 "flake-utils": "flake-utils_7",
949 "nixpkgs": [872 "nixpkgs": [
950 "zls",873 "zls",
flake.nix+108-118
...@@ -29,9 +29,6 @@...@@ -29,9 +29,6 @@
29 moonlight.url = "github:moonlight-mod/moonlight"; # Add `/develop` to the flake URL to use nightly.29 moonlight.url = "github:moonlight-mod/moonlight"; # Add `/develop` to the flake URL to use nightly.
30 moonlight.inputs.nixpkgs.follows = "nixpkgs";30 moonlight.inputs.nixpkgs.follows = "nixpkgs";
3131
32 nixos-cosmic.url = "github:lilyinstarlight/nixos-cosmic";
33 nixos-cosmic.inputs.nixpkgs.follows = "nixpkgs";
34
35 nh.url = "github:viperML/nh";32 nh.url = "github:viperML/nh";
36 nh.inputs.nixpkgs.follows = "nixpkgs";33 nh.inputs.nixpkgs.follows = "nixpkgs";
3734
...@@ -40,80 +37,76 @@...@@ -40,80 +37,76 @@
40 nix-index-database.url = "github:nix-community/nix-index-database";37 nix-index-database.url = "github:nix-community/nix-index-database";
41 nix-index-database.inputs.nixpkgs.follows = "nixpkgs";38 nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
42 };39 };
43 outputs =40 outputs = {
44 {41 self,
45 self,42 nixpkgs,
46 nixpkgs,43 lix-module,
47 lix-module,44 darwin,
48 nixos-cosmic,45 ...
49 darwin,46 } @ inputs: let
50 ...47 lib = nixpkgs.lib;
51 }@inputs:48 # TODO: apply these overlays sooner and remove uses of legacyPackages elsewhere.
52 let49 overlays = [
53 lib = nixpkgs.lib;50 inputs.zig.overlays.default
54 # TODO: apply these overlays sooner and remove uses of legacyPackages elsewhere.51 inputs.rust-overlay.overlays.default
55 overlays = [52 inputs.nh.overlays.default
56 inputs.zig.overlays.default53
57 inputs.rust-overlay.overlays.default54 # https://github.com/LnL7/nix-darwin/issues/1041
58 inputs.nh.overlays.default55 (_: prev: {
5956 karabiner-elements = prev.karabiner-elements.overrideAttrs (old: {
60 # https://github.com/LnL7/nix-darwin/issues/104157 version = "14.13.0";
61 (_: prev: {58
62 karabiner-elements = prev.karabiner-elements.overrideAttrs (old: {59 src = prev.fetchurl {
63 version = "14.13.0";60 inherit (old.src) url;
6461 hash = "sha256-gmJwoht/Tfm5qMecmq1N6PSAIfWOqsvuHU8VDJY8bLw=";
65 src = prev.fetchurl {62 };
66 inherit (old.src) url;63 });
67 hash = "sha256-gmJwoht/Tfm5qMecmq1N6PSAIfWOqsvuHU8VDJY8bLw=";64 })
68 };65 ];
69 });66
67 # Users of this flake currently use x86_64 Linux and Apple Silicon
68 systems = [
69 "x86_64-linux"
70 "aarch64-darwin"
71 ];
72 forAllSystems = f:
73 builtins.listToAttrs (
74 builtins.map (system: {
75 name = system;
76 value = f (
77 inputs
78 // {
79 inherit system;
80 pkgs = nixpkgs.legacyPackages.${system};
81 }
82 );
70 })83 })
71 ];84 systems
85 );
7286
73 # Users of this flake currently use x86_64 Linux and Apple Silicon87 mkSystem = import ./lib/mkSystem.nix {
74 systems = [88 inherit
75 "x86_64-linux"89 overlays
76 "aarch64-darwin"90 nixpkgs
77 ];91 lix-module
78 forAllSystems =92 inputs
79 f:93 mkNeovim
80 builtins.listToAttrs (94 ;
81 builtins.map (system: {95 };
82 name = system;96 mkNeovim = import ./lib/mkNeovim.nix {
83 value = f (97 inherit
84 inputs98 self
85 // {99 overlays
86 inherit system;100 nixpkgs
87 pkgs = nixpkgs.legacyPackages.${system};101 inputs
88 }102 ;
89 );103 };
90 }) systems104 in rec {
91 );105 inherit self;
92106 # "nix fmt"
93 mkSystem = import ./lib/mkSystem.nix {107 formatter = forAllSystems (inputs: inputs.pkgs.nixfmt-tree);
94 inherit108 packages = forAllSystems (
95 overlays109 {system, ...}:
96 nixpkgs
97 lix-module
98 inputs
99 mkNeovim
100 ;
101 };
102 mkNeovim = import ./lib/mkNeovim.nix {
103 inherit
104 self
105 overlays
106 nixpkgs
107 inputs
108 ;
109 };
110 in
111 rec {
112 inherit self;
113 # "nix fmt"
114 formatter = forAllSystems (inputs: inputs.pkgs.nixfmt-tree);
115 packages = forAllSystems (
116 { system, ... }:
117 {110 {
118 nvim-chloe = mkNeovim "chloe" system;111 nvim-chloe = mkNeovim "chloe" system;
119 nvim-natalie = mkNeovim "natalie" system;112 nvim-natalie = mkNeovim "natalie" system;
...@@ -122,49 +115,46 @@...@@ -122,49 +115,46 @@
122 # "nix run .#darwin-rebuild"115 # "nix run .#darwin-rebuild"
123 darwin-rebuild = darwin.packages.aarch64-darwin.darwin-rebuild;116 darwin-rebuild = darwin.packages.aarch64-darwin.darwin-rebuild;
124 }117 }
125 );118 );
119
120 # natalie's desktop computer
121 nixosConfigurations.nixos = mkSystem "nixos" {
122 user = "natalie";
123 host = "desktop";
124 system = "x86_64-linux";
125 extraModules = [
126 ];
127 };
128 # natalie's laptop
129 darwinConfigurations."Natalies-MacBook-Air" = mkSystem "Natalies-MacBook-Air" {
130 user = "natalie";
131 host = "laptop";
132 system = "aarch64-darwin";
133 };
126134
127 # natalie's desktop computer135 # chloe's mac studio "sandwich"
128 nixosConfigurations.nixos = mkSystem "nixos" {136 darwinConfigurations.sandwich = mkSystem "sandwich" {
129 user = "natalie";137 user = "chloe";
130 host = "desktop";138 host = "sandwich";
131 system = "x86_64-linux";139 system = "aarch64-darwin";
132 extraModules = [140 };
133 nixos-cosmic.nixosModules.default141 # chloe's macbook air "paperback"
134 ];142 darwinConfigurations.paperback = mkSystem "paperback" {
135 };143 user = "chloe";
136 # natalie's laptop144 host = "paperback";
137 darwinConfigurations."Natalies-MacBook-Air" = mkSystem "Natalies-MacBook-Air" {145 system = "aarch64-darwin";
138 user = "natalie";
139 host = "laptop";
140 system = "aarch64-darwin";
141 };
142
143 # chloe's mac studio "sandwich"
144 darwinConfigurations.sandwich = mkSystem "sandwich" {
145 user = "chloe";
146 host = "sandwich";
147 system = "aarch64-darwin";
148 };
149 # chloe's macbook air "paperback"
150 darwinConfigurations.paperback = mkSystem "paperback" {
151 user = "chloe";
152 host = "paperback";
153 system = "aarch64-darwin";
154 };
155
156 # generate checks for "nix flake check --all-systems --no-build"
157 checks.aarch64-darwin = builtins.listToAttrs (
158 builtins.map (
159 name:
160 let
161 d = darwinConfigurations.${name}.system;
162 in
163 {
164 name = "darwinConfiguration-" + d.name;
165 value = d;
166 }
167 ) (builtins.attrNames darwinConfigurations)
168 );
169 };146 };
147
148 # generate checks for "nix flake check --all-systems --no-build"
149 checks.aarch64-darwin = builtins.listToAttrs (
150 builtins.map (
151 name: let
152 d = darwinConfigurations.${name}.system;
153 in {
154 name = "darwinConfiguration-" + d.name;
155 value = d;
156 }
157 ) (builtins.attrNames darwinConfigurations)
158 );
159 };
170}160}
modules/home/default.nix+8-8
...@@ -8,14 +8,14 @@...@@ -8,14 +8,14 @@
8 host,8 host,
9 mainHomeImports,9 mainHomeImports,
10 ...10 ...
11}:11}: let
12let
13 cfg = config.programs;12 cfg = config.programs;
14in13in {
15{14 imports =
16 imports = mainHomeImports ++ [15 mainHomeImports
17 ./macos/sketchybar.nix16 ++ [
18 ];17 ./macos/sketchybar.nix
18 ];
19 programs = {19 programs = {
20 home-manager.enable = true;20 home-manager.enable = true;
21 nix-index.enable = true;21 nix-index.enable = true;
...@@ -80,7 +80,7 @@ in...@@ -80,7 +80,7 @@ in
80 }80 }
81 ];81 ];
82 shellAliases =82 shellAliases =
83 { }83 {}
84 // lib.optionalAttrs (!host.darwin) {84 // lib.optionalAttrs (!host.darwin) {
85 reboot-windows = "sudo efibootmgr --bootnext 0000; sudo reboot -h now";85 reboot-windows = "sudo efibootmgr --bootnext 0000; sudo reboot -h now";
86 };86 };
modules/home/macos/sketchybar.nix+503-499
...@@ -2,534 +2,538 @@...@@ -2,534 +2,538 @@
2 pkgs,2 pkgs,
3 lib,3 lib,
4 config,4 config,
5 host,
5 ...6 ...
6}: {7}: {
7 home.file =8 home.file =
8 lib.attrsets.mapAttrs (file: value: (9 {}
9 lib.attrsets.overrideExisting value {enable = config.shared.darwin.tiling.enable;}10 // lib.optionalAttrs host.darwin (
10 )) {11 lib.attrsets.mapAttrs (file: value: (
11 sketchybarrc = {12 lib.attrsets.overrideExisting value {enable = config.shared.darwin.tiling.enable;}
12 executable = true;13 )) {
13 target = ".config/sketchybar/sketchybarrc";14 sketchybarrc = {
14 text = ''15 executable = true;
15 #!/usr/bin/env sh16 target = ".config/sketchybar/sketchybarrc";
1617 text = ''
17 source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors18 #!/usr/bin/env sh
1819
19 ITEM_DIR="$HOME/.config/sketchybar/items" # Directory where the items are configured20 source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors
20 PLUGIN_DIR="$HOME/.config/sketchybar/plugins" # Directory where all the plugin scripts are stored21
2122 ITEM_DIR="$HOME/.config/sketchybar/items" # Directory where the items are configured
22 FONT="SF Pro" # Needs to have Regular, Bold, Semibold, Heavy and Black variants23 PLUGIN_DIR="$HOME/.config/sketchybar/plugins" # Directory where all the plugin scripts are stored
23 PADDINGS=3 # All paddings use this value (icon, label, background)24
2425 FONT="SF Pro" # Needs to have Regular, Bold, Semibold, Heavy and Black variants
2526 PADDINGS=3 # All paddings use this value (icon, label, background)
26 # Setting up the general bar appearance and default values27
27 ${pkgs.sketchybar}/bin/sketchybar --bar height=40 \28
28 blur_radius=30 \29 # Setting up the general bar appearance and default values
29 position=top \30 ${pkgs.sketchybar}/bin/sketchybar --bar height=40 \
30 sticky=on \31 blur_radius=30 \
31 padding_left=10 \32 position=top \
32 padding_right=1033 sticky=on \
3334 padding_left=10 \
3435 padding_right=10
35 ${pkgs.sketchybar}/bin/sketchybar --default icon.font="SF Pro:Semibold:12.0" \36
36 icon.color=$ITEM_COLOR \37
37 label.font="SF Pro:Semibold:12.0" \38 ${pkgs.sketchybar}/bin/sketchybar --default icon.font="SF Pro:Semibold:12.0" \
38 label.color=$ITEM_COLOR \39 icon.color=$ITEM_COLOR \
39 background.color=$ACCENT_COLOR \40 label.font="SF Pro:Semibold:12.0" \
40 background.corner_radius=10 \41 label.color=$ITEM_COLOR \
41 background.height=20 \42 background.color=$ACCENT_COLOR \
42 padding_left=4 \43 background.corner_radius=10 \
43 padding_right=4 \44 background.height=20 \
44 icon.padding_left=6 \45 padding_left=4 \
45 icon.padding_right=3 \46 padding_right=4 \
46 label.padding_left=3 \47 icon.padding_left=6 \
47 label.padding_right=648 icon.padding_right=3 \
4849 label.padding_left=3 \
4950 label.padding_right=6
50 # Left51
51 # source "$ITEM_DIR/apple.sh"52
52 source "$ITEM_DIR/spaces.sh"53 # Left
53 source "$ITEM_DIR/front_app.sh"54 # source "$ITEM_DIR/apple.sh"
5455 source "$ITEM_DIR/spaces.sh"
55 # Center56 source "$ITEM_DIR/front_app.sh"
56 # source "$ITEM_DIR/spotify.sh"57
57 source "$ITEM_DIR/calendar.sh"58 # Center
5859 # source "$ITEM_DIR/spotify.sh"
59 # Right60 source "$ITEM_DIR/calendar.sh"
60 source $ITEM_DIR/calendar.sh61
61 source $ITEM_DIR/wifi.sh62 # Right
62 source $ITEM_DIR/battery.sh63 source $ITEM_DIR/calendar.sh
63 source $ITEM_DIR/volume.sh64 source $ITEM_DIR/wifi.sh
6465 source $ITEM_DIR/battery.sh
65 # Forcing all item scripts to run (never do this outside of sketchybarrc)66 source $ITEM_DIR/volume.sh
66 ${pkgs.sketchybar}/bin/sketchybar --update67
6768 # Forcing all item scripts to run (never do this outside of sketchybarrc)
68 echo "sketchybar configuation loaded.."69 ${pkgs.sketchybar}/bin/sketchybar --update
69 '';70
70 };71 echo "sketchybar configuation loaded.."
71 icons = {72 '';
72 executable = true;73 };
73 target = ".config/sketchybar/plugins/icons.sh";74 icons = {
74 text = ''75 executable = true;
75 #!/usr/bin/env sh76 target = ".config/sketchybar/plugins/icons.sh";
7677 text = ''
77 # Source the icon map with all the application icons78 #!/usr/bin/env sh
78 source ${pkgs.sketchybar-app-font}/bin/icon_map.sh79
7980 # Source the icon map with all the application icons
80 # Create a cache directory if it doesn't exist81 source ${pkgs.sketchybar-app-font}/bin/icon_map.sh
81 CACHE_DIR="$HOME/.cache/sketchybar"82
82 mkdir -p "$CACHE_DIR"83 # Create a cache directory if it doesn't exist
8384 CACHE_DIR="$HOME/.cache/sketchybar"
84 # Cache file for icon mappings85 mkdir -p "$CACHE_DIR"
85 ICON_CACHE="$CACHE_DIR/icon_cache.txt"86
8687 # Cache file for icon mappings
87 # Create the cache file if it doesn't exist88 ICON_CACHE="$CACHE_DIR/icon_cache.txt"
88 if [ ! -f "$ICON_CACHE" ]; then89
89 touch "$ICON_CACHE"90 # Create the cache file if it doesn't exist
90 fi91 if [ ! -f "$ICON_CACHE" ]; then
9192 touch "$ICON_CACHE"
92 # Check if the app is already in cache93 fi
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}')
23794
238 icon_strip=""95 # Check if the app is already in cache
239 if [ "''${apps}" != "" ]; then96 APP_NAME=$(if [ "$1" = "Zen" ]; then echo "Zen Browser"; else echo "$1"; fi)
240 while read -r app; do
241 icon_strip+=" $($PLUGIN_DIR/icons.sh "$app")"
242 done <<<"''${apps}"
243 else
244 icon_strip=" —"
245 fi
24697
247 sketchybar --set space.$sid label="$icon_strip"98 CACHED_ICON=$(grep "^$APP_NAME|" "$ICON_CACHE" | cut -d '|' -f2)
24899
249 done100 if [ -n "$CACHED_ICON" ]; then
101 # Cache hit, return the icon
102 echo "$CACHED_ICON"
103 exit 0
104 fi
250105
251 for empty_space in $(aerospace list-workspaces --monitor $m --empty); do106 # Get icon from the mapping function
252 sketchybar --set space.$empty_space display=0107 __icon_map "$APP_NAME"
253 done108
254 for focus in $(aerospace list-workspaces --focused); do109 if [ -n "$icon_result" ]; then
255 sketchybar --set space.$focus background.drawing=on \110 echo "$APP_NAME|$icon_result" >>"$ICON_CACHE"
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
318 else
319 sketchybar --set space.$sid background.drawing=off \
320 label.color=$ACCENT_COLOR \
321 icon.color=$ACCENT_COLOR
322 fi111 fi
323 }
324112
325 update_icons() {113 echo "$icon_result"
326 m=$1114 '';
327 sid=$2115 };
116 colors = {
117 executable = true;
118 target = ".config/sketchybar/colors.sh";
119 text = ''
120
121 export TRANSPARENT=0x00ffffff
122
123 # -- Gray Scheme --
124 export ITEM_COLOR=0xff000000
125 export ACCENT_COLOR=0xffc3c6cb
126
127 # -- White Scheme --
128 # export ITEM_COLOR=0xff000000
129 # export ACCENT_COLOR=0xffffffff
130
131 # -- Teal Scheme --
132 # export ITEM_COLOR=0xff000000
133 # export ACCENT_COLOR=0xff2cf9ed
134
135 # -- Purple Scheme --
136 # export ITEM_COLOR=0xff000000
137 # export ACCENT_COLOR=0xffeb46f9
138
139 # -- Red Scheme ---
140 # export ITEM_COLOR=0xff000000
141 # export ACCENT_COLOR=0xffff2453
142
143 # -- Blue Scheme ---
144 # export ITEM_COLOR=0xff000000
145 # export ACCENT_COLOR=0xff15bdf9
146
147 # -- Green Scheme --
148 # export ITEM_COLOR=0xff000000
149 # export ACCENT_COLOR=0xff1dfca1
150
151 # -- Orange Scheme --
152 # export ITEM_COLOR=0xffffffff
153 # export ACCENT_COLOR=0xfff97716
154
155 # -- Yellow Scheme --
156 # export ITEM_COLOR=0xff000000
157 # export ACCENT_COLOR=0xfff7fc17
158 '';
159 };
160 items_wifi = {
161 executable = true;
162 target = ".config/sketchybar/items/wifi.sh";
163 text = ''
164 #!/usr/bin/env/ sh
165
166 sketchybar --add item wifi right \
167 --set wifi \
168 icon="􀙥" \
169 label="Updating..." \
170 script="$PLUGIN_DIR/wifi.sh" \
171 --subscribe wifi wifi_change
172 '';
173 };
174 items_battery = {
175 executable = true;
176 target = ".config/sketchybar/items/battery.sh";
177 text = ''
178 #!/usr/bin/env/ sh
179 sketchybar --add item battery right \
180 --set battery update_freq=180 \
181 script="$PLUGIN_DIR/battery.sh" \
182 --subscribe battery system_woke power_source_change
183 '';
184 };
185 items_calendar = {
186 executable = true;
187 target = ".config/sketchybar/items/calendar.sh";
188 text = ''
189 #!/usr/bin/env sh
190 sketchybar --add item calendar right \
191 --set calendar icon=􀧞 \
192 update_freq=15 \
193 script="$PLUGIN_DIR/calendar.sh"
194 '';
195 };
196 items_front_app = {
197 executable = true;
198 target = ".config/sketchybar/items/front_app.sh";
199 text = ''
200 #!/usr/bin/env sh
201
202 sketchybar --add item front_app left \
203 --set front_app background.color=$ACCENT_COLOR \
204 icon.color=$ITEM_COLOR \
205 label.color=$ITEM_COLOR \
206 icon.font="sketchybar-app-font:Regular:12.0" \
207 label.font="SF Pro:Semibold:12.0" \
208 script="$PLUGIN_DIR/front_app.sh" \
209 --subscribe front_app front_app_switched
210 '';
211 };
212 items_spaces = {
213 executable = true;
214 target = ".config/sketchybar/items/spaces.sh";
215 text = ''
216 sketchybar --add event aerospace_workspace_change
217
218 sketchybar --add item aerospace_dummy left \
219 --set aerospace_dummy display=0 \
220 script="$PLUGIN_DIR/spaces.sh" \
221 --subscribe aerospace_dummy aerospace_workspace_change
328222
329 apps=$(aerospace list-windows --monitor "$m" --workspace "$sid" \223 for m in $(aerospace list-monitors | awk '{print $1}'); do
330 | awk -F '|' '{gsub(/^ *| *$/, "", $2); if (!seen[$2]++) print $2}' \224 for sid in $(aerospace list-workspaces --monitor $m); do
331 | sort)225 sketchybar --add space space.$sid left \
226 --set space.$sid space=$sid \
227 icon=$sid \
228 background.color=$TRANSPARENT \
229 label.color=$ACCENT_COLOR \
230 icon.color=$ACCENT_COLOR \
231 display=$m \
232 label.font="sketchybar-app-font:Regular:12.0" \
233 icon.font="SF Pro:Semibold:12.0" \
234 label.padding_right=10 \
235 label.y_offset=-1 \
236 click_script="$PLUGIN_DIR/space_click.sh $sid"
237
238 apps=$(aerospace list-windows --monitor "$m" --workspace "$sid" |
239 awk -F '|' '{gsub(/^ *| *$/, "", $2); if (!seen[$2]++) print $2}')
332240
333 icon_strip=""241 icon_strip=""
334 if [ "''${apps}" != "" ]; then242 if [ "''${apps}" != "" ]; then
335 while read -r app; do243 while read -r app; do
336 icon_strip+=" $($CONFIG_DIR/plugins/icons.sh "$app")"244 icon_strip+=" $($PLUGIN_DIR/icons.sh "$app")"
337 done <<<"''${apps}"245 done <<<"''${apps}"
338 else246 else
339 icon_strip=" —"247 icon_strip=" —"
340 fi248 fi
341249
342 sketchybar --animate sin 10 --set space.$sid label="$icon_strip"250 sketchybar --set space.$sid label="$icon_strip"
343 }
344251
345 update_workspace_appearance "$PREV_WORKSPACE" "false"252 done
346 update_workspace_appearance "$FOCUSED_WORKSPACE" "true"
347253
348 for m in $(aerospace list-monitors | awk '{print $1}'); do254 for empty_space in $(aerospace list-workspaces --monitor $m --empty); do
349 for sid in $(aerospace list-workspaces --monitor $m --visible); do255 sketchybar --set space.$empty_space display=0
350 sketchybar --set space.$sid display=$m256 done
257 for focus in $(aerospace list-workspaces --focused); do
258 sketchybar --set space.$focus background.drawing=on \
259 background.color=$ACCENT_COLOR \
260 label.color=$ITEM_COLOR \
261 icon.color=$ITEM_COLOR
262 done
263 done
264 '';
265 };
266
267 items_volume = {
268 executable = true;
269 target = ".config/sketchybar/items/volume.sh";
270 text = ''
271 #/usr/bin/env sh
272
273 sketchybar --add item volume right \
274 --set volume script="$PLUGIN_DIR/volume.sh" \
275 --subscribe volume volume_change
276 '';
277 };
278 plugins_wifi = {
279 executable = true;
280 target = ".config/sketchybar/plugins/wifi.sh";
281 text = ''
282 #/usr/bin/env sh
283
284 SSID=$(system_profiler SPAirPortDataType | awk '/Current Network Information:/ { getline; print substr($0, 13, (length($0) - 13)); exit }')
285
286 if [ "$SSID" = "" ]; then
287 sketchybar --set $NAME icon="􀙈" label="Disconnected"
288 else
289 sketchybar --set $NAME icon="􀙇" label="$SSID"
290 fi
291
292 '';
293 };
294 plugins_calendar = {
295 executable = true;
296 target = ".config/sketchybar/plugins/calendar.sh";
297
298 text = ''
299 #/usr/bin/env sh
300
301 sketchybar --set $NAME label="$(date +'%a %d %b %I:%M %p')"
302 '';
303 };
304 plugins_spaces = {
305 executable = true;
306 target = ".config/sketchybar/plugins/spaces.sh";
307 text = ''
308 #!/usr/bin/env sh
309
310 source "$CONFIG_DIR/colors.sh"
311
312 update_workspace_appearance() {
313 local sid=$1
314 local is_focused=$2
315
316 if [ "$is_focused" = "true" ]; then
317 sketchybar --set space.$sid background.drawing=on \
318 background.color=$ACCENT_COLOR \
319 label.color=$ITEM_COLOR \
320 icon.color=$ITEM_COLOR
321 else
322 sketchybar --set space.$sid background.drawing=off \
323 label.color=$ACCENT_COLOR \
324 icon.color=$ACCENT_COLOR
325 fi
326 }
351327
352 update_icons "$m" "$sid"328 update_icons() {
329 m=$1
330 sid=$2
353331
354 update_icons "$m" "$PREV_WORKSPACE"332 apps=$(aerospace list-windows --monitor "$m" --workspace "$sid" \
333 | awk -F '|' '{gsub(/^ *| *$/, "", $2); if (!seen[$2]++) print $2}' \
334 | sort)
355335
356 apps=$(aerospace list-windows --monitor "$m" --workspace "$sid" | wc -l)336 icon_strip=""
357 if [ "''${apps}" -eq 0 ]; then337 if [ "''${apps}" != "" ]; then
358 sketchybar --set space.$sid display=0338 while read -r app; do
339 icon_strip+=" $($CONFIG_DIR/plugins/icons.sh "$app")"
340 done <<<"''${apps}"
341 else
342 icon_strip=" —"
359 fi343 fi
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="􀊣" ;;
405 esac
406344
407 sketchybar --set $NAME icon="$ICON" label="$VOLUME%"345 sketchybar --animate sin 10 --set space.$sid label="$icon_strip"
408 fi346 }
409 '';347
410 };348 update_workspace_appearance "$PREV_WORKSPACE" "false"
411 plugins_front_app = {349 update_workspace_appearance "$FOCUSED_WORKSPACE" "true"
412 executable = true;350
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}'); do351 for m in $(aerospace list-monitors | awk '{print $1}'); do
422 for sid in $(aerospace list-workspaces --monitor $m --visible); do352 for sid in $(aerospace list-workspaces --monitor $m --visible); do
353 sketchybar --set space.$sid display=$m
423354
424 apps=$( (echo "$INFO"; aerospace list-windows --monitor "$m" --workspace "$sid" \355 update_icons "$m" "$sid"
425 | awk -F '|' '{gsub(/^ *| *$/, "", $2); print $2}') \
426 | awk '!seen[$0]++' | sort)
427356
428 icon_strip=""357 update_icons "$m" "$PREV_WORKSPACE"
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
436358
437 sketchybar --animate sin 10 --set space.$sid label="$icon_strip"359 apps=$(aerospace list-windows --monitor "$m" --workspace "$sid" | wc -l)
360 if [ "''${apps}" -eq 0 ]; then
361 sketchybar --set space.$sid display=0
362 fi
438 done363 done
439 done364 done
440 }365 '';
441366 };
442 if [ "$SENDER" = "front_app_switched" ]; then367
443368 plugins_space_click = {
444 sketchybar --set $NAME label="$INFO" icon="$($CONFIG_DIR/plugins/icons.sh "$INFO")"369 executable = true;
445370 target = ".config/sketchybar/plugins/space_click.sh";
446 app_switched371 text = ''
447 fi372 #/usr/bin/env/ sh
448 '';373
449 };374 apps=$(aerospace list-windows --workspace $1 | awk -F '|' '{gsub(/^ *| *$/, "", $2); print $2}')
450 plugins_battery = {375 focused=$(aerospace list-workspaces --focused)
451 executable = true;376
452 target = ".config/sketchybar/plugins/battery.sh";377 if [ "''${apps}" = "" ] && [ "''${focused}" != "$1" ]; then
453 text = ''378 sketchybar --set space.$1 display=0
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 else379 else
509 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=off label.width=dynamic380 aerospace workspace $1
510 fi381 fi
511 }382 '';
512383 };
513 illuminate_mode() {384 plugins_volume = {
514 if [[ "$mode" = "service" ]]385 executable = true;
515 then386 target = ".config/sketchybar/plugins/volume.sh";
516 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$ORANGE387 text = ''
517 elif [[ "$mode" = "resize" ]]388 #!/usr/bin/env sh
518 then389
519 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$GREEN390 # The volume_change event supplies a $INFO variable in which the current volume
520 else391 # percentage is passed to the script.
521 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$BACKGROUND_1392
393 if [ "$SENDER" = "volume_change" ]; then
394
395 VOLUME=$INFO
396
397 case $VOLUME in
398 [6-9][0-9] | 100)
399 ICON="􀊩"
400 ;;
401 [3-5][0-9])
402 ICON="􀊥"
403 ;;
404 [1-9] | [1-2][0-9])
405 ICON="􀊡"
406 ;;
407 *) ICON="􀊣" ;;
408 esac
409
410 sketchybar --set $NAME icon="$ICON" label="$VOLUME%"
522 fi411 fi
523 }412 '';
524 case "$SENDER" in413 };
525 "aerospace_workspace_change")414 plugins_front_app = {
526 highlight_focused_workspace $1415 executable = true;
416 target = ".config/sketchybar/plugins/front_app.sh";
417 text = ''
418 # Some events send additional information specific to the event in the $INFO
419 # variable. E.g. the front_app_switched event sends the name of the newly
420 # focused application in the $INFO variable:
421 # https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
422
423 app_switched() {
424 for m in $(aerospace list-monitors | awk '{print $1}'); do
425 for sid in $(aerospace list-workspaces --monitor $m --visible); do
426
427 apps=$( (echo "$INFO"; aerospace list-windows --monitor "$m" --workspace "$sid" \
428 | awk -F '|' '{gsub(/^ *| *$/, "", $2); print $2}') \
429 | awk '!seen[$0]++' | sort)
430
431 icon_strip=""
432 if [ "''${apps}" != "" ]; then
433 while read -r app; do
434 icon_strip+=" $($CONFIG_DIR/plugins/icons.sh "$app")"
435 done <<<"''${apps}"
436 else
437 icon_strip=" —"
438 fi
439
440 sketchybar --animate sin 10 --set space.$sid label="$icon_strip"
441 done
442 done
443 }
444
445 if [ "$SENDER" = "front_app_switched" ]; then
446
447 sketchybar --set $NAME label="$INFO" icon="$($CONFIG_DIR/plugins/icons.sh "$INFO")"
448
449 app_switched
450 fi
451 '';
452 };
453 plugins_battery = {
454 executable = true;
455 target = ".config/sketchybar/plugins/battery.sh";
456 text = ''
457 #!/usr/bin/env sh
458 source "$CONFIG_DIR/colors.sh"
459
460 PERCENTAGE=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)
461 CHARGING=$(pmset -g batt | grep 'AC Power')
462
463 if [ $PERCENTAGE = "" ]; then
464 exit 0
465 fi
466
467 case ''${PERCENTAGE} in
468 9[0-9] | 100)
469 ICON="􀛨"
470 COLOR=$ITEM_COLOR
471 ;;
472 [6-8][0-9])
473 ICON="􀺸"
474 COLOR=$ITEM_COLOR
475 ;;
476 [3-5][0-9])
477 ICON="􀺶"
478 COLOR="0xFFd97706"
479 ;;
480 [1-2][0-9])
481 ICON="􀛩"
482 COLOR="0xFFf97316"
527 ;;483 ;;
528 "aerospace_mode_change")484 *)
529 illuminate_mode485 ICON="􀛪"
486 COLOR="0xFFef4444"
530 ;;487 ;;
531 esac488 esac
532 '';489
533 };490 if [[ $CHARGING != "" ]]; then
534 };491 ICON="􀢋"
492 COLOR=$ITEM_COLOR
493 fi
494
495 # The item invoking this script (name $NAME) will get its icon and label
496 # updated with the current battery status
497 sketchybar --set $NAME icon="$ICON" label="''${PERCENTAGE}%" icon.color="$COLOR"
498 '';
499 };
500 plugins_aerospace = {
501 executable = true;
502 target = ".config/sketchybar/plugins/aerospace.sh";
503 text = ''
504 #!/usr/bin/env bash
505 source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors
506
507 highlight_focused_workspace() {
508 if [[ "$1" = "$FOCUSED_WORKSPACE" ]]
509 then
510 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=on label.width=0
511 else
512 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=off label.width=dynamic
513 fi
514 }
515
516 illuminate_mode() {
517 if [[ "$mode" = "service" ]]
518 then
519 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$ORANGE
520 elif [[ "$mode" = "resize" ]]
521 then
522 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$GREEN
523 else
524 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$BACKGROUND_1
525 fi
526 }
527 case "$SENDER" in
528 "aerospace_workspace_change")
529 highlight_focused_workspace $1
530 ;;
531 "aerospace_mode_change")
532 illuminate_mode
533 ;;
534 esac
535 '';
536 };
537 }
538 );
535}539}
modules/nixos/services.nix+4-4
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1{ pkgs, ... }:1{pkgs, ...}: {
2{
3 services = {2 services = {
4 avahi = {3 avahi = {
5 enable = true;4 enable = true;
...@@ -24,6 +23,7 @@...@@ -24,6 +23,7 @@
2423
25 desktopManager.cosmic.enable = true;24 desktopManager.cosmic.enable = true;
26 displayManager.cosmic-greeter.enable = true;25 displayManager.cosmic-greeter.enable = true;
26 desktopManager.cosmic.xwayland.enable = true;
2727
28 # Auto mount devices28 # Auto mount devices
29 udisks2 = {29 udisks2 = {
...@@ -40,7 +40,7 @@...@@ -40,7 +40,7 @@
40 # Enable CUPS to print documents.40 # Enable CUPS to print documents.
41 printing = {41 printing = {
42 enable = true;42 enable = true;
43 drivers = [ pkgs.brlaser ]; # Brother printer driver43 drivers = [pkgs.brlaser]; # Brother printer driver
44 };44 };
4545
46 pipewire = {46 pipewire = {
...@@ -55,7 +55,7 @@...@@ -55,7 +55,7 @@
5555
56 openssh = {56 openssh = {
57 enable = true;57 enable = true;
58 ports = [ 22 ];58 ports = [22];
59 settings = {59 settings = {
60 PasswordAuthentication = true;60 PasswordAuthentication = true;
61 UseDns = true;61 UseDns = true;
modules/shared/nix.nix-2
...@@ -24,13 +24,11 @@...@@ -24,13 +24,11 @@
24 "https://cache.nixos.org/?priority=10"24 "https://cache.nixos.org/?priority=10"
2525
26 "https://nix-community.cachix.org"26 "https://nix-community.cachix.org"
27 "https://cosmic.cachix.org/"
28 # For haskell27 # For haskell
29 "https://cache.iog.io"28 "https://cache.iog.io"
30 ];29 ];
31 trusted-public-keys = [30 trusted-public-keys = [
32 "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="31 "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
33 "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="
34 # For haskell32 # For haskell
35 "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="33 "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
36 ];34 ];
users/natalie/desktop/configuration.nix+11-11
...@@ -3,8 +3,7 @@...@@ -3,8 +3,7 @@
3 user,3 user,
4 host,4 host,
5 ...5 ...
6}:6}: {
7{
8 imports = [7 imports = [
9 # Include the results of the hardware scan.8 # Include the results of the hardware scan.
10 ./hardware-configuration.nix9 ./hardware-configuration.nix
...@@ -18,7 +17,7 @@...@@ -18,7 +17,7 @@
18 enable = true;17 enable = true;
19 # Certain features, including CLI integration and system authentication support,18 # Certain features, including CLI integration and system authentication support,
20 # require enabling PolKit integration on some desktop environments (e.g. Plasma).19 # require enabling PolKit integration on some desktop environments (e.g. Plasma).
21 polkitPolicyOwners = [ user.username ];20 polkitPolicyOwners = [user.username];
22 };21 };
2322
24 noisetorch.enable = true;23 noisetorch.enable = true;
...@@ -35,7 +34,7 @@...@@ -35,7 +34,7 @@
3534
36 steam = {35 steam = {
37 enable = true;36 enable = true;
38 package = with pkgs; steam.override { extraPkgs = pkgs: [ attr ]; };37 package = with pkgs; steam.override {extraPkgs = pkgs: [attr];};
39 };38 };
4039
41 git = {40 git = {
...@@ -59,7 +58,7 @@...@@ -59,7 +58,7 @@
5958
60 xdg.portal = {59 xdg.portal = {
61 enable = true;60 enable = true;
62 extraPortals = with pkgs; [ xdg-desktop-portal-gtk ];61 extraPortals = with pkgs; [xdg-desktop-portal-gtk];
63 };62 };
64 virtualisation = {63 virtualisation = {
65 containers.enable = true;64 containers.enable = true;
...@@ -84,16 +83,14 @@...@@ -84,16 +83,14 @@
84 hybrid-sleep.enable = false;83 hybrid-sleep.enable = false;
85 };84 };
8685
87 packages = [ pkgs.observatory ];86 services.monitord.wantedBy = ["multi-user.target"];
88
89 services.monitord.wantedBy = [ "multi-user.target" ];
90 };87 };
9188
92 i18n = {89 i18n = {
93 # Select internationalisation properties.90 # Select internationalisation properties.
94 defaultLocale = "en_US.UTF-8";91 defaultLocale = "en_US.UTF-8";
9592
96 supportedLocales = [ "all" ];93 supportedLocales = ["all"];
9794
98 extraLocaleSettings = {95 extraLocaleSettings = {
99 LC_ADDRESS = "en_US.UTF-8";96 LC_ADDRESS = "en_US.UTF-8";
...@@ -148,7 +145,10 @@...@@ -148,7 +145,10 @@
148 ];145 ];
149 };146 };
150 environment = {147 environment = {
151 sessionVariables.COSMIC_DATA_CONTROL_ENABLED = 1;148 sessionVariables = {
149 COSMIC_DATA_CONTROL_ENABLED = 1;
150 NIXOS_OZONE_WL = "1";
151 };
152 variables.EDITOR = "nvim";152 variables.EDITOR = "nvim";
153153
154 systemPackages = with pkgs; [154 systemPackages = with pkgs; [
...@@ -170,7 +170,7 @@...@@ -170,7 +170,7 @@
170 };170 };
171 interfaces.enp11s0.wakeOnLan = {171 interfaces.enp11s0.wakeOnLan = {
172 enable = true;172 enable = true;
173 policy = [ "magic" ];173 policy = ["magic"];
174 };174 };
175 };175 };
176176