feat(mpv): add touch and mouse gesture scripts

This commit is contained in:
matt1432 2023-12-16 21:14:33 -05:00
parent ae75463df5
commit 12cec706fa
4 changed files with 71 additions and 5 deletions

View file

@ -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;
};
};
};
}

View file

@ -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;
}

View file

@ -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=";
};
}

View file

@ -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=";
};
}