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 | |
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 '')
-rw-r--r-- | flake.lock | 27 | ||||
-rw-r--r-- | flake.nix | 10 | ||||
-rw-r--r-- | flake/nixosConfigurations/default.nix | 11 | ||||
-rw-r--r-- | home-manager/config/firefox/default.nix | 44 |
4 files changed, 74 insertions, 18 deletions
diff --git a/flake.lock b/flake.lock index 1f69fc84..b7f8c273 100644 --- a/flake.lock +++ b/flake.lock @@ -280,6 +280,7 @@ "strip_js_comments": "strip_js_comments", "templates": "templates", "user_js": "user_js", + "video_pause": "video_pause", "yambar_cpu": "yambar_cpu", "yambar_memory": "yambar_memory" } @@ -428,6 +429,32 @@ "type": "github" } }, + "video_pause": { + "inputs": { + "crane": [ + "crane" + ], + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1681665568, + "narHash": "sha256-MFuebmGkzfThpxHWSJCvii6EHGa2wEwLfZgJL2FduiY=", + "ref": "refs/heads/prime", + "rev": "72c95f998368aa83e574bccebb0ed459656e1239", + "revCount": 3, + "type": "git", + "url": "https://codeberg.org/soispha/video-pause.git" + }, + "original": { + "type": "git", + "url": "https://codeberg.org/soispha/video-pause.git" + } + }, "yambar_cpu": { "inputs": { "crane": [ diff --git a/flake.nix b/flake.nix index 89faf569..ab5751ed 100644 --- a/flake.nix +++ b/flake.nix @@ -81,6 +81,14 @@ rust-overlay.follows = "rust-overlay"; }; }; + video_pause = { + url = "git+https://codeberg.org/soispha/video-pause.git"; + inputs = { + nixpkgs.follows = "nixpkgs"; + crane.follows = "crane"; + flake-utils.follows = "flake-utils"; + }; + }; strip_js_comments = { url = "git+https://codeberg.org/ene/strip_js_comments.git"; inputs = { @@ -143,6 +151,7 @@ snap-sync, templates, # my binaries + video_pause, strip_js_comments, shell-library, river_init_lesser, @@ -171,6 +180,7 @@ river_init_lesser yambar_memory yambar_cpu + video_pause grades neovim_config strip_js_comments diff --git a/flake/nixosConfigurations/default.nix b/flake/nixosConfigurations/default.nix index 5d349071..270f13a2 100644 --- a/flake/nixosConfigurations/default.nix +++ b/flake/nixosConfigurations/default.nix @@ -4,6 +4,8 @@ pkgs, nixpkgs, sysLib, + # bins + video_pause, yambar_cpu, yambar_memory, strip_js_comments, @@ -31,10 +33,11 @@ pkgs sysLib # extra information - + system # bins - + + video_pause yambar_cpu yambar_memory strip_js_comments @@ -42,12 +45,12 @@ grades shell-library # external deps - + user_js neovim_config snap-sync # modules - + impermanence ; }; 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; |