diff --git a/hosts/common/programs/mpv/default.nix b/hosts/common/programs/mpv/default.nix index f30f00bae..c0ddd0b0b 100644 --- a/hosts/common/programs/mpv/default.nix +++ b/hosts/common/programs/mpv/default.nix @@ -42,21 +42,6 @@ let cfg = config.sane.programs.mpv; uosc = pkgs.mpvScripts.uosc.overrideAttrs (upstream: { - version = "5.2.0-unstable-2024-03-13"; - src = lib.warnIf (lib.versionOlder "5.2.0" upstream.version) "uosc outdated; remove patch?" pkgs.fetchFromGitHub { - owner = "tomasklaen"; - repo = "uosc"; - rev = "6fa34c31d0a5290dee83282205768d15111df7d8"; - hash = "sha256-qxyNZHmH33bKRp4heFSC+RtvSApIfbVFt4otfS351nE="; - }; - # src = pkgs.fetchFromGitea { - # domain = "git.uninsane.org"; - # owner = "colin"; - # repo = "uosc"; - # rev = "dev-sane-5.2.0"; - # hash = "sha256-lpqk4nnCxDZr/Y7/seM4VyR30fVrDAT4VP7C8n88lvA="; - # }; - postPatch = (upstream.postPatch or "") + '' ### patch so touch controls work well with sway 1.9+ ### in particular, "mouse.hover" is *always* false for touch events (i guess this is a bug in mpv?) @@ -75,15 +60,13 @@ let cursor:move(mpos.x, mpos.y) cursor.hover_raw = mpos.hover" # 3. explicitly fire a cursor:leave on touch release, so that all zones are deactivated (and control visibility goes back to default state) - substituteInPlace src/uosc/lib/cursor.lua \ - --replace-fail \ - "cursor:create_handler('primary_up')" \ - "function(...) - cursor:trigger('primary_up', ...) - if not cursor.hover_raw then - cursor:leave() - end - end" + cat <> src/uosc/main.lua + cursor:on('primary_up', function(...) + if not cursor.hover_raw then + cursor:leave() + end + end) + EOF # 4. sometimes we get a touch movement shortly AFTER touch is released: # detect that and ignore it substituteInPlace src/uosc/lib/cursor.lua \ @@ -122,8 +105,8 @@ let # tweak the top-bar "maximize" button to actually act as a "fullscreen" button. substituteInPlace src/uosc/elements/TopBar.lua \ --replace-fail \ - 'get_maximized_command,' \ - '"cycle fullscreen",' + "mp.command(state.fullormaxed and 'set fullscreen no;set window-maximized no' or 'set window-maximized yes')" \ + "mp.command('cycle fullscreen')" ''; }); # visualizer = pkgs.mpvScripts.visualizer.overrideAttrs (upstream: {