diff options
author | Soispha <soispha@vhack.eu> | 2023-04-16 19:35:46 +0200 |
---|---|---|
committer | Soispha <soispha@vhack.eu> | 2023-05-09 19:31:01 +0200 |
commit | a8a8b4fdcccace224ffc62880c819debae9bdcc1 (patch) | |
tree | 0bf93f077a1a28014886740efca3ac6dbf82c59e /home-manager/config | |
parent | Docs(todo): Update (diff) | |
download | nixos-config-a8a8b4fdcccace224ffc62880c819debae9bdcc1.tar.gz nixos-config-a8a8b4fdcccace224ffc62880c819debae9bdcc1.zip |
Feat(hm/conf/firefox): Add my native host for video pausing
Diffstat (limited to 'home-manager/config')
-rw-r--r-- | home-manager/config/firefox/default.nix | 44 |
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; |