From 91fb4f28ef5d87e8bcf7749928d30ba4a9cbbd34 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Sun, 19 Feb 2023 17:50:35 +0300 Subject: 2023-02-19 --- modules/common/mpv.nix | 135 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 modules/common/mpv.nix (limited to 'modules/common/mpv.nix') diff --git a/modules/common/mpv.nix b/modules/common/mpv.nix new file mode 100644 index 0000000..afab1dd --- /dev/null +++ b/modules/common/mpv.nix @@ -0,0 +1,135 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.nixfiles.modules.mpv; +in { + options.nixfiles.modules.mpv.enable = mkEnableOption "mpv"; + + config = mkIf cfg.enable { + hm.programs = { + mpv = { + enable = true; + + package = with pkgs; + wrapMpv mpv-unwrapped { + scripts = with mpvScripts; [ + autoload + mpv-autosub + sponsorblock + ]; + }; + + bindings = { + "RIGHT" = "seek 10"; + "LEFT" = "seek -10"; + "UP" = "seek 60"; + "DOWN" = "seek -60"; + + "Shift+RIGHT" = "no-osd seek 1 exact"; + "Shift+LEFT" = "no-osd seek -1 exact"; + "Shift+UP" = "no-osd seek 5 exact"; + "Shift+DOWN" = "no-osd seek -5 exact"; + + "Alt+k" = "add sub-scale +0.1"; + "Alt+j" = "add sub-scale -0.1"; + + "B" = ''cycle-values background "#000000" "#ffffff"''; + }; + + profiles = { + "protocol.http".force-window = "immediate"; + "protocol.https".profile = "protocol.http"; + }; + + config = let + lang = comcat [ + "Japanese" + "japanese" + "jp" + "jpn" + "jaJP" + "ja-JP" + "English" + "english" + "en" + "eng" + "enUS" + "en-US" + "Russian" + "russian" + "ru" + "rus" + "ruRU" + "ru-RU" + ]; + in { + audio-display = "no"; + autofit-larger = "100%x95%"; + cursor-autohide = 1000; + force-seekable = "no"; + fullscreen = true; + msg-color = true; + msg-module = true; + prefetch-playlist = true; + save-position-on-quit = false; + screenshot-format = "png"; + screenshot-template = "%F [%p]"; + stop-screensaver = true; + term-osd-bar = true; + use-filedir-conf = true; + + osd-bar-align-y = 0; + osd-bar-h = 2; + osd-bar-w = 60; + osd-border-color = "#FF262626"; + osd-border-size = 2.5; + osd-color = "#FFFFFFFF"; + osd-duration = 2500; + osd-font-size = 40; + osd-fractions = true; + osd-level = 1; + osd-shadow-color = "#33000000"; + + osc = false; + + sub-auto = "fuzzy"; + sub-file-paths-append = "srt"; + sub-ass-force-margins = true; + sub-ass-force-style = "kerning=yes"; + sub-fix-timing = true; + sub-use-margins = true; + sub-font-size = 40; + sub-color = "#FFFFFFFF"; + sub-border-color = "#FF262626"; + sub-border-size = 2.5; + sub-shadow-offset = 1; + sub-shadow-color = "#33000000"; + sub-spacing = 0.5; + blend-subtitles = true; + + audio-file-auto = "fuzzy"; + volume = 100; + volume-max = 200; + + alang = lang; + slang = lang; + + ytdl = true; + ytdl-raw-options = ''sub-lang="${lang}",write-sub=''; + }; + }; + + bash = { + shellAliases.cam = "${config.hm.programs.mpv.package}/bin/mpv av://v4l2:/dev/video0"; + + initExtra = mkAfter '' + _complete_alias cam _mpv mpv + ''; + }; + }; + }; +} -- cgit 1.4.1