diff --git a/home/mpv/default.nix b/home/mpv/default.nix index 828d841..69ec289 100644 --- a/home/mpv/default.nix +++ b/home/mpv/default.nix @@ -1,11 +1,42 @@ -{pkgs, ...}: let - mpvScripts = import ./scripts pkgs; -in { +{pkgs, ...}: { programs.mpv = { enable = true; - scripts = with mpvScripts; [ + scripts = with (import ./scripts pkgs); [ modernx + # Dep of touch-gestures + pointer-event + touch-gestures ]; + + scriptOpts = { + # Touch gestures default + pointer-event = { + margin_left = 0; + margin_right = 80; + margin_top = 50; + margin_bottom = 130; + ignore_left_single_long_while_window_dragging = true; + left_single = "cycle pause"; + left_double = "script-message-to touch_gestures double"; + left_long = "script-binding uosc/menu-blurred"; + left_drag_start = "script-message-to touch_gestures drag_start"; + left_drag_end = "script-message-to touch_gestures drag_end"; + left_drag = "script-message-to touch_gestures drag"; + }; + + touch-gestures = { + # valid options are: + # 'playlist' for changing the playlist item by swiping + # 'seek' for seeking by dragging + horizontal_drag = "seek"; + + # scale seeking based on the duration of the video + proportional_seek = true; + + # scale factor for seeking + seek_scale = 1; + }; + }; }; } diff --git a/home/mpv/scripts/default.nix b/home/mpv/scripts/default.nix index bb88ce7..88885ac 100644 --- a/home/mpv/scripts/default.nix +++ b/home/mpv/scripts/default.nix @@ -2,7 +2,12 @@ buildLua = pkgs.callPackage "${pkgs.path}/pkgs/applications/video/mpv/scripts/buildLua.nix" {}; + + buildLuaScript = file: + pkgs.callPackage file {inherit buildLua;}; in pkgs.recurseIntoAttrs { - modernx = pkgs.callPackage ./modernx.nix {inherit buildLua;}; + modernx = buildLuaScript ./modernx.nix; + pointer-event = buildLuaScript ./pointer-event.nix; + touch-gestures = buildLuaScript ./touch-gestures.nix; } diff --git a/home/mpv/scripts/pointer-event.nix b/home/mpv/scripts/pointer-event.nix new file mode 100644 index 0000000..94a0457 --- /dev/null +++ b/home/mpv/scripts/pointer-event.nix @@ -0,0 +1,15 @@ +{ + fetchFromGitHub, + buildLua, +}: +buildLua { + pname = "pointer-event"; + version = "unstable"; + + src = fetchFromGitHub { + owner = "christoph-heinrich"; + repo = "mpv-pointer-event"; + rev = "33c5ede5977817596ace5a9942a8c801ad3b3d28"; + hash = "sha256-h2E8wiQX2Vh9qyi2VsXzeOE5vnD9Xin5HZ2Wu2LZUOY="; + }; +} diff --git a/home/mpv/scripts/touch-gestures.nix b/home/mpv/scripts/touch-gestures.nix new file mode 100644 index 0000000..ea689d8 --- /dev/null +++ b/home/mpv/scripts/touch-gestures.nix @@ -0,0 +1,15 @@ +{ + fetchFromGitHub, + buildLua, +}: +buildLua { + pname = "touch-gestures"; + version = "unstable"; + + src = fetchFromGitHub { + owner = "christoph-heinrich"; + repo = "mpv-touch-gestures"; + rev = "f4aa499f038997c1824ff3bfa64ee1d5438d72f2"; + hash = "sha256-gmo6sTwN85WS/+wtlylfI22LxyZH48DvXYP5JGCnyU4="; + }; +}