From 3d32b6a4c57fd8a3233496b9957cb4b3928c504e Mon Sep 17 00:00:00 2001
From: Remy Moll <me@moll.re>
Date: Tue, 4 Mar 2025 21:07:41 +0100
Subject: [PATCH] wip more font struggles

---
 README.md                               |   1 +
 hosts/spectre-x360-2018/default.nix     |   1 +
 modules/home-manager/hypr/hyprpaper.nix |  84 ++++----
 modules/home-manager/hypr/waybar.nix    | 253 +++++++++++++++++++++---
 modules/nixos/bluetooth.nix             |  18 ++
 5 files changed, 293 insertions(+), 64 deletions(-)
 create mode 100644 modules/nixos/bluetooth.nix

diff --git a/README.md b/README.md
index 48fc7b8..6b0e172 100644
--- a/README.md
+++ b/README.md
@@ -49,3 +49,4 @@ This will create an iso image in the result directory.
 - https://github.com/Numb-0/nix-0
 - https://github.com/Frost-Phoenix/nixos-config
 - https://github.com/elifouts/Dotfiles
+- https://github.com/nomadics9/nixcfg
diff --git a/hosts/spectre-x360-2018/default.nix b/hosts/spectre-x360-2018/default.nix
index 42102fa..80495fd 100644
--- a/hosts/spectre-x360-2018/default.nix
+++ b/hosts/spectre-x360-2018/default.nix
@@ -4,6 +4,7 @@
     imports = [
         ./configuration.nix
         ./hardware-configuration.nix
+        ../../modules/nixos/bluetooth.nix
         ../../modules/nixos/fonts.nix
         ../../modules/nixos/hyprland.nix
         ../../modules/nixos/monitoring.nix
diff --git a/modules/home-manager/hypr/hyprpaper.nix b/modules/home-manager/hypr/hyprpaper.nix
index 55d25a7..6bfbe49 100644
--- a/modules/home-manager/hypr/hyprpaper.nix
+++ b/modules/home-manager/hypr/hyprpaper.nix
@@ -4,57 +4,57 @@
  ...
 }:
 with lib; let
-  wallpapers = builtins.path { path = ../../../wallpapers; };
+  # wallpapers = builtins.path { path = ../../../wallpapers; };
 
-  wallpaperBashArray = "(\"${strings.concatStrings (strings.intersperse "\" \"" (map (wallpaper: "${wallpaper}") wallpapers))}\")";
-  wallpaperRandomizer = pkgs.writeShellScriptBin "wallpaperRandomizer" ''
-    wallpapers=${wallpaperBashArray}
-    rand=$[$RANDOM % ''${#wallpapers[@]}]
-    wallpaper=''${wallpapers[$rand]}
+  # wallpaperBashArray = "(\"${strings.concatStrings (strings.intersperse "\" \"" (map (wallpaper: "${wallpaper}") wallpapers))}\")";
+  # wallpaperRandomizer = pkgs.writeShellScriptBin "wallpaperRandomizer" ''
+  #   wallpapers=${wallpaperBashArray}
+  #   rand=$[$RANDOM % ''${#wallpapers[@]}]
+  #   wallpaper=''${wallpapers[$rand]}
 
-    monitor=(`hyprctl monitors | grep Monitor | awk '{print $2}'`)
-    hyprctl hyprpaper unload all
-    hyprctl hyprpaper preload $wallpaper
-    for m in ''${monitor[@]}; do
-      hyprctl hyprpaper wallpaper "$m,$wallpaper"
-    done
-  '';
+  #   monitor=(`hyprctl monitors | grep Monitor | awk '{print $2}'`)
+  #   hyprctl hyprpaper unload all
+  #   hyprctl hyprpaper preload $wallpaper
+  #   for m in ''${monitor[@]}; do
+  #     hyprctl hyprpaper wallpaper "$m,$wallpaper"
+  #   done
+  # '';
 in {
-  home.packages = [wallpaperRandomizer];
+  # home.packages = [wallpaperRandomizer];
 
-  services.hyprpaper = {
-    enable = true;
+  # services.hyprpaper = {
+  #   enable = true;
 
-    # settings = {
-    #   ipc = "on";
-    #   splash = false;
-    #   splash_offset = 2.0;
-    # };
-  };
+  #   # settings = {
+  #   #   ipc = "on";
+  #   #   splash = false;
+  #   #   splash_offset = 2.0;
+  #   # };
+  # };
 
-  systemd.user = {
-    services.wallpaperRandomizer = {
-      Install = {WantedBy = ["graphical-session.target"];};
+  # systemd.user = {
+  #   services.wallpaperRandomizer = {
+  #     Install = {WantedBy = ["graphical-session.target"];};
 
-      Unit = {
-        Description = "Set random desktop background using hyprpaper";
-        After = ["graphical-session-pre.target"];
-        PartOf = ["graphical-session.target"];
-      };
+  #     Unit = {
+  #       Description = "Set random desktop background using hyprpaper";
+  #       After = ["graphical-session-pre.target"];
+  #       PartOf = ["graphical-session.target"];
+  #     };
 
-      Service = {
-        Type = "oneshot";
-        ExecStart = "${wallpaperRandomizer}/bin/wallpaperRandomizer";
-        IOSchedulingClass = "idle";
-      };
-    };
+  #     Service = {
+  #       Type = "oneshot";
+  #       ExecStart = "${wallpaperRandomizer}/bin/wallpaperRandomizer";
+  #       IOSchedulingClass = "idle";
+  #     };
+  #   };
 
-    timers.wallpaperRandomizer = {
-      Unit = {Description = "Set random desktop background using hyprpaper on an interval";};
+  #   timers.wallpaperRandomizer = {
+  #     Unit = {Description = "Set random desktop background using hyprpaper on an interval";};
 
-      Timer = {OnUnitActiveSec = "6h";};
+  #     Timer = {OnUnitActiveSec = "6h";};
 
-      Install = {WantedBy = ["timers.target"];};
-    };
-  };
+  #     Install = {WantedBy = ["timers.target"];};
+  #   };
+  # };
 }
\ No newline at end of file
diff --git a/modules/home-manager/hypr/waybar.nix b/modules/home-manager/hypr/waybar.nix
index 286776f..4360609 100644
--- a/modules/home-manager/hypr/waybar.nix
+++ b/modules/home-manager/hypr/waybar.nix
@@ -6,7 +6,9 @@
     # waybar requires font-awesome
     home.packages = [
         pkgs.font-awesome
+        pkgs.font-awesome_5
         pkgs.fira-code
+        pkgs.pavucontrol
     ];
 
     # enable waybar
@@ -34,17 +36,18 @@
                 ];
                 modules-center = [
                     "clock"
+                    "custom/notification"
                 ];
                 modules-right = [
-                    "tray"
                     # "temperature"
-                    "group/expand"
-                    "bluetooth"
+                    # "group/expand"
+                    # "bluetooth"
+                    "pulseaudio"
                     # "network"
-                    "mpd"
+                    # "mpd"
                     "battery"
                     "backlight"
-                    "custom/notification"
+                    "tray"
                 ];
 
                 # module specific settings
@@ -104,37 +107,243 @@
                     format = "{capacity}% {icon}";
                     format-charging = "{capacity}% 󰂄";
                     format-plugged = "{capacity}% 󰂄 ";
-                    format-alt = "{time} {icon}";
                     format-icons = [ "󰁻" "󰁼" "󰁾" "󰂀" "󰂂" "󰁹" ];
                 };
+
+                "pulseaudio" = {
+                    reverse-scrolling = 1;
+                    format = "{volume}% {icon} {format_source}";
+                    format-bluetooth = "{volume}% {icon} {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 = "pavucontrol";
+                    min-length = 13;
+                };
+                "tray" = {
+                    spacing = 5;
+                };
             };
         };
 
         style = ''
             * {
                 border: none;
-                border-radius: 5px;
-                padding: 0px 5px 0px 5px;
-                margin: 0px 5px 0px 5px;
+                border-radius: 0;
+                /* `otf-font-awesome` is required to be installed for icons */
+                font-family: Liberation Mono;
+                min-height: 20px;
+            }
+
+            window#waybar {
+                background: transparent;
+            }
+
+            window#waybar.hidden {
+                opacity: 0.2;
+            }
+
+            #workspaces {
+                margin-right: 8px;
+                border-radius: 10px;
+                transition: none;
+                background: #383c4a;
+            }
+
+            #workspaces button {
+                transition: none;
+                color: #7c818c;
+                background: transparent;
+                padding: 5px;
                 font-size: 18px;
             }
-            window#waybar {
-                background-color: transparent;
+
+            #workspaces button.persistent {
+                color: #7c818c;
+                font-size: 12px;
             }
-            #workspaces button {
-                padding-left: 1px;
-                padding-right: 1px;
+
+            /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
+            #workspaces button:hover {
+                transition: none;
+                box-shadow: inherit;
+                text-shadow: inherit;
+                border-radius: inherit;
+                color: #383c4a;
+                background: #7c818c;
             }
-            #workspaces {
-                padding-left: 1px;
-                padding-right: 1px;
+
+            #workspaces button.focused {
+                color: white;
+            }
+
+            #language {
+                padding-left: 16px;
+                padding-right: 8px;
+                border-radius: 10px 0px 0px 10px;
+                transition: none;
+                color: #ffffff;
+                background: #383c4a;
+            }
+
+            #keyboard-state {
+                margin-right: 8px;
+                padding-right: 16px;
+                border-radius: 0px 10px 10px 0px;
+                transition: none;
+                color: #ffffff;
+                background: #383c4a;
+            }
+
+            #custom-pacman {
+                padding-left: 16px;
+                padding-right: 8px;
+                border-radius: 10px 0px 0px 10px;
+                transition: none;
+                color: #ffffff;
+                background: #383c4a;
+            }
+
+            #custom-mail {
+                margin-right: 8px;
+                padding-right: 16px;
+                border-radius: 0px 10px 10px 0px;
+                transition: none;
+                color: #ffffff;
+                background: #383c4a;
+            }
+
+            #mode {
+                padding-left: 16px;
+                padding-right: 16px;
+                border-radius: 10px;
+                transition: none;
+                color: #ffffff;
+                background: #383c4a;
+            }
+
+            #clock {
+                padding-left: 16px;
+                padding-right: 16px;
+                border-radius: 10px 0px 0px 10px;
+                transition: none;
+                color: #ffffff;
+                background: #383c4a;
+            }
+
+            #custom-weather {
+                padding-right: 16px;
+                border-radius: 0px 10px 10px 0px;
+                transition: none;
+                color: #ffffff;
+                background: #383c4a;
+            }
+
+            #pulseaudio {
+                margin-right: 8px;
+                padding-left: 16px;
+                padding-right: 16px;
+                border-radius: 10px;
+                transition: none;
+                color: #ffffff;
+                background: #383c4a;
+            }
+
+            #pulseaudio.muted {
+                background-color: #90b1b1;
+                color: #2a5c45;
+            }
+
+            #custom-mem {
+                margin-right: 8px;
+                padding-left: 16px;
+                padding-right: 16px;
+                border-radius: 10px;
+                transition: none;
+                color: #ffffff;
+                background: #383c4a;
+            }
+
+            #temperature {
+                margin-right: 8px;
+                padding-left: 16px;
+                padding-right: 16px;
+                border-radius: 10px;
+                transition: none;
+                color: #ffffff;
+                background: #383c4a;
+            }
+
+            #temperature.critical {
+                background-color: #eb4d4b;
+            }
+
+            #backlight {
+                margin-right: 8px;
+                padding-left: 16px;
+                padding-right: 16px;
+                border-radius: 10px;
+                transition: none;
+                color: #ffffff;
+                background: #383c4a;
+            }
+
+            #battery {
+                margin-right: 8px;
+                padding-left: 16px;
+                padding-right: 16px;
+                border-radius: 10px;
+                transition: none;
+                color: #ffffff;
+                background: #383c4a;
+            }
+
+            #battery.charging {
+                color: #ffffff;
+                background-color: #26A65B;
+            }
+
+            #battery.warning:not(.charging) {
+                background-color: #ffbe61;
+                color: black;
+            }
+
+            #battery.critical:not(.charging) {
+                background-color: #f53c3c;
+                color: #ffffff;
+                animation-name: blink;
+                animation-duration: 0.5s;
+                animation-timing-function: linear;
+                animation-iteration-count: infinite;
+                animation-direction: alternate;
+            }
+
+            #tray {
+                padding-left: 16px;
+                padding-right: 16px;
+                border-radius: 10px;
+                transition: none;
+                color: #ffffff;
+                background: #383c4a;
+            }
+
+            @keyframes blink {
+                to {
+                    background-color: #ffffff;
+                    color: #000000;
+                }
             }
         '';
-        # font-family: ${font};
-        # font-weight: ${font_weight};
-        # opacity: ${opacity};
-        # font-size: ${font_size};
-
     };
 }
     
\ No newline at end of file
diff --git a/modules/nixos/bluetooth.nix b/modules/nixos/bluetooth.nix
new file mode 100644
index 0000000..b087ebc
--- /dev/null
+++ b/modules/nixos/bluetooth.nix
@@ -0,0 +1,18 @@
+{
+  hardware.bluetooth = {
+    enable = true;
+    powerOnBoot = false;
+    settings = {
+      General = {
+        Name = "Hello";
+        ControllerMode = "dual";
+        FastConnectable = "true";
+        Experimental = "true";
+      };
+      Policy = {
+        AutoEnable = "true";
+      };
+    };
+  };
+  services.blueman.enable = true;
+}
\ No newline at end of file