mirror of
https://github.com/donovanglover/nix-config.git
synced 2025-06-24 11:41:24 +02:00
mpv: add mpv-websocket support
Note that we use a simplified version of run_websocket_server.lua since we don't depend on toggling functionality.
This commit is contained in:
parent
4e6131ad81
commit
826cfc0f4b
39
home/mpv.nix
39
home/mpv.nix
@ -1,5 +1,18 @@
|
|||||||
{ lib, pkgs, ... }:
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
nixosConfig,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (nixosConfig._module.specialArgs) nix-config;
|
||||||
|
|
||||||
|
inherit (lib) getExe;
|
||||||
|
inherit (nix-config.packages.${pkgs.system}) mpv-websocket;
|
||||||
|
|
||||||
|
input-ipc-server = "/tmp/mpv-socket";
|
||||||
|
in
|
||||||
{
|
{
|
||||||
programs.mpv = {
|
programs.mpv = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@ -33,6 +46,8 @@
|
|||||||
osd-duration = 750;
|
osd-duration = 750;
|
||||||
|
|
||||||
autofit = "65%";
|
autofit = "65%";
|
||||||
|
|
||||||
|
inherit input-ipc-server;
|
||||||
};
|
};
|
||||||
|
|
||||||
bindings = {
|
bindings = {
|
||||||
@ -42,7 +57,26 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
xdg.configFile."mpv/script-opts/uosc.conf".text = lib.concatStrings [
|
xdg.configFile = {
|
||||||
|
"mpv/scripts/run_websocket_server.lua".text = # lua
|
||||||
|
''
|
||||||
|
mp.command_native_async({
|
||||||
|
name = "subprocess",
|
||||||
|
playback_only = false,
|
||||||
|
capture_stdout = true,
|
||||||
|
capture_stderr = true,
|
||||||
|
|
||||||
|
args = {
|
||||||
|
"${getExe mpv-websocket}",
|
||||||
|
"-m",
|
||||||
|
"${input-ipc-server}",
|
||||||
|
"-w",
|
||||||
|
"6677",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
'';
|
||||||
|
|
||||||
|
"mpv/script-opts/uosc.conf".text = lib.concatStrings [
|
||||||
"opacity="
|
"opacity="
|
||||||
",timeline=0.1"
|
",timeline=0.1"
|
||||||
",position=0.2"
|
",position=0.2"
|
||||||
@ -63,4 +97,5 @@
|
|||||||
",buffering_indicator=0.3"
|
",buffering_indicator=0.3"
|
||||||
",playlist_position=0.8"
|
",playlist_position=0.8"
|
||||||
];
|
];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user