zaphyra's git: nixfiles

zaphyra's nixfiles

commit 619902116974f3dc311d1657cf2f54c208f04eaa
parent 313a304fc465dc433b66a3bca56404bf7b3c459a
Author: Katja Ramona Sophie Kwast (zaphyra) <git@zaphyra.eu>
Date: Tue, 1 Jul 2025 19:35:45 +0200

config/home/zaphyra/services: add `swayosd`
1 file changed, 64 insertions(+), 0 deletions(-)
A
config/home/zaphyra/services/swayosd.nix
|
64
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/config/home/zaphyra/services/swayosd.nix b/config/home/zaphyra/services/swayosd.nix
@@ -0,0 +1,64 @@
+{
+  config,
+  lib,
+  pkgs,
+  ...
+}:
+
+{
+
+  services.swayosd = {
+    enable = true;
+    topMargin = 0.05;
+    stylePath = pkgs.writeText "swayosd.css" ''
+      window#osd {
+        padding: 10px 15px;
+        border-radius: 10px;
+        border: 1px solid rgba(255, 255, 255, .08);
+        background: alpha(#303030, 0.8);
+      }
+      window#osd #container {
+          margin: 10px;
+      }
+      window#osd #container > image {
+        -gtk-icon-transform: scale(1.2);
+      }
+      window#osd image, window#osd label {
+        color: rgba(255, 255, 255, .20);
+      }
+      window#osd progressbar:disabled, window#osd image:disabled {
+          opacity: 0.5;
+      }
+      window#osd progressbar {
+        min-height: 6px;
+        border-radius: 999px;
+        background: transparent;
+        border: none;
+      }
+      window#osd trough {
+        min-height: inherit;
+        border-radius: inherit;
+        border: none;
+        background: rgba(255, 255, 255, .06);
+      }
+      window#osd progress {
+        min-height: inherit;
+        border-radius: inherit;
+        border: none;
+        background: rgb(74, 169, 108);
+      }
+    '';
+  };
+
+  programs.niri.settings.binds = with config.lib.niri.actions; {
+    "XF86AudioRaiseVolume".action =
+      spawn "swayosd-client" "--output-volume" "raise" "--max-volume"
+        "150";
+    "XF86AudioLowerVolume".action =
+      spawn "swayosd-client" "--output-volume" "lower" "--max-volume"
+        "150";
+
+    "XF86MonBrightnessUp".action = spawn "swayosd-client" "--brightness" "raise";
+    "XF86MonBrightnessDown".action = spawn "swayosd-client" "--brightness" "lower";
+  };
+}