summary refs log tree commit diff
path: root/mixins/multimedia.nix
blob: 7dbe2db82c380f4eaad164b508aca6b95420daf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
{
  pkgs,
  lib,
  config,
  inputs,
  ...
}: {
  home-manager.users.tzlil = {
    home.packages = with pkgs; [
      ffmpeg
      gimp
      transmission
      xdg-utils
      xdg-user-dirs
    ];
    xdg = {
      enable = true;
      mime.enable = true;
      mimeApps = {
        enable = true;
        defaultApplications = {
          "application/pdf" = ["${pkgs.zathura}/share/applications/org.pwmt.zathura.desktop"];
          "image/png" = ["${pkgs.swayimg}/share/applications/swayimg.desktop"];
          "image/jpeg" = ["${pkgs.swayimg}/share/applications/swayimg.desktop"];
        };
        associations.added = config.home-manager.users.tzlil.xdg.mimeApps.defaultApplications;
      };
      userDirs = {
        createDirectories = true;
        desktop = "${config.home-manager.users.tzlil.home.homeDirectory}/desktop";
        download = "${config.home-manager.users.tzlil.home.homeDirectory}/downloads";
      };
      #portal = {
      #  enable = true;
      #  extraPortals = with pkgs; [
      #    xdg-desktop-portal-wlr
      #    xdg-desktop-portal-gtk
      #  ];
      #};
    };

    programs = {
      mpv = {
        enable = true;
        scripts = with pkgs.mpvScripts; [
          mpris
          thumbnail
          (pkgs.callPackage ./youtube-quality.nix {})
        ];
        config = {
          sub-auto = "fuzzy";
          ytdl-raw-options = "write-auto-sub=,sub-lang=en";
          profile = "gpu-hq";
          hwdec = "vdpau";
          screenshot-template = "%F - [%P]v%#01n";
          ytdl-format = "bestvideo[height<=?1080]+bestaudio/best";
        };
        bindings = {
          # yank video link
          "Shift+Y" = "run ${
            pkgs.writeShellScript "yank-mpv" "
          ${pkgs.wl-clipboard}/bin/wl-copy $1"
          } \${path}";
          # yank video link with timestamp
          "Ctrl+y" = "run ${pkgs.writeShellScript "yank-mpv-timestamp" "
          url=$1
          timepos=\${2%.*}
          url+=$([[ $1 = *\?* ]] && echo \\& || echo \\?)t=$(( timepos / 3600 ))h$(( timepos / 60 ))m$(( timepos % 60 ))s

          ${pkgs.wl-clipboard}/bin/wl-copy $url
          "} \${path} \${=time-pos}";
        };
      };
      zathura = {
        enable = true;
        options = {
          selection-clipboard = "clipboard";
          notification-error-bg = "#ff5555";
          notification-error-fg = "#f8f8f2";
          notification-warning-bg = "#ffb86c";
          notification-warning-fg = "#44475a";
          notification-bg = "#282a36";
          notification-fg = "#f8f8f2";
          completion-bg = "#282a36";
          completion-fg = "#6272a4";
          completion-group-bg = "#282a36";
          completion-group-fg = "#6272a4";
          completion-highlight-bg = "#44475a";
          completion-highlight-fg = "#f8f8f2";
          index-bg = "#282a36";
          index-fg = "#f8f8f2";
          index-active-bg = "#44475a";
          index-active-fg = "#f8f8f2";
          inputbar-bg = "#282a36";
          inputbar-fg = "#f8f8f2";
          statusbar-bg = "#282a36";
          statusbar-fg = "#f8f8f2";
          highlight-color = "#ffb86c";
          highlight-active-color = "#ff79c6";
          default-bg = "#282a36";
          default-fg = "#f8f8f2";
          render-loading = true;
          render-loading-fg = "#282a36";
          render-loading-bg = "#f8f8f2";
          recolor-lightcolor = "#282a36";
          recolor-darkcolor = "#f8f8f2";
          adjust-open = "width";
          recolor = true;
        };
      };
    };
  };
}