From 290c3c58ef6fb7a86b28c6158f0a1dee3f28ea03 Mon Sep 17 00:00:00 2001
From: Myned <dev@bjork.tech>
Date: Thu, 20 Mar 2025 12:51:21 -0500
Subject: [PATCH] rofi-rbw: use pinentry-rofi and work around window style

---
 options/custom/desktops/niri/rules.nix | 15 +++++++++++++++
 options/custom/programs/rbw.nix        |  8 +++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/options/custom/desktops/niri/rules.nix b/options/custom/desktops/niri/rules.nix
index 87174cf..7f7c3f6 100644
--- a/options/custom/desktops/niri/rules.nix
+++ b/options/custom/desktops/niri/rules.nix
@@ -266,6 +266,21 @@ in {
               default-column-width = {};
               open-floating = true;
             }
+
+            {
+              # Rofi
+              # FIXME: Figure out why pinentry-rofi opens as a window
+              # HACK: pinentry-rofi opens as a window, so attempt to style as a layer
+              matches = [
+                {app-id = "^Rofi$";}
+              ];
+
+              border.enable = false;
+              clip-to-geometry = false;
+              focus-ring.enable = false;
+              open-floating = true;
+              shadow.enable = false;
+            }
           ];
         };
       }
diff --git a/options/custom/programs/rbw.nix b/options/custom/programs/rbw.nix
index 7017174..af9dc72 100644
--- a/options/custom/programs/rbw.nix
+++ b/options/custom/programs/rbw.nix
@@ -28,7 +28,13 @@ in {
           settings = {
             base_url = "https://vault.${config.custom.domain}";
             email = "${config.custom.username}@${config.custom.domain}";
-            pinentry = pkgs.pinentry-gnome3;
+            lock_timeout = 24 * 60 * 60; # Hours
+            sync_interval = 15 * 60; # Minutes
+
+            pinentry =
+              if config.custom.menu == "rofi"
+              then pkgs.pinentry-rofi # https://github.com/plattfot/pinentry-rofi
+              else pkgs.pinentry-gnome3; # https://github.com/gpg/pinentry
           };
         };