ctucx.git: nixfiles

ctucx' nixfiles

commit 0b43fe221fcf706bdcd316812303f36e5adc6dd1
parent abb4276577e396d390bde375246182bb72c8db80
Author: Katja (ctucx) <git@ctu.cx>
Date: Wed, 23 Apr 2025 11:26:11 +0200

configurations/homeManager/programs/firefox: add bahnbonus to `vdv-pkpass` handler
1 file changed, 24 insertions(+), 16 deletions(-)
M
configurations/homeManager/programs/firefox.nix
|
40
++++++++++++++++++++++++----------------
diff --git a/configurations/homeManager/programs/firefox.nix b/configurations/homeManager/programs/firefox.nix
@@ -96,22 +96,30 @@
       UserMessaging.FirefoxLabs = false;
       UserMessaging.Locked = true;
 
-      Handlers.schemes.dbnav = {
-        action   = "useHelperApp";
-        ask      = true;
-        handlers = [{
-          name = "VDV PKPass DB Navigator Hook";
-          path = pkgs.writeShellScript "db-hook" ''
-            #!/usr/bin/env bash
-
-            if [[ "$1" == "dbnav:"* ]]; then
-              url=$(echo -n $1 | base64)
-              xdg-open "https://vdv-pkpass.magicalcodewit.ch/account/db_login/callback?url=$url"
-            else
-              xdg-open "$1"
-            fi
-          '';
-        }];
+      Handlers.schemes = let
+        handler = {
+          action   = "useHelperApp";
+          ask      = true;
+          handlers = [{
+            name = "VDV PKPass DB Navigator Hook";
+            path = pkgs.writeShellScript "db-hook" ''
+              #!/usr/bin/env bash
+
+              if [[ "$1" == "dbnav:"* ]]; then
+                url=$(echo -n $1 | base64)
+                xdg-open "https://vdv-pkpass.magicalcodewit.ch/account/db_login/callback?url=$url"
+              elif [[ "$1" == "bahnbonus:"* ]]; then
+                url=$(echo -n $1 | base64)
+                xdg-open "https://vdv-pkpass.magicalcodewit.ch/account/bahnbonus_login/callback?url=$url"
+              else
+                xdg-open "$1"
+              fi
+            '';
+          }];
+        };
+      in {
+        dbnav     = handler;
+        bahnbonus = handler;
       };
 
       Preferences = {