From 10716da6780ad08888f1cc1ece38db9bff47fb87 Mon Sep 17 00:00:00 2001 From: cnst Date: Fri, 27 Dec 2024 16:46:50 +0100 Subject: [PATCH] waybar changes 1 --- flake.lock | 207 +++++++++-------- modules/home/programs/hyprland/appearance.nix | 9 +- modules/home/programs/hyprland/inputs.nix | 60 +++-- modules/home/programs/hyprland/keybinds.nix | 29 +-- modules/home/programs/hyprland/rules.nix | 15 +- modules/home/programs/hyprpanel/default.nix | 81 +++++++ modules/home/programs/ironbar/default.nix | 164 ++++++++++++++ modules/home/programs/misc/default.nix | 2 + modules/home/programs/nwg-bar/default.nix | 8 +- .../home/programs/waybar/bin/waybar-decrypted | 21 ++ modules/home/programs/waybar/bin/waybar-mail | 18 ++ .../home/programs/waybar/bin/waybar-progress | 7 + .../home/programs/waybar/bin/waybar-recording | 7 + .../home/programs/waybar/bin/waybar-yubikey | 37 +++ modules/home/programs/waybar/default.nix | 212 +++++++++++++++++- modules/home/programs/waybar/style.css | 167 ++++++++++++++ modules/nixos/programs/pkgs/default.nix | 3 + scripts/bin/mako-toggle.sh | 10 +- scripts/bin/mako.sh | 18 +- scripts/bin/waybar-progress.sh | 10 + scripts/bin/waybar-systemd.sh | 52 +++++ scripts/default.nix | 29 +++ 22 files changed, 1007 insertions(+), 159 deletions(-) create mode 100644 modules/home/programs/hyprpanel/default.nix create mode 100644 modules/home/programs/ironbar/default.nix create mode 100644 modules/home/programs/waybar/bin/waybar-decrypted create mode 100644 modules/home/programs/waybar/bin/waybar-mail create mode 100644 modules/home/programs/waybar/bin/waybar-progress create mode 100644 modules/home/programs/waybar/bin/waybar-recording create mode 100644 modules/home/programs/waybar/bin/waybar-yubikey create mode 100644 modules/home/programs/waybar/style.css create mode 100755 scripts/bin/waybar-progress.sh create mode 100755 scripts/bin/waybar-systemd.sh diff --git a/flake.lock b/flake.lock index 9fcf95b0..73f2cb04 100644 --- a/flake.lock +++ b/flake.lock @@ -28,11 +28,11 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1731092955, - "narHash": "sha256-L1hLXf4IDZ0KoXbFiSNNZJ7IrReEr/J+CLt6Rl4Ea3M=", + "lastModified": 1735301051, + "narHash": "sha256-jU88Q9tP4vuvWYGQcmOdFwI9e2uMPVYJHbXdiklIH9o=", "owner": "anyrun-org", "repo": "anyrun", - "rev": "d2017f224b2bfd7e33573c7070e7c3e2960c7dcc", + "rev": "06017e753c8886d5296768dca80745ee09402a2d", "type": "github" }, "original": { @@ -61,11 +61,11 @@ ] }, "locked": { - "lastModified": 1734400729, - "narHash": "sha256-Bf+oya0BuleVXYGIWsb0eWnrK6s0aiesOsI7Mpj1pMU=", + "lastModified": 1734906446, + "narHash": "sha256-6OWluVE2A8xi+8V3jN9KA72RCgJjYdyyuLBUjxZ2q2U=", "owner": "hyprwm", "repo": "aquamarine", - "rev": "a132fa41be7ebe797ad758e84d9df068151a723b", + "rev": "eecb74dc79bb6752a2a507e6edee3042390a6091", "type": "github" }, "original": { @@ -79,14 +79,15 @@ "flake-schemas": "flake-schemas", "home-manager": "home-manager_2", "jovian": "jovian", - "nixpkgs": "nixpkgs_3" + "nixpkgs": "nixpkgs_3", + "nixpkgs-small": "nixpkgs-small" }, "locked": { - "lastModified": 1734631939, - "narHash": "sha256-ZrvI+3uXL6Y9v1+xyNVPpMav0SYPi2ZwcmkaTyarN0E=", + "lastModified": 1734987419, + "narHash": "sha256-2K4V615Y29QhMUShX9k52l7gXF2erkq9yH9qGRZGKQ0=", "owner": "chaotic-cx", "repo": "nyx", - "rev": "5694778dcfd69cc5dab9bd83c9eeb147ed3537e4", + "rev": "d61084b851dbf3072f8b40c3870b0f7938ca3f22", "type": "github" }, "original": { @@ -156,11 +157,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1734849150, - "narHash": "sha256-mgCcRp22vKy+ZoMKn7DG4UBK0iiZTy2reyFA/YCxVLI=", + "lastModified": 1735281280, + "narHash": "sha256-FgW6NkzbGlmNeY0lywjvXgrZD+UPS/+848kI30Yaup0=", "owner": "nix-community", "repo": "fenix", - "rev": "6c2c568c407a0489295194900be09e75c6603a25", + "rev": "3915fd69e1a2827209f3a1080cb8bcca48d11fa7", "type": "github" }, "original": { @@ -398,11 +399,11 @@ }, "hardware": { "locked": { - "lastModified": 1734862644, - "narHash": "sha256-04xesW7HITdF5WUmNM39WD4tkEERk3Ez2W1nNvdIvIw=", + "lastModified": 1734954597, + "narHash": "sha256-QIhd8/0x30gEv8XEE1iAnrdMlKuQ0EzthfDR7Hwl+fk=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "e8516a23524cc9083f5a02a8d64d14770e4c7c09", + "rev": "def1d472c832d77885f174089b0d34854b007198", "type": "github" }, "original": { @@ -419,11 +420,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1734878912, - "narHash": "sha256-M1uvMQUY9yuzlLlDYbP2LjBrolkGiYVKIRRwlxWYyTg=", + "lastModified": 1735311473, + "narHash": "sha256-PIAQe6E07XFYYwv0ARV9oqgV/d30etcMKEEBzyyI1NU=", "owner": "helix-editor", "repo": "helix", - "rev": "ea17b9edb708bc5ea26fec95dda66a6f45753545", + "rev": "a5a7cff311e909ecab41f840742a5309634aeec3", "type": "github" }, "original": { @@ -439,11 +440,11 @@ ] }, "locked": { - "lastModified": 1734893333, - "narHash": "sha256-0Ft7iTkl3UWAix72teY5nflYQD7GE0KvIiT+ox4wkB8=", + "lastModified": 1735053786, + "narHash": "sha256-Gm+0DcbUS338vvkwyYWms5jsWlx8z8MeQBzcnIDuIkw=", "owner": "nix-community", "repo": "home-manager", - "rev": "1f74238a4c8e534a1b6be72cb5153043071ffd17", + "rev": "35b98d20ca8f4ca1f6a2c30b8a2c8bb305a36d84", "type": "github" }, "original": { @@ -481,11 +482,11 @@ ] }, "locked": { - "lastModified": 1734622158, - "narHash": "sha256-h/fdzqlCqSa2ZCIqtDc9kshCJm6kQIoKuO0MSSmAX4A=", + "lastModified": 1734622215, + "narHash": "sha256-OOfI0XhSJGHblfdNDhfnn8QnZxng63rWk9eeJ2tCbiI=", "owner": "nix-community", "repo": "home-manager", - "rev": "832920a60833533eaabcc93ab729801bf586fa0c", + "rev": "1395379a7a36e40f2a76e7b9936cc52950baa1be", "type": "github" }, "original": { @@ -510,11 +511,11 @@ ] }, "locked": { - "lastModified": 1734364709, - "narHash": "sha256-+2bZJL2u5hva7rSp65OfKJBK+k03T6GB/NCvpoS1OOo=", + "lastModified": 1734906540, + "narHash": "sha256-vQ/L9hZFezC0LquLo4TWXkyniWtYBlFHAKIsDc7PYJE=", "owner": "hyprwm", "repo": "hyprcursor", - "rev": "f388aacd22be4a6e4d634fbaf6f75eb0713d239a", + "rev": "69270ba8f057d55b0e6c2dca0e165d652856e613", "type": "github" }, "original": { @@ -539,11 +540,11 @@ ] }, "locked": { - "lastModified": 1733684019, - "narHash": "sha256-2kYREgmSmbLsmDpLEq96hxVAU3qz8aCvVhF65yCFZHY=", + "lastModified": 1734906236, + "narHash": "sha256-vH/ysV2ONGQgYZPtcJKwc8jJivzyVxru2aaOxC20ZOE=", "owner": "hyprwm", "repo": "hyprgraphics", - "rev": "fb2c0268645a77403af3b8a4ce8fa7ba5917f15d", + "rev": "6dea3fba08fd704dd624b6d4b261638fb4003c9c", "type": "github" }, "original": { @@ -597,11 +598,11 @@ ] }, "locked": { - "lastModified": 1733684019, - "narHash": "sha256-2kYREgmSmbLsmDpLEq96hxVAU3qz8aCvVhF65yCFZHY=", + "lastModified": 1734906236, + "narHash": "sha256-vH/ysV2ONGQgYZPtcJKwc8jJivzyVxru2aaOxC20ZOE=", "owner": "hyprwm", "repo": "hyprgraphics", - "rev": "fb2c0268645a77403af3b8a4ce8fa7ba5917f15d", + "rev": "6dea3fba08fd704dd624b6d4b261638fb4003c9c", "type": "github" }, "original": { @@ -659,11 +660,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1734888033, - "narHash": "sha256-eUJF89dCfIoy7pbj+qU43SGy7DBb6s7ogh6Z+NnLJc8=", + "lastModified": 1735312855, + "narHash": "sha256-kZqSIWofTJGIQi54a6qb6L9pLvYlV2ZHIgK8kTLqJBc=", "owner": "hyprwm", "repo": "hyprland", - "rev": "1830296df3515222bf0f03b90822e3b23e74b775", + "rev": "775111b6032185c9ef164d7ba1417a875c1d0287", "type": "github" }, "original": { @@ -734,11 +735,11 @@ ] }, "locked": { - "lastModified": 1733940128, - "narHash": "sha256-hmfXWj2GA9cj1QUkPFYtAAeohhs615zL4E3APy3FnvQ=", + "lastModified": 1734906472, + "narHash": "sha256-pWPRv/GA/X/iAwoE6gMNUqn/ZeJX1IeLPRpZI0tTPK0=", "owner": "hyprwm", "repo": "hyprland-qtutils", - "rev": "3833097e50473a152dd614d4b468886840b4ea78", + "rev": "c77109d7e1ddbcdb87cafd32ce411f76328ae152", "type": "github" }, "original": { @@ -763,11 +764,11 @@ ] }, "locked": { - "lastModified": 1734364628, - "narHash": "sha256-ii8fzJfI953n/EmIxVvq64ZAwhvwuuPHWfGd61/mJG8=", + "lastModified": 1734906259, + "narHash": "sha256-P79t/7HbACO4/PuJBroGpTptvCWJtXTv+gWsF+sM6MI=", "owner": "hyprwm", "repo": "hyprlang", - "rev": "16e59c1eb13d9fb6de066f54e7555eb5e8a4aba5", + "rev": "0404833ea18d543df44df935ebf1b497310eb046", "type": "github" }, "original": { @@ -797,11 +798,11 @@ ] }, "locked": { - "lastModified": 1734880160, - "narHash": "sha256-jHgf9RWtwhz78bQuN8wpojafpywWumEG8g8My1UT91s=", + "lastModified": 1735312862, + "narHash": "sha256-vvLjD1nfhgb665bmUtAsbeP0iZ0a/BXVetuKiVWISdQ=", "owner": "hyprwm", "repo": "hyprlock", - "rev": "5361dc40dacf898bc3666b79f81201b88adcc7ab", + "rev": "d212f4cc1013f12b6691b0ea851b27c088dd8eb8", "type": "github" }, "original": { @@ -832,11 +833,11 @@ ] }, "locked": { - "lastModified": 1734638308, - "narHash": "sha256-WNkBPVZe1XD4WKdh6Yi6aEpcUW7Xsu/d5mKwe7F3yYk=", + "lastModified": 1734906298, + "narHash": "sha256-L0zaWJi2wS/kgdY1WOM8xJuiXDBDh1TMMKLRcmy5ycs=", "owner": "hyprwm", "repo": "hyprpaper", - "rev": "f15e67850743fb787fb29238ab33e81ca6b8daa0", + "rev": "2f305d5f480c12882578e74498301129705a1bb5", "type": "github" }, "original": { @@ -857,11 +858,11 @@ ] }, "locked": { - "lastModified": 1734384247, - "narHash": "sha256-bl3YyJb2CgaeVKYq/l8j27vKdbkTpDNFDsnCl0dnNlY=", + "lastModified": 1734796073, + "narHash": "sha256-TnuKsa8OHrSJEmHm3TLGOWbPNA1gRjmZLsRzKrCqOsg=", "owner": "hyprwm", "repo": "hyprutils", - "rev": "e6cf45cd1845368702e03b8912f4cc44ebba3322", + "rev": "c3331116ebd0b71df5ae8c6efe9a7f94148b03bf", "type": "github" }, "original": { @@ -882,11 +883,11 @@ ] }, "locked": { - "lastModified": 1734384417, - "narHash": "sha256-noYeXcNQ15g1/gIJIYT2zdO66wzY5Z06PYz6BfKUZA8=", + "lastModified": 1734793513, + "narHash": "sha256-rrrHcXapXJvGFqX+L/Bb0182L25jofAZ0fm1FInvrTQ=", "owner": "hyprwm", "repo": "hyprwayland-scanner", - "rev": "90e87f7fcfcce4862826d60332cbc5e2f87e1f88", + "rev": "4d7367b6eee87397e2dbca2e78078dd0a4ef4c61", "type": "github" }, "original": { @@ -907,11 +908,11 @@ ] }, "locked": { - "lastModified": 1726874836, - "narHash": "sha256-VKR0sf0PSNCB0wPHVKSAn41mCNVCnegWmgkrneKDhHM=", + "lastModified": 1734793513, + "narHash": "sha256-rrrHcXapXJvGFqX+L/Bb0182L25jofAZ0fm1FInvrTQ=", "owner": "hyprwm", "repo": "hyprwayland-scanner", - "rev": "500c81a9e1a76760371049a8d99e008ea77aa59e", + "rev": "4d7367b6eee87397e2dbca2e78078dd0a4ef4c61", "type": "github" }, "original": { @@ -929,11 +930,11 @@ ] }, "locked": { - "lastModified": 1734591594, - "narHash": "sha256-7Q4hXE+b9A4DebZ5Q+q3WStuMiWR5bMW0ltpzbY/zMQ=", + "lastModified": 1734725857, + "narHash": "sha256-bivlV9l/UjMtTfz/CZaoNJ5RfH2Lre4P9Ds64conoUQ=", "owner": "Jovian-Experiments", "repo": "Jovian-NixOS", - "rev": "ce2abe494524cdb389a5d31c11c41834d4362ac5", + "rev": "dbae2fd6adaf34c947d310bec08deac7c4ed265b", "type": "github" }, "original": { @@ -952,11 +953,11 @@ "rust-overlay": "rust-overlay_2" }, "locked": { - "lastModified": 1734820165, - "narHash": "sha256-qkPmnVYb6w2KdipyigI9ipNR7A8dsFStBRH5sZ+rmqA=", + "lastModified": 1734994463, + "narHash": "sha256-S9MgfQjNt4J3I7obdLOVY23h+Yl/hnyibwGfOl+1uOE=", "owner": "nix-community", "repo": "lanzaboote", - "rev": "26a59c1b037e43f82b0fada2a218aeb128bc5d21", + "rev": "93e6f0d77548be8757c11ebda5c4235ef4f3bc67", "type": "github" }, "original": { @@ -985,11 +986,11 @@ }, "mnw": { "locked": { - "lastModified": 1731821965, - "narHash": "sha256-QiGi/HBQRnIRGY4gQPuH7T3hr7NznOpEO7qNpF5ldmE=", + "lastModified": 1735150973, + "narHash": "sha256-OJhcCAoaMMXeD6o4qI/hxBCNELJp4dN8D5LJZc8w8XA=", "owner": "Gerg-L", "repo": "mnw", - "rev": "5fe5c41975ed0af55f55dc37cd28ba906a5d015e", + "rev": "40cd0b006cc48dffd0f8698ad7f54cf1d56779a6", "type": "github" }, "original": { @@ -1057,11 +1058,11 @@ "umu": "umu" }, "locked": { - "lastModified": 1734831989, - "narHash": "sha256-YrMVnLkWxV+qmN9ZuUo00yYJFtU1r4L5ho8l3X3ScHA=", + "lastModified": 1735090720, + "narHash": "sha256-Abx/6obaYLgFio8g06pcmMaRPwjKo/bOn1P+gsDMVg0=", "owner": "fufexan", "repo": "nix-gaming", - "rev": "e45e2276facb9218c119e68c45efd2f9e79d292d", + "rev": "95f1cc7ebe63b5a5af6c2d206ffd422739c5959e", "type": "github" }, "original": { @@ -1121,6 +1122,22 @@ "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" } }, + "nixpkgs-small": { + "locked": { + "lastModified": 1734838250, + "narHash": "sha256-Xi8ST/QiyuYXc3ujnMYOBuRUaMh6p16XWH6BKARa7xQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "da8a31d09dd004be34b5c54eda83f9a27b357726", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable-small", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-stable": { "locked": { "lastModified": 1730741070, @@ -1187,11 +1204,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1734424634, - "narHash": "sha256-cHar1vqHOOyC7f1+tVycPoWTfKIaqkoe1Q6TnKzuti4=", + "lastModified": 1734649271, + "narHash": "sha256-4EVBRhOjMDuGtMaofAIqzJbg4Ql7Ai0PSeuVZTHjyKQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d3c42f187194c26d9f0309a8ecc469d6c878ce33", + "rev": "d70bd19e0a38ad4790d3913bf08fcbfc9eeca507", "type": "github" }, "original": { @@ -1219,11 +1236,11 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1734119587, - "narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=", + "lastModified": 1734649271, + "narHash": "sha256-4EVBRhOjMDuGtMaofAIqzJbg4Ql7Ai0PSeuVZTHjyKQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5", + "rev": "d70bd19e0a38ad4790d3913bf08fcbfc9eeca507", "type": "github" }, "original": { @@ -1442,11 +1459,11 @@ "systems": "systems_6" }, "locked": { - "lastModified": 1734816804, - "narHash": "sha256-oNAibaJP9FzcrA5dd7Ynt2iA8QxievLQhk68P+BPpQk=", + "lastModified": 1735198481, + "narHash": "sha256-LXAJuUvv0VhGkZfe1dknY4575i0tMMKIUOhKaj2/FuU=", "owner": "notashelf", "repo": "nvf", - "rev": "46aa168b2dd4a17e858e0e14baf16eb66c516bb6", + "rev": "b6a49b299ab64d8e94e0f23eecc5489171a659a8", "type": "github" }, "original": { @@ -3028,11 +3045,11 @@ "plugin-run-nvim": { "flake": false, "locked": { - "lastModified": 1734816675, - "narHash": "sha256-Wuk5HG+vHXAbifzp5YB5V/FxBhBRNWLeypkRczpXbvQ=", + "lastModified": 1735130195, + "narHash": "sha256-OaOSYyXSNCl9kJJVKhy0L4M06CQFc0NtZ8+AIgKBPik=", "owner": "diniamo", "repo": "run.nvim", - "rev": "6cd971afdce6443d7a070dcc23af51da1cc932f9", + "rev": "5888f31c5faf4776e598c0665470f5445510c59e", "type": "github" }, "original": { @@ -3356,11 +3373,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1734379367, - "narHash": "sha256-Keu8z5VgT5gnCF4pmB+g7XZFftHpfl4qOn7nqBcywdE=", + "lastModified": 1734797603, + "narHash": "sha256-ulZN7ps8nBV31SE+dwkDvKIzvN6hroRY8sYOT0w+E28=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "0bb4be58f21ff38fc3cdbd6c778eb67db97f0b99", + "rev": "f0f0dc4920a903c3e08f5bdb9246bb572fcae498", "type": "github" }, "original": { @@ -3444,11 +3461,11 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1734765008, - "narHash": "sha256-dzjpge2mv+QVb3khpC7A4t4j3YC5EAE6DZ8NDjpLEFk=", + "lastModified": 1735227773, + "narHash": "sha256-eYkxxU3Bqr7uLMKXOIb9BGlaD0W/I2pI6bh1SIuPZH4=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "fda8b48bd82cc377318cafbfc5c3fdb630e8f105", + "rev": "1ce4de2585cb9802c4d5a99d1a904b11fdba9501", "type": "github" }, "original": { @@ -3732,11 +3749,11 @@ ] }, "locked": { - "lastModified": 1734422917, - "narHash": "sha256-0y7DRaXslhfqVKV8a/talYTYAe2NHOQhMZG7KMNRCtc=", + "lastModified": 1734907020, + "narHash": "sha256-p6HxwpRKVl1KIiY5xrJdjcEeK3pbmc///UOyV6QER+w=", "owner": "hyprwm", "repo": "xdg-desktop-portal-hyprland", - "rev": "3e884d941ca819c1f2e50df8bdae0debded1ed87", + "rev": "d7f18dda5e511749fa1511185db3536208fb1a63", "type": "github" }, "original": { @@ -3752,11 +3769,11 @@ ] }, "locked": { - "lastModified": 1734664144, - "narHash": "sha256-xgsKX4zLp/+zDZ+kAT63Pvbi5HfkYt04TbhiSmkP4Zs=", + "lastModified": 1735129601, + "narHash": "sha256-+CaYN65jbfnRxJ89tKOG55pjb/r5WuMw5SjUnmMUGcU=", "ref": "refs/heads/main", - "rev": "7bf45618610a731c627f08044b2ac20431d560e3", - "revCount": 64, + "rev": "2e025c1180fcd887a818f7967ff3211722394e32", + "revCount": 66, "type": "git", "url": "https://git.sr.ht/~canasta/zen-browser-flake" }, diff --git a/modules/home/programs/hyprland/appearance.nix b/modules/home/programs/hyprland/appearance.nix index 59558035..17cdc0ef 100644 --- a/modules/home/programs/hyprland/appearance.nix +++ b/modules/home/programs/hyprland/appearance.nix @@ -13,14 +13,13 @@ in { wayland.windowManager.hyprland.settings = { general = { gaps_in = 2; - gaps_out = 4; + gaps_out = "4, 4, 4, 4"; border_size = 3; #col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg #col.inactive_border = rgba(595959aa) "col.active_border" = "rgb(4c7a5d)"; # rgba(b16286ee) 45deg "col.inactive_border" = "rgb(504945)"; layout = "dwindle"; - allow_tearing = false; resize_on_border = true; }; decoration = { @@ -32,13 +31,13 @@ in { noise = 0.01; vibrancy = 0.15; vibrancy_darkness = 0.5; - passes = 2; - size = 7; + passes = 1; + size = 3; popups = true; popups_ignorealpha = 0.2; }; shadow = { - enabled = true; + enabled = false; color = "rgba(00000025)"; ignore_window = true; offset = "0 5"; diff --git a/modules/home/programs/hyprland/inputs.nix b/modules/home/programs/hyprland/inputs.nix index e7aa3b51..d39359b9 100644 --- a/modules/home/programs/hyprland/inputs.nix +++ b/modules/home/programs/hyprland/inputs.nix @@ -63,13 +63,14 @@ in { }; misc = { - vrr = 0; mouse_move_enables_dpms = 1; key_press_enables_dpms = 0; force_default_wallpaper = 0; disable_hyprland_logo = true; disable_splash_rendering = true; disable_autoreload = true; + disable_xdg_env_checks = true; + layers_hog_keyboard_focus = false; }; xwayland = { @@ -78,6 +79,40 @@ in { }; } + (mkIf (host == "cnix") { + wayland.windowManager.hyprland.settings = { + render = { + explicit_sync = 2; + explicit_sync_kms = 2; + direct_scanout = false; + }; + cursor = { + no_hardware_cursors = 2; + }; + general = { + allow_tearing = false; + }; + misc = { + vrr = 0; + }; + }; + }) + + (mkIf (host == "cnixpad") { + wayland.windowManager.hyprland.settings = { + input = { + kb_options = "ctrl:swapcaps"; + }; + general = { + allow_tearing = false; + }; + misc = { + vrr = 0; + vfr = 1; + }; + }; + }) + (mkIf (host == "toothpc") { wayland.windowManager.hyprland.settings = { render = { @@ -88,26 +123,11 @@ in { cursor = { no_hardware_cursors = true; }; - }; - }) - - (mkIf (host != "toothpc") { - wayland.windowManager.hyprland.settings = { - render = { - explicit_sync = 2; - explicit_sync_kms = 2; - direct_scanout = false; + general = { + allow_tearing = false; }; - cursor = { - no_hardware_cursors = 2; - }; - }; - }) - - (mkIf (host == "cnixpad") { - wayland.windowManager.hyprland.settings = { - input = { - kb_options = "ctrl:swapcaps"; + misc = { + vrr = 0; }; }; }) diff --git a/modules/home/programs/hyprland/keybinds.nix b/modules/home/programs/hyprland/keybinds.nix index f1bc48b0..1f13b67c 100644 --- a/modules/home/programs/hyprland/keybinds.nix +++ b/modules/home/programs/hyprland/keybinds.nix @@ -24,26 +24,24 @@ in { wayland.windowManager.hyprland.settings = { # Common Keybind Variables "$fileManager" = "thunar"; - "$menu" = "pkill anyrun || anyrun | xargs hyprctl dispatch exec --"; - "$menuw" = "pkill anyrun || anyrun | xargs hyprctl dispatch exec --"; "$yazi" = "foot -e yazi"; - "$tuirun" = "tuirun-toggle.sh"; + "$tuirun" = "uwsm app -- tuirun-toggle.sh"; bind = [ - "$mod, L, exec, ${runOnce "hyprlock"}" + "$mod, SPACE, exec, $tuirun" + "$mod, R, exec, $tuirun" + "$mod, L, exec, ${toggle "nwg-bar"}" "$mod SHIFT, B, exec, pkill -SIGUSR2 waybar" "$mod, A, exec, pkill -SIGUSR1 waybar" - "$mod, T, exec, uwsm app $terminal" + "$mod, T, exec, uwsm app -- $terminal" "$mod, W, exec, $browser" "$mod, K, exec, keepassxc" "$mod SHIFT, W, exec, $browserinc" "$mod, Q, killactive," "$mod, E, exec, uwsm app -- $fileManager" - "$mod, R, exec, $tuirun" "$mod SHIFT, E, exec, $yazi" "$mod, F, fullscreen," "$mod SHIFT, F, togglefloating," - "$mod, SPACE, exec, $tuirun" "$mod, P, pseudo," "$mod, J, togglesplit," "$mod, C, exec, hyprctl dispatch exec copyq toggle" @@ -71,17 +69,20 @@ in { "$mod SHIFT, 8, movetoworkspace, 8" "$mod SHIFT, 9, movetoworkspace, 9" "$mod SHIFT, 0, movetoworkspace, 10" - ",XF86AudioLowerVolume, exec, pamixer -d 5" - ",XF86AudioRaiseVolume, exec, pamixer -i 5" - ",XF86AudioMute, exec, pamixer -t" - ",XF86AudioMicMute, exec, pactl -- set-source-mute 0 toggle" + + ",XF86AudioLowerVolume, exec, volume-control.sh --dec" + ",XF86AudioRaiseVolume, exec, volume-control.sh --inc" + ",XF86AudioMute, exec, volume-control.sh --toggle" + ",XF86AudioMicMute, exec, volume-control.sh --toggle-mic" + ",XF86MonBrightnessDown, exec, brightnessctl s 5%-" ",XF86MonBrightnessUp, exec, brightnessctl s +5%" "$mod, XF86MonBrightnessUp, exec, hyprctl dispatch dpms on" "$mod, XF86MonBrightnessDown, exec, hyprctl dispatch dpms off" - ",Insert,exec,${lib.getExe pkgs.grimblast} --notify --freeze copysave area" - "SHIFT,Insert,exec,${lib.getExe pkgs.grimblast} --notify --freeze copysave output" - "ALT,Insert,exec,${lib.getExe pkgs.grimblast} --freeze save area - | ${lib.getExe pkgs.tesseract} - - | wl-copy && ${lib.getExe pkgs.libnotify}/bin/notify-send -t 3000 'OCR result copied to buffer'" + + ",Insert, exec, ${runOnce "grimblast"} --notify --freeze copysave area" + "SHIFT, Insert, exec, ${runOnce "grimblast"} --notify --freeze copysave output" + "ALT, Insert, exec, ${runOnce "grimblast"} --freeze save area - | ${runOnce "tesseract"} - - | wl-copy && ${runOnce "notify-send"} -t 3000 'OCR result copied to buffer'" "$mod, S, togglespecialworkspace, magic" "$mod SHIFT, S, movetoworkspace, special:magic" ]; diff --git a/modules/home/programs/hyprland/rules.nix b/modules/home/programs/hyprland/rules.nix index d547235d..570d4c12 100644 --- a/modules/home/programs/hyprland/rules.nix +++ b/modules/home/programs/hyprland/rules.nix @@ -62,9 +62,22 @@ in { "float, class:^(blueman-manager)$" "float, class:^(floatranger)$" "float, class:^(floatnnn)$" + "float, class:^(uwsm app -- tuirun)$" ]; - windowrule = []; + layerrule = [ + "animation fade,hyprpicker" + "animation fade,selection" + + "noanim,waybar" + "ignorezero,waybar" + "ignorealpha 0.0,waybar" + + "blur,notifications" + "ignorezero,notifications" + + "noanim,wallpaper" + ]; }; }; } diff --git a/modules/home/programs/hyprpanel/default.nix b/modules/home/programs/hyprpanel/default.nix new file mode 100644 index 00000000..417dcdf5 --- /dev/null +++ b/modules/home/programs/hyprpanel/default.nix @@ -0,0 +1,81 @@ +{ + config, + lib, + inputs, + ... +}: let + inherit (lib) mkIf mkEnableOption; + cfg = config.home.programs.hyprpanel; +in { + options = { + home.programs.hyprpanel.enable = mkEnableOption "Enables hyprpanel"; + }; + imports = [inputs.hyprpanel.homeManagerModules.hyprpanel]; + + config = mkIf cfg.enable { + programs.hyprpanel = { + # Enable the module. + # Default: false + enable = true; + + # Automatically restart HyprPanel with systemd. + # Useful when updating your config so that you + # don't need to manually restart it. + # Default: false + systemd.enable = true; + + # Add '/nix/store/.../hyprpanel' to the + # 'exec-once' in your Hyprland config. + # Default: false + hyprland.enable = false; + + # Fix the overwrite issue with HyprPanel. + # See below for more information. + # Default: false + overwrite.enable = false; + + # Import a specific theme from './themes/*.json'. + # Default: "" + theme = "gruvbox_split"; + + # Configure bar layouts for monitors. + # See 'https://hyprpanel.com/configuration/panel.html'. + # Default: null + layout = { + "bar.layouts" = { + "0" = { + left = ["dashboard"]; + middle = ["workspaces"]; + right = ["volume" "systray" "notifications"]; + }; + }; + }; + + # Configure and theme *most* of the options from the GUI. + # See './nix/module.nix:103'. + # Default: + settings = { + bar.launcher.autoDetectIcon = true; + bar.workspaces.show_icons = true; + + menus.clock = { + time = { + military = true; + hideSeconds = true; + }; + weather.unit = "metric"; + }; + + menus.dashboard.directories.enabled = false; + menus.dashboard.stats.enable_gpu = true; + + theme.bar.transparent = true; + + theme.font = { + name = "Input Mono Narrow Light"; + size = "16px"; + }; + }; + }; + }; +} diff --git a/modules/home/programs/ironbar/default.nix b/modules/home/programs/ironbar/default.nix new file mode 100644 index 00000000..eefdecb2 --- /dev/null +++ b/modules/home/programs/ironbar/default.nix @@ -0,0 +1,164 @@ +{ + pkgs, + config, + lib, + ... +}: let + inherit (lib) mkIf mkEnableOption singleton; + inherit (builtins) toJSON; + cfg = config.home.programs.ironbar; +in { + options = { + home.programs.ironbar.enable = mkEnableOption "Enables ironbar"; + }; + config = mkIf cfg.enable { + home.packages = with pkgs; [ironbar]; + + xdg.configFile = { + "ironbar/config.json".text = toJSON { + name = "main"; + icon_theme = "Fluent-dark"; + position = "bottom"; + anchor_to_edges = true; + + start = [ + { + name = "startMenu"; + type = "label"; + label = "❄"; + on_mouse_enter = "tuirun-toggle.sh"; + } + ]; + + center = singleton { + type = "launcher"; + icon_size = 39; + + favorites = [ + "zen" + "alacritty" + "thunar" + ]; + }; + + end = [ + { + type = "tray"; + } + { + type = "upower"; + show_if = "upower -e | grep BAT"; + } + { + type = "clock"; + format = "%x(%a)%R"; + } + ]; + }; + + "ironbar/style.css".text = + # css + '' + * { + font-family: "Input Sans Narrow", "Font Awesome 6 Free Solid"; + font-size: 13px; + text-shadow: 2px 2px #3c3836; + border: none; + border-radius: 0; + outline: none; + font-weight: 500; + background: none; + color: #fbf1c7; + } + + .background { + background: alpha(#3c3836, 0.925); + } + + button:hover { + background: alpha(#504945, 0.8); + } + + #bar { + border-top: 1px solid alpha(#504945, 0.925); + } + + .label, .script, .tray { + padding-left: 0.5em; + padding-right: 0.5em; + } + + .tray .item { + padding-left: 0.5em; + } + + .upower { + padding-left: 0.2em; + padding-right: 0.2em; + } + + .upower .label { + padding-left: 0; + padding-right: 0; + } + + .popup { + border: 1px solid #504945; + padding: 1em; + } + + .popup-clock .calendar-clock { + font-family: "Input Mono Narrow"; + font-size: 2.5em; + padding-bottom: 0.1em; + } + + .popup-clock .calendar .header { + padding-top: 1em; + border-top: 1px solid #504945; + font-size: 1.5em; + } + + .popup-clock .calendar { + padding: 0.2em 0.4em; + } + + .popup-clock .calendar:selected { + color: #32302f; + } + + .launcher .item { + padding-left: 1em; + padding-right: 1em; + margin-right: 4px; + } + + button:active { + background: alpha(#7c6f64, 0.8); + } + + .launcher .open { + box-shadow: inset 0 -2px alpha(#7c6f64, 0.8); + } + + .launcher .focused { + box-shadow: inset 0 -2px alpha(#32302f, 0.8); + background: alpha(#504945, 0.8); + } + + .popup-launcher { + padding: 0; + } + + .popup-launcher .popup-item:not(:first-child) { + border-top: 1px solid #504945; + } + + #startMenu { + padding-left: 1em; + padding-right: 0.5em; + } + ''; + }; + }; +} diff --git a/modules/home/programs/misc/default.nix b/modules/home/programs/misc/default.nix index 3cb2d19e..d183d929 100644 --- a/modules/home/programs/misc/default.nix +++ b/modules/home/programs/misc/default.nix @@ -39,6 +39,8 @@ in { qbittorrent usbimager # write bootable usb images! slurp # select region for screenshot + grimblast + tesseract # misc.tui xcur2png cmatrix diff --git a/modules/home/programs/nwg-bar/default.nix b/modules/home/programs/nwg-bar/default.nix index 1961c193..d819d313 100644 --- a/modules/home/programs/nwg-bar/default.nix +++ b/modules/home/programs/nwg-bar/default.nix @@ -18,22 +18,22 @@ in { { label = "Lock"; exec = "hyprlock"; - icon = "${config.gtk.iconTheme.package}/share/icons/Adwaita/symbolic/status/system-lock-screen-symbolic.svg"; + icon = "${config.gtk.iconTheme.package}/share/icons/Papirus-Dark/symbolic/status/system-lock-screen-symbolic.svg"; } { label = "Logout"; exec = "hyprctl dispatch exit"; - icon = "${config.gtk.iconTheme.package}/share/icons/Adwaita/symbolic/actions/system-log-out-symbolic.svg"; + icon = "${config.gtk.iconTheme.package}/share/icons/Papirus-Dark/symbolic/actions/system-log-out-symbolic.svg"; } { label = "Reboot"; exec = "systemctl reboot"; - icon = "${config.gtk.iconTheme.package}/share/icons/Adwaita/symbolic/actions/system-reboot-symbolic.svg"; + icon = "${config.gtk.iconTheme.package}/share/icons/Papirus-Dark/symbolic/actions/system-reboot-symbolic.svg"; } { label = "Shutdown"; exec = "systemctl -i poweroff"; - icon = "${config.gtk.iconTheme.package}/share/icons/Adwaita/symbolic/actions/system-shutdown-symbolic.svg"; + icon = "${config.gtk.iconTheme.package}/share/icons/Papirus-Dark/symbolic/actions/system-shutdown-symbolic.svg"; } ]; xdg.configFile."nwg-bar/style.css".text = '' diff --git a/modules/home/programs/waybar/bin/waybar-decrypted b/modules/home/programs/waybar/bin/waybar-decrypted new file mode 100644 index 00000000..2481a795 --- /dev/null +++ b/modules/home/programs/waybar/bin/waybar-decrypted @@ -0,0 +1,21 @@ +#!/bin/sh + +output() { + if [ -f "$HOME/decrypted/.lock" ]; then + printf '{"text": ""}\n' + else + printf '{"text": ""}\n' + fi +} + +check() { + [ ! -d "$HOME/decrypted" ] && return + + output + inotifywait -q "$HOME/decrypted/.lock" > /dev/null 2>&1 + output + inotifywait -q "$HOME/decrypted" > /dev/null + check +} + +check diff --git a/modules/home/programs/waybar/bin/waybar-mail b/modules/home/programs/waybar/bin/waybar-mail new file mode 100644 index 00000000..d5eae389 --- /dev/null +++ b/modules/home/programs/waybar/bin/waybar-mail @@ -0,0 +1,18 @@ +#!/bin/sh + +check() { + [ ! -d "$HOME/.mail" ] && return + + notmuch new > /dev/null + count="$(notmuch count 'tag:unread')" + tooltip="There are $count new emails" + if [ "$count" = "0" ]; then + printf '{"text": ""}\n' + else + printf '{"text": "%s", "tooltip": "%s", "alt": "icon"}\n' "$count" "$tooltip" + fi + inotifywait -q -e move -e create -e delete "$HOME/.mail/cnst/INBOX/cur" > /dev/null + check +} + +check diff --git a/modules/home/programs/waybar/bin/waybar-progress b/modules/home/programs/waybar/bin/waybar-progress new file mode 100644 index 00000000..9de623d7 --- /dev/null +++ b/modules/home/programs/waybar/bin/waybar-progress @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +output="$(progress -q)" +text="$(printf "%s" "$output" | sed 's/\[[^]]*\] //g' | awk 'BEGIN { ORS=" " } NR%3==1 { op=$1 } NR%3==2 { pct=($1+0); if (op != "gpg" && op != "coreutils" && pct > 0 && pct < 100) { print op, $1 } }')" +tooltip="$(printf "%s" "$output" | perl -pe 's/\n/\\n/g' | perl -pe 's/(?:\\n)+$//')" + +printf '{"text": "%s", "tooltip": "%s"}\n' "$text" "$tooltip" diff --git a/modules/home/programs/waybar/bin/waybar-recording b/modules/home/programs/waybar/bin/waybar-recording new file mode 100644 index 00000000..e8f322a4 --- /dev/null +++ b/modules/home/programs/waybar/bin/waybar-recording @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +if pgrep -x wf-recorder >/dev/null; then + printf '{"text": "  "}\n' +else + printf '{"text": ""}\n' +fi diff --git a/modules/home/programs/waybar/bin/waybar-yubikey b/modules/home/programs/waybar/bin/waybar-yubikey new file mode 100644 index 00000000..b5ea13e4 --- /dev/null +++ b/modules/home/programs/waybar/bin/waybar-yubikey @@ -0,0 +1,37 @@ +#!/bin/bash + +socket="${XDG_RUNTIME_DIR:-/run/user/$UID}/yubikey-touch-detector.socket" + +while true; do + touch_reasons=() + + if [ ! -e "$socket" ]; then + printf '{"text": "Waiting for YubiKey socket"}\n' + while [ ! -e "$socket" ]; do sleep 1; done + fi + printf '{"text": ""}\n' + + while read -n5 cmd; do + reason="${cmd:0:3}" + + if [ "${cmd:4:1}" = "1" ]; then + touch_reasons+=("$reason") + else + for i in "${!touch_reasons[@]}"; do + if [ "${touch_reasons[i]}" = "$reason" ]; then + unset 'touch_reasons[i]' + break + fi + done + fi + + if [ "${#touch_reasons[@]}" -eq 0 ]; then + printf '{"text": ""}\n' + else + tooltip="YubiKey is waiting for a touch, reasons: ${touch_reasons[@]}" + printf '{"text": "  ", "tooltip": "%s"}\n' "$tooltip" + fi + done < <(nc -U "$socket") + + sleep 1 +done diff --git a/modules/home/programs/waybar/default.nix b/modules/home/programs/waybar/default.nix index 9e28192d..4d1d9802 100644 --- a/modules/home/programs/waybar/default.nix +++ b/modules/home/programs/waybar/default.nix @@ -11,17 +11,217 @@ in { home.programs.waybar.enable = mkEnableOption "Enables waybar"; }; config = mkIf cfg.enable { + systemd.user.services.waybar = { + Unit.StartLimitBurst = 30; + }; programs.waybar = { enable = true; package = pkgs.waybar; systemd.enable = true; - }; + # style = ./style.css; - systemd.user.services.waybar = { - Unit = { - StartLimitBurst = 30; - After = lib.mkForce "graphical-session.target"; - }; + settings = [ + { + height = 25; + + modules-left = [ + "group/system" + ]; + + modules-center = [ + "hyprland/workspaces" + ]; + + modules-right = [ + "custom/progress" + "custom/systemd" + # "custom/mail" + "group/tray" + "pulseaudio" + "backlight" + "battery" + "clock" + "custom/mako" + ]; + + "hyprland/workspaces" = { + format = "{icon}"; + format-icons = { + "default" = ""; + "active" = ""; + "empty" = ""; + "persistent" = ""; + }; + disable-scroll = true; + rotate = 0; + all-outputs = true; + active-only = false; + on-click = "activate"; + persistent-workspaces = { + "*" = 3; + }; + }; + + "group/tray" = { + orientation = "inherit"; + drawer = { + transition-left-to-right = false; + transistion-duration = 250; + click-to-reveal = true; + }; + modules = [ + "custom/trayicon" + "tray" + ]; + }; + + "group/system" = { + orientation = "inherit"; + drawer = { + transistion-left-to-right = true; + transition-duration = 250; + click-to-reveal = true; + }; + modules = [ + "custom/logo" + "cpu" + "memory" + "disk" + "network" + ]; + }; + + "custom/trayicon" = { + format = "󰅁"; + tooltip = false; + }; + + "custom/logo" = { + format = " "; + tooltip = false; + }; + + "custom/mako" = { + exec = "mako.sh"; + on-click = "mako-toggle.sh"; + restart-interval = 1; + tooltip = false; + }; + + "custom/progress" = { + exec = "waybar-progress.sh"; + return-type = "json"; + interval = 1; + }; + + "custom/systemd" = { + exec = "waybar-systemd.sh"; + return-type = "json"; + interval = 10; + }; + + # "custom/mail" = { + # format-icons = { + # icon = ""; + # }; + # format = "{icon}{}"; + # exec = "${app}/bin/waybar-mail"; + # return-type = "json"; + # }; + + # "custom/recording" = { + # exec = "${app}/bin/waybar-recording"; + # return-type = "json"; + # signal = 3; + # interval = "once"; + # }; + + tray = { + icon-size = 12; + rotate = 0; + spacing = 5; + }; + + clock = { + format = " {:%a, %d %b %H:%M}"; + rotate = 0; + on-click = "calcurse-toggle.sh"; + on-click-right = "calsync.sh"; + tooltip = false; + }; + + cpu = { + format = " {usage}%"; + states = { + warning = 70; + critical = 90; + }; + }; + + disk = { + format = " {percentage_free}%"; + states = { + warning = 70; + critical = 90; + }; + }; + + memory = { + format = " {}%"; + states = { + warning = 70; + critical = 90; + }; + }; + + backlight = { + format = "{icon} {percent}%"; + format-icons = [""]; + tooltip = false; + }; + + battery = { + states = { + warning = 30; + critical = 15; + }; + format = "{icon} {capacity}%"; + format-charging = " {capacity}%"; + format-icons = ["" "" "" "" ""]; + }; + + network = { + interval = 2; + format-wifi = " {essid}"; + format-ethernet = " {ifname}"; + format-linked = " {ifname}"; + format-disconnected = " "; + tooltip-format = "{ifname}: {ipaddr}/{cidr}\n {bandwidthDownBits}\n {bandwidthUpBits}"; + }; + + pulseaudio = { + format = "{icon} {volume}% {format_source}"; + on-scroll-up = "volume-control.sh --inc"; + on-scroll-down = "volume-control.sh --dec"; + format-bluetooth = "{icon} {volume}% {format_source}"; + format-bluetooth-muted = " {icon} {format_source}"; + format-muted = " {format_source}"; + format-source = " {volume}%"; + format-source-muted = ""; + format-icons = { + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + portable = ""; + car = ""; + default = ["" "" ""]; + }; + on-click = lib.getExe pkgs.pavucontrol; + on-click-middle = lib.getExe pkgs.helvum; + }; + } + ]; }; }; } diff --git a/modules/home/programs/waybar/style.css b/modules/home/programs/waybar/style.css new file mode 100644 index 00000000..81e7ae77 --- /dev/null +++ b/modules/home/programs/waybar/style.css @@ -0,0 +1,167 @@ +* { + all: unset; + background: #282828; + border: none; + border-radius: 0; + font-family: + Input Mono Narrow Light, + "Font Awesome 6 Free Solid"; + font-size: 13px; + min-height: 0; +} + +window#waybar { + background: transparent; + color: #fbf1c7; + /* transition-property: background-color; */ + /* transition-duration: 0.5s; */ +} + +#workspaces button { + padding: 0 0px; + margin: 0 6px; + background-color: transparent; + color: #fbf1c7; + border-top: 3px solid transparent; + border-bottom: 3px solid transparent; +} +#workspaces button:hover { + background-color: #282828; + background: #282828; + color: #ebdbb2; + animation: ws_active 0s ease-in-out 1; + transition: all 0.2s cubic-bezier(0.55, -0.68, 0.48, 1.682); +} + +#workspaces button.active { + color: #fbf1c7; + animation: ws_active 0s ease-in-out 1; + transition: all 0.2s cubic-bezier(0.55, -0.68, 0.48, 1.682); +} + +#custom-logo { + font-size: 16px; + background-image: url("../waybar/images/button.svg"); + background-position: center; + background-repeat: no-repeat; + background-size: 18px 15px; +} + +#custom-trayicon { + color: #fbf1c7; + background: transparent; + opacity: 1; + margin: 1px 0px 0px 0px; + padding-left: 2px; + padding-right: 2px; + font-family: "Cantarell"; + font-size: 14px; +} + +#custom-usbguard, +#custom-decrypted, +#custom-mail, +#battery.warning, +#disk.warning, +#memory.warning, +#cpu.warning, +#custom-dnd.dnd-notification, +#custom-dnd.dnd-none { + border-top: 3px solid #282828; + border-bottom: 3px solid #c35e0a; +} + +#custom-systemd, +#battery.critical, +#disk.critical, +#memory.critical, +#cpu.critical, +#custom-yubikey, +#custom-recording { + border-top: 3px solid #282828; + border-bottom: 3px solid #c14a4a; +} + +#battery.charging { + border-top: 3px solid #282828; + border-bottom: 3px solid #4c7a5d; +} + +#pulseaudio, +#custom-systemd, +#custom-mail, +#network, +#cpu, +#disk, +#memory, +#backlight, +#battery, +#clock { + padding: 0 3px; + margin: 0 3px; +} + +#custom-dnd, +#custom-recording, +#language { + padding: 0; + margin: 0 6px; +} + +#backlight, +#battery, +#clock, +#cpu, +#custom-mail, +#custom-progress, +#custom-recording, +#custom-systemd, +#custom-usbguard, +#custom-yubikey, +#disk, +#memory, +#mode, +#network, +#pulseaudio { + color: #fbf1c7; +} + +#custom-mako { + color: #928374; + background: transparent; + opacity: 1; + margin: 1px 0px 0px 0px; + padding-right: 12px; + padding-left: 8px; + font-family: "Cantarell"; + font-size: 16px; +} + +#tray menu * { + color: #fbf1c7; + font-family: "Input Sans Compressed"; +} + +#tray { + padding: 0px 5px; +} + +#tray > .passive { + -gtk-icon-effect: dim; +} + +@keyframes needs-attention { + to { + background-color: rgba(235, 77, 75, 0.5); + } +} + +#tray > .needs-attention { + -gtk-icon-effect: highlight; + animation-name: needs-attention; + animation-duration: 1s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; + background-color: transparent; +} diff --git a/modules/nixos/programs/pkgs/default.nix b/modules/nixos/programs/pkgs/default.nix index ec484834..0769087e 100644 --- a/modules/nixos/programs/pkgs/default.nix +++ b/modules/nixos/programs/pkgs/default.nix @@ -41,6 +41,9 @@ in { tree gnome-disk-utility networkmanagerapplet + progress + wf-recorder + inotify-tools ] (mkIf cfg.desktop.enable [ diff --git a/scripts/bin/mako-toggle.sh b/scripts/bin/mako-toggle.sh index 7c2ed2f5..f711f6e8 100755 --- a/scripts/bin/mako-toggle.sh +++ b/scripts/bin/mako-toggle.sh @@ -1,8 +1,8 @@ -#!/bin/sh +MAKOCTL="/etc/profiles/per-user/$USER/bin/makoctl" +GREP="/run/current-system/sw/bin/grep" -# Toggle Mako mode between "do-not-disturb" and "default" -if makoctl mode | grep -q "default"; then - makoctl set-mode do-not-disturb +if "$MAKOCTL" mode | "$GREP" -q "default"; then + "$MAKOCTL" set-mode do-not-disturb else - makoctl set-mode default + "$MAKOCTL" set-mode default fi diff --git a/scripts/bin/mako.sh b/scripts/bin/mako.sh index 8cad8d3f..a81091d7 100755 --- a/scripts/bin/mako.sh +++ b/scripts/bin/mako.sh @@ -1,10 +1,10 @@ -#!/bin/sh +MAKOCTL="/etc/profiles/per-user/$USER/bin/makoctl" +GREP="/run/current-system/sw/bin/grep" -COUNT=$(makoctl list | grep -c "id") -ENABLED=󰂚 -DISABLED=󱏧 -if [ "$COUNT" != 0 ]; then DISABLED="󱅫"; fi -if [ "$( - makoctl mode | grep -q "default" - echo $? -)" -eq 0 ]; then echo $ENABLED; else echo $DISABLED; fi +if "$MAKOCTL" mode | "$GREP" -q "default"; then + # Default mode + echo "󰂚" +else + # Do-not-disturb mode + echo "󱏧" +fi diff --git a/scripts/bin/waybar-progress.sh b/scripts/bin/waybar-progress.sh new file mode 100755 index 00000000..9e92d8dc --- /dev/null +++ b/scripts/bin/waybar-progress.sh @@ -0,0 +1,10 @@ +# This is a very slightly modified version of a script from @maximbaz +PROGRESS="/run/current-system/sw/bin/progress" +PERL="/run/current-system/sw/bin/perl" +SED="/etc/profiles/per-user/$USER/bin/sed" + +output="$("$PROGRESS" -q)" +text="$(printf "%s" "$output" | "$SED" 's/\[[^]]*\] //g' | /run/current-system/sw/bin/awk 'BEGIN { ORS=" " } NR%3==1 { op=$1 } NR%3==2 { pct=($1+0); if (op != "gpg" && op != "coreutils" && pct > 0 && pct < 100) { print op, $1 } }')" +tooltip="$(printf "%s" "$output" | "$PERL" -pe 's/\n/\\n/g' | "$PERL" -pe 's/(?:\\n)+$//')" + +printf '{"text": "%s", "tooltip": "%s"}\n' "$text" "$tooltip" diff --git a/scripts/bin/waybar-systemd.sh b/scripts/bin/waybar-systemd.sh new file mode 100755 index 00000000..ab54bc62 --- /dev/null +++ b/scripts/bin/waybar-systemd.sh @@ -0,0 +1,52 @@ +# This is a modified version of a script from @maximbaz +SYSTEMCTL="/run/current-system/sw/bin/systemctl" +WC="/run/current-system/sw/bin/wc" + +failed_user_output=$("$SYSTEMCTL" --plain --no-legend --user list-units --state=failed --type=service 2>/dev/null) +failed_system_output=$("$SYSTEMCTL" --plain --no-legend list-units --state=failed --type=service) + +if [[ -z "$failed_system_output" ]]; then + failed_systemd_count=0 +else + failed_systemd_count=$("$WC" -l <<<"$failed_system_output") +fi + +if [[ -z "$failed_user_output" ]]; then + failed_user_count=0 +else + failed_user_count=$("$WC" -l <<<"$failed_user_output") +fi + +total_failed=$((failed_systemd_count + failed_user_count)) + +if [[ "$total_failed" -eq 0 ]]; then + printf '{"text": ""}\n' +else + tooltip="" + + if [[ -n "$failed_system_output" ]]; then + failed_system=$(echo "$failed_system_output" | /run/current-system/sw/bin/awk '{print $1}') + tooltip+="Failed system services: " + if [[ "$failed_systemd_count" -gt 1 ]]; then + failed_system_indented="${failed_system//$'\n'/\\n }" + tooltip+="$failed_system_indented" + else + tooltip+="$failed_system" + fi + fi + + if [[ -n "$failed_user_output" ]]; then + failed_user=$(echo "$failed_user_output" | /run/current-system/sw/bin/awk '{print $1}') + if [[ -n "$tooltip" ]]; then tooltip+="\n"; fi + tooltip+="Failed user services: " + if [[ "$failed_user_count" -gt 1 ]]; then + failed_user_indented="${failed_user//$'\n'/\\n }" + tooltip+="$failed_user_indented" + else + tooltip+="$failed_user" + fi + fi + + escaped_tooltip="${tooltip//$'\\n'/\\\\n}" + printf '{"text": " %d", "tooltip": "%s"}\n' "$total_failed" "$escaped_tooltip" +fi diff --git a/scripts/default.nix b/scripts/default.nix index b30b2294..4350ecd5 100644 --- a/scripts/default.nix +++ b/scripts/default.nix @@ -59,6 +59,35 @@ in { text = readFile ./bin/extract.sh; }); }; + # WAYBAR + ".local/bin/waybar-systemd.sh" = { + source = getExe (pkgs.writeShellApplication { + name = "waybar-systemd"; + runtimeInputs = with pkgs; [hyprland]; + text = readFile ./bin/waybar-systemd.sh; + }); + }; + ".local/bin/waybar-progress.sh" = { + source = getExe (pkgs.writeShellApplication { + name = "waybar-progress"; + runtimeInputs = with pkgs; [hyprland]; + text = readFile ./bin/waybar-progress.sh; + }); + }; + ".local/bin/mako.sh" = { + source = getExe (pkgs.writeShellApplication { + name = "mako"; + runtimeInputs = with pkgs; [hyprland]; + text = readFile ./bin/mako.sh; + }); + }; + ".local/bin/mako-toggle.sh" = { + source = getExe (pkgs.writeShellApplication { + name = "mako-toggle"; + runtimeInputs = with pkgs; [hyprland]; + text = readFile ./bin/mako-toggle.sh; + }); + }; }; }; }