From 8bd44fdba6aa7e40356ec9454afdaf4b69721abe Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Wed, 31 Jan 2024 02:11:55 +0100 Subject: [PATCH] fix anime4k --- flake.nix | 1 + users/pbsds/home/profiles/mpv.nix | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/flake.nix b/flake.nix index 632a0d1..067e3c8 100644 --- a/flake.nix +++ b/flake.nix @@ -252,6 +252,7 @@ nixosReports = mkHosts mkReport; packages = forAllSystems ({ inputs, pkgs, lib, flakes, ... }: { + # TODO: get faketty to work ${expect}/bin/unbuffer is bad nixos-rebuild-nom = pkgs.writeScriptBin "nixos-rebuild" '' exec ${lib.getExe pkgs.nixos-rebuild} "$@" |& ${lib.getExe pkgs.nix-output-monitor} ''; diff --git a/users/pbsds/home/profiles/mpv.nix b/users/pbsds/home/profiles/mpv.nix index b123508..c5555fe 100644 --- a/users/pbsds/home/profiles/mpv.nix +++ b/users/pbsds/home/profiles/mpv.nix @@ -1,9 +1,10 @@ -{ lib, pkgs, flakes, ... }: +{ lib, pkgs, ... }: let m = pkgs.mpvScripts; mu = pkgs.unstable.mpvScripts; - a4k = lib.mkIf (m ? anime4k); + anime4k = pkgs.anime4k or pkgs.unstable.anime4k or null; + a4k = lib.mkIf (anime4k != null); in { @@ -14,15 +15,18 @@ in programs.mpv.bindings."SHIFT+n" = "sub-seek -1"; programs.mpv.bindings."b" = ''cycle-values audio-channels 2 5 7 "auto"''; - # m.anime4k - from https://github.com/NixOS/nixpkgs/pull/273830 + # WeChip g20 voice remote + programs.mpv.bindings."homepage" = "cycle fullscreen"; + + # anime4k - from https://github.com/NixOS/nixpkgs/pull/273830 # TODO: add to home-manager? programs.mpv.bindings."CTRL+0" = a4k ''no-osd change-list glsl-shaders clr ""; show-text "GLSL shaders cleared"''; - programs.mpv.bindings."CTRL+1" = a4k ''no-osd change-list glsl-shaders set "${m.anime4k}/Anime4K_Clamp_Highlights.glsl:${m.anime4k}/Anime4K_Restore_CNN_VL.glsl:${m.anime4k}/Anime4K_Upscale_CNN_x2_VL.glsl:${m.anime4k}/Anime4K_AutoDownscalePre_x2.glsl:${m.anime4k}/Anime4K_AutoDownscalePre_x4.glsl:${m.anime4k}/Anime4K_Upscale_CNN_x2_M.glsl"; show-text "Anime4K: Mode A (HQ)"''; - programs.mpv.bindings."CTRL+2" = a4k ''no-osd change-list glsl-shaders set "${m.anime4k}/Anime4K_Clamp_Highlights.glsl:${m.anime4k}/Anime4K_Restore_CNN_Soft_VL.glsl:${m.anime4k}/Anime4K_Upscale_CNN_x2_VL.glsl:${m.anime4k}/Anime4K_AutoDownscalePre_x2.glsl:${m.anime4k}/Anime4K_AutoDownscalePre_x4.glsl:${m.anime4k}/Anime4K_Upscale_CNN_x2_M.glsl"; show-text "Anime4K: Mode B (HQ)"''; - programs.mpv.bindings."CTRL+3" = a4k ''no-osd change-list glsl-shaders set "${m.anime4k}/Anime4K_Clamp_Highlights.glsl:${m.anime4k}/Anime4K_Upscale_Denoise_CNN_x2_VL.glsl:${m.anime4k}/Anime4K_AutoDownscalePre_x2.glsl:${m.anime4k}/Anime4K_AutoDownscalePre_x4.glsl:${m.anime4k}/Anime4K_Upscale_CNN_x2_M.glsl"; show-text "Anime4K: Mode C (HQ)"''; - programs.mpv.bindings."CTRL+4" = a4k ''no-osd change-list glsl-shaders set "${m.anime4k}/Anime4K_Clamp_Highlights.glsl:${m.anime4k}/Anime4K_Restore_CNN_VL.glsl:${m.anime4k}/Anime4K_Upscale_CNN_x2_VL.glsl:${m.anime4k}/Anime4K_Restore_CNN_M.glsl:${m.anime4k}/Anime4K_AutoDownscalePre_x2.glsl:${m.anime4k}/Anime4K_AutoDownscalePre_x4.glsl:${m.anime4k}/Anime4K_Upscale_CNN_x2_M.glsl"; show-text "Anime4K: Mode A+A (HQ)"''; - programs.mpv.bindings."CTRL+5" = a4k ''no-osd change-list glsl-shaders set "${m.anime4k}/Anime4K_Clamp_Highlights.glsl:${m.anime4k}/Anime4K_Restore_CNN_Soft_VL.glsl:${m.anime4k}/Anime4K_Upscale_CNN_x2_VL.glsl:${m.anime4k}/Anime4K_AutoDownscalePre_x2.glsl:${m.anime4k}/Anime4K_AutoDownscalePre_x4.glsl:${m.anime4k}/Anime4K_Restore_CNN_Soft_M.glsl:${m.anime4k}/Anime4K_Upscale_CNN_x2_M.glsl"; show-text "Anime4K: Mode B+B (HQ)"''; - programs.mpv.bindings."CTRL+6" = a4k ''no-osd change-list glsl-shaders set "${m.anime4k}/Anime4K_Clamp_Highlights.glsl:${m.anime4k}/Anime4K_Upscale_Denoise_CNN_x2_VL.glsl:${m.anime4k}/Anime4K_AutoDownscalePre_x2.glsl:${m.anime4k}/Anime4K_AutoDownscalePre_x4.glsl:${m.anime4k}/Anime4K_Restore_CNN_M.glsl:${m.anime4k}/Anime4K_Upscale_CNN_x2_M.glsl"; show-text "Anime4K: Mode C+A (HQ)"''; + programs.mpv.bindings."CTRL+1" = a4k ''no-osd change-list glsl-shaders set "${anime4k}/Anime4K_Clamp_Highlights.glsl:${anime4k}/Anime4K_Restore_CNN_VL.glsl:${anime4k}/Anime4K_Upscale_CNN_x2_VL.glsl:${anime4k}/Anime4K_AutoDownscalePre_x2.glsl:${anime4k}/Anime4K_AutoDownscalePre_x4.glsl:${anime4k}/Anime4K_Upscale_CNN_x2_M.glsl"; show-text "Anime4K: Mode A (HQ)"''; + programs.mpv.bindings."CTRL+2" = a4k ''no-osd change-list glsl-shaders set "${anime4k}/Anime4K_Clamp_Highlights.glsl:${anime4k}/Anime4K_Restore_CNN_Soft_VL.glsl:${anime4k}/Anime4K_Upscale_CNN_x2_VL.glsl:${anime4k}/Anime4K_AutoDownscalePre_x2.glsl:${anime4k}/Anime4K_AutoDownscalePre_x4.glsl:${anime4k}/Anime4K_Upscale_CNN_x2_M.glsl"; show-text "Anime4K: Mode B (HQ)"''; + programs.mpv.bindings."CTRL+3" = a4k ''no-osd change-list glsl-shaders set "${anime4k}/Anime4K_Clamp_Highlights.glsl:${anime4k}/Anime4K_Upscale_Denoise_CNN_x2_VL.glsl:${anime4k}/Anime4K_AutoDownscalePre_x2.glsl:${anime4k}/Anime4K_AutoDownscalePre_x4.glsl:${anime4k}/Anime4K_Upscale_CNN_x2_M.glsl"; show-text "Anime4K: Mode C (HQ)"''; + programs.mpv.bindings."CTRL+4" = a4k ''no-osd change-list glsl-shaders set "${anime4k}/Anime4K_Clamp_Highlights.glsl:${anime4k}/Anime4K_Restore_CNN_VL.glsl:${anime4k}/Anime4K_Upscale_CNN_x2_VL.glsl:${anime4k}/Anime4K_Restore_CNN_M.glsl:${anime4k}/Anime4K_AutoDownscalePre_x2.glsl:${anime4k}/Anime4K_AutoDownscalePre_x4.glsl:${anime4k}/Anime4K_Upscale_CNN_x2_M.glsl"; show-text "Anime4K: Mode A+A (HQ)"''; + programs.mpv.bindings."CTRL+5" = a4k ''no-osd change-list glsl-shaders set "${anime4k}/Anime4K_Clamp_Highlights.glsl:${anime4k}/Anime4K_Restore_CNN_Soft_VL.glsl:${anime4k}/Anime4K_Upscale_CNN_x2_VL.glsl:${anime4k}/Anime4K_AutoDownscalePre_x2.glsl:${anime4k}/Anime4K_AutoDownscalePre_x4.glsl:${anime4k}/Anime4K_Restore_CNN_Soft_M.glsl:${anime4k}/Anime4K_Upscale_CNN_x2_M.glsl"; show-text "Anime4K: Mode B+B (HQ)"''; + programs.mpv.bindings."CTRL+6" = a4k ''no-osd change-list glsl-shaders set "${anime4k}/Anime4K_Clamp_Highlights.glsl:${anime4k}/Anime4K_Upscale_Denoise_CNN_x2_VL.glsl:${anime4k}/Anime4K_AutoDownscalePre_x2.glsl:${anime4k}/Anime4K_AutoDownscalePre_x4.glsl:${anime4k}/Anime4K_Restore_CNN_M.glsl:${anime4k}/Anime4K_Upscale_CNN_x2_M.glsl"; show-text "Anime4K: Mode C+A (HQ)"''; /**/ programs.mpv.scripts = [