about summary refs log tree commit diff
path: root/modules/common/mpv.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2023-11-23 04:20:34 +0300
committerAzat Bahawi <azat@bahawi.net>2023-11-23 04:20:34 +0300
commit67b82386d8ad8ae3eea5083bd22809f6192d92a8 (patch)
tree41829a0b3e05a9dbb4b0189e34a7b53e401f489e /modules/common/mpv.nix
parent2023-11-19 (diff)
2023-11-23
Diffstat (limited to '')
-rw-r--r--modules/common/mpv.nix252
1 files changed, 121 insertions, 131 deletions
diff --git a/modules/common/mpv.nix b/modules/common/mpv.nix
index 37fbe4c..596d163 100644
--- a/modules/common/mpv.nix
+++ b/modules/common/mpv.nix
@@ -10,143 +10,133 @@ 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
-              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+h" = "add sub-delay +1";
-          "Alt+l" = "add sub-delay -1";
-
-          "Alt+k" = "add sub-scale +0.1";
-          "Alt+j" = "add sub-scale -0.1";
-
-          "B" = ''cycle-values background "#000000" "#ffffff"'';
+    hm.programs.mpv = {
+      enable = true;
+
+      package = with pkgs;
+        wrapMpv mpv-unwrapped {
+          scripts = with mpvScripts; [
+            autoload
+            sponsorblock
+          ];
         };
 
-        profiles = {
-          "protocol.http".force-window = "immediate";
-          "protocol.https".profile = "protocol.http";
-
-          "extension.gif" = {
-            cache = false;
-            loop-file = true;
-          };
-          "extension.png" = {
-            profile = "extension.gif";
-            video-aspect-override = 0;
-          };
-          "extension.jpeg".profile = "extension.png";
-          "extension.jpg".profile = "extension.png";
-        };
+      bindings = {
+        "RIGHT" = "seek 10";
+        "LEFT" = "seek -10";
+        "UP" = "seek 60";
+        "DOWN" = "seek -60";
 
-        config = let
-          lang = concatStringsSep "," [
-            "Japanese"
-            "japanese"
-            "jp"
-            "jpn"
-            "jaJP"
-            "ja-JP"
-            "English"
-            "english"
-            "en"
-            "eng"
-            "enUS"
-            "en-US"
-            "Russian"
-            "russian"
-            "ru"
-            "rus"
-            "ruRU"
-            "ru-RU"
-          ];
-        in {
-          autofit-larger = "100%x95%";
-          cache = true;
-          cursor-autohide = 1000;
-          cursor-autohide-fs-only = true;
-          demuxer-max-back-bytes = "20M";
-          demuxer-max-bytes = "20M";
-          force-seekable = true;
-          fullscreen = true;
-          msg-color = true;
-          msg-module = true;
-          prefetch-playlist = true;
-          save-position-on-quit = true;
-          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;
-          osd-color = "#FFFFFFFF";
-          osd-duration = 1000;
-          osd-font-size = 40;
-          osd-fractions = true;
-          osd-level = 1;
-          osd-shadow-color = "#33000000";
-
-          osc = false;
-
-          blend-subtitles = true;
-          embeddedfonts = false;
-          sub-ass-force-margins = true;
-          sub-ass-force-style = "kerning=yes";
-          sub-auto = "fuzzy";
-          sub-border-color = "#FF262626";
-          sub-border-size = 2.5;
-          sub-color = "#FFFFFFFF";
-          sub-file-paths-append = "srt";
-          sub-fix-timing = true;
-          sub-font-size = 40;
-          sub-scale-with-window = true;
-          sub-shadow-color = "#33000000";
-          sub-shadow-offset = 1;
-          sub-spacing = 0.5;
-          sub-use-margins = true;
-
-          audio-file-auto = "fuzzy";
-          volume = 100;
-          volume-max = 200;
-
-          alang = lang;
-          slang = lang;
-
-          ytdl = true;
-          ytdl-raw-options = ''sub-lang="${lang}",write-sub='';
-        };
+        "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+h" = "add sub-delay +1";
+        "Alt+l" = "add sub-delay -1";
+
+        "Alt+k" = "add sub-scale +0.1";
+        "Alt+j" = "add sub-scale -0.1";
+
+        "B" = ''cycle-values background "#000000" "#ffffff"'';
       };
 
-      bash = {
-        shellAliases.cam = "mpv av://v4l2:/dev/video0";
+      profiles = {
+        "protocol.http".force-window = "immediate";
+        "protocol.https".profile = "protocol.http";
+
+        "extension.gif" = {
+          cache = false;
+          loop-file = true;
+        };
+        "extension.png" = {
+          profile = "extension.gif";
+          video-aspect-override = 0;
+        };
+        "extension.jpeg".profile = "extension.png";
+        "extension.jpg".profile = "extension.png";
+      };
 
-        initExtra = mkAfter ''
-          _complete_alias cam _mpv mpv
-        '';
+      config = let
+        lang = concatStringsSep "," [
+          "Japanese"
+          "japanese"
+          "jp"
+          "jpn"
+          "jaJP"
+          "ja-JP"
+          "English"
+          "english"
+          "en"
+          "eng"
+          "enUS"
+          "en-US"
+          "Russian"
+          "russian"
+          "ru"
+          "rus"
+          "ruRU"
+          "ru-RU"
+        ];
+      in {
+        autofit-larger = "100%x95%";
+        cache = true;
+        cursor-autohide = 1000;
+        cursor-autohide-fs-only = true;
+        demuxer-max-back-bytes = "20M";
+        demuxer-max-bytes = "20M";
+        force-seekable = true;
+        fullscreen = true;
+        msg-color = true;
+        msg-module = true;
+        prefetch-playlist = true;
+        save-position-on-quit = true;
+        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;
+        osd-color = "#FFFFFFFF";
+        osd-duration = 1000;
+        osd-font-size = 40;
+        osd-fractions = true;
+        osd-level = 1;
+        osd-shadow-color = "#33000000";
+
+        osc = false;
+
+        blend-subtitles = true;
+        embeddedfonts = false;
+        sub-ass-force-margins = true;
+        sub-ass-force-style = "kerning=yes";
+        sub-auto = "fuzzy";
+        sub-border-color = "#FF262626";
+        sub-border-size = 2.5;
+        sub-color = "#FFFFFFFF";
+        sub-file-paths-append = "srt";
+        sub-fix-timing = true;
+        sub-font-size = 40;
+        sub-scale-with-window = true;
+        sub-shadow-color = "#33000000";
+        sub-shadow-offset = 1;
+        sub-spacing = 0.5;
+        sub-use-margins = true;
+
+        audio-file-auto = "fuzzy";
+        volume = 100;
+        volume-max = 200;
+
+        alang = lang;
+        slang = lang;
+
+        ytdl = true;
+        ytdl-raw-options = ''sub-lang="${lang}",write-sub='';
       };
     };
   };

Consider giving Nix/NixOS a try! <3