about summary refs log tree commit diff stats
path: root/home-manager/config/firefox/default.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--home-manager/config/firefox/default.nix44
1 files changed, 30 insertions, 14 deletions
diff --git a/home-manager/config/firefox/default.nix b/home-manager/config/firefox/default.nix
index 9a15b9ce..611f594c 100644
--- a/home-manager/config/firefox/default.nix
+++ b/home-manager/config/firefox/default.nix
@@ -3,10 +3,8 @@
   config,
   pkgs,
   lib,
-  stdenv,
-  generate_extensions,
   user_js,
-  system,
+  video_pause,
   ...
 }: let
   bookmarks = [
@@ -135,11 +133,6 @@
     //user_pref("security.webauth.webauthn_enable_usbtoken", true);
     EOF
   '';
-  #"${strip_js_comments.app.${system}.default.program}" $out/user.js > $out/user_clean.js;
-  #    echo "{" > $out/user.nix.tmp
-  #    sed 's/user_pref(\(.*\)",\(.*\));/\1" = \2;/' $out/user_clean.js >> $out/user.nix.tmp;
-  #    echo "}" >> $out/user.nix.tmp
-  #    awk '!/"_user.js.parrot"/' $out/user.nix.tmp >> $out/user.nix; # delete duplicate keys
 
   extensions = builtins.map buildFirefoxXpiAddon (
     lib.attrValues (
@@ -174,12 +167,33 @@
       '';
     };
 
-  settings = {
-  };
+  settings = {};
+  video-pauser = pkgs.runCommand "video_pause_native_messaging" {} ''
+    install -d $out/share/
+    cat << EOF > $out/share/video_pauser.json
+    {
+      "name": "video_pauser",
+      "description": "Pause your Videos with a single key stroke!",
+      "path": "${video_pause}/bin/video_pause",
+      "type": "stdio",
+      "allowed_extensions": ["video-pauser@addons.vhack.eu"]
+    }
+    EOF
+
+    nativeMessagingPaths=(
+      /lib/mozilla/native-messaging-hosts
+      /etc/opt/chrome/native-messaging-hosts
+      /etc/chromium/native-messaging-hosts
+      /etc/vivaldi/native-messaging-hosts
+      /lib/librewolf/native-messaging-hosts
+    )
+
+    for manifestDir in "''${nativeMessagingPaths[@]}"; do
+      install -d $out$manifestDir
+      ln -s $out/share/video_pauser.json $out$manifestDir/
+    done
+  '';
 in {
-  home.packages = [
-    pkgs.firefox-wayland
-  ];
   home.sessionVariables = {
     # improve touch input & make scrolling smother
     MOZ_USE_XINPUT2 = "1";
@@ -198,7 +212,9 @@ in {
   };
   programs.firefox = {
     enable = true;
-    package = pkgs.firefox-wayland;
+    package = pkgs.firefox-wayland.override {
+      extraNativeMessagingHosts = [video-pauser];
+    };
     profiles."default" = {
       inherit extensions;
       isDefault = true;