firefox: fix open-in-mpv integration

two parts: add open-in-mpv's config to firefox's sandbox; patch open-in-mpv to forward to xdg-open
This commit is contained in:
Colin 2024-02-15 09:14:57 +00:00
parent 4a3d24be3f
commit 2f699737f5
2 changed files with 29 additions and 5 deletions

View File

@ -240,6 +240,7 @@ in
sandbox.whitelistDbus = [ "user" ]; # mpris
sandbox.whitelistWayland = true;
sandbox.extraHomePaths = [
".local/share/applications" #< this might be needed only for custom schemes (like mpv:// for open-in-mpv)?
"dev" # for developing anything web-related
"tmp"
"Pictures"
@ -256,6 +257,8 @@ in
".ssh/id_ed25519"
# ".config/sops"
"private/knowledge/secrets/accounts"
] ++ lib.optionals cfg.addons.open-in-mpv.enable [
".config/open-in-mpv"
];
fs.".config/sops".dir = lib.mkIf cfg.addons.browserpass-extension.enable {}; #< needs to be created, not *just* added to the sandbox

View File

@ -1,18 +1,39 @@
{ ... }:
# test: `open-in-mpv 'mpv:///open?url=https://www.youtube.com/watch?v=dQw4w9WgXcQ'`
{ pkgs, ... }:
{
sane.programs.open-in-mpv = {
packageUnwrapped = pkgs.open-in-mpv.overrideAttrs (upstream: {
patches = (upstream.patches or []) ++ [
(pkgs.fetchpatch {
# if i want `open-in-mpv 'mpv:///open?...'` to use a different executable than `mpv` (e.g. `xdg-open`),
# this patch is required.
# TODO: upstream (branch: dev-sane)
url = "https://git.uninsane.org/colin/open-in-mpv/commit/4d93d5fbdd3baebb6284c517cfe9fec9970c3002.patch";
name = "open-in-mpv: respect the player's `executable` config";
hash = "sha256-UkjR58mo4ifqGU2F1YhcJU14gX41XMaXwImbV+v7Tr8=";
})
];
});
# taken from <https://github.com/Baldomo/open-in-mpv>
fs.".config/open-in-mpv/config.yml".symlink.text = ''
players:
mpv:
name: mpv
executable: mpv
fullscreen: "--fs"
pip: "--ontop --no-border --autofit=384x216 --geometry=98\\%:98\\%"
executable: xdg-open
supported_protocols:
- http
- https
fullscreen: ""
pip: ""
enqueue: ""
new_window: ""
needs_ipc: true
needs_ipc: false
flag_overrides: {}
'';
mime.associations = {
"x-scheme-handler/mpv" = "open-in-mpv.desktop";
};
};
}