summaryrefslogtreecommitdiffstats
path: root/usecases/desktop/music.nix
blob: 0f4d8838a587c38f0a61bf38e69d02ff2f14ad30 (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
_inputs:
{
  lib,
  pkgs,
  ...
}:
{
  users.extraUsers.minijackson.packages = [
    (pkgs.writeScriptBin "split-cue" (builtins.readFile ../../res/scripts/split-cue.sh))
  ];

  home-manager.users.minijackson =
    { config, ... }:
    {
      programs.beets = {
        enable = true;

        settings = {
          plugins = [
            "badfiles"
            "chroma"
            "convert"
            "edit"
            "export"
            "fetchart"
            "fromfilename"
            "lastgenre"
            "mbsubmit"
            "mbsync"
            "missing"
            "mpdupdate"
            "parentwork"
            "random"
            "the"
            "zero"
          ];
          lastgenre = {
            canonical = true;
            # High count due to canonicalization which removes fetched genres
            count = 6;
          };
          paths = {
            default = "%the{$albumartist}/%the{$album}%aunique{}/$track $title";
            singleton = "Non-Album/%the{$artist}/%the{$title}";
            comp = "Compilations/%the{$album}%aunique{}/$track $title";
          };
          zero.fields = "comments";
        };
      };

      wayland.windowManager.sway.config.keybindings =
        let
          inherit (config.wayland.windowManager.sway.config) modifier;
          playerctl = lib.getExe pkgs.playerctl;
        in
        lib.mkOptionDefault {
          "XF86AudioPlay" = "exec ${playerctl} play-pause";
          "XF86AudioPrev" = "exec ${playerctl} previous";
          "XF86AudioNext" = "exec ${playerctl} next";

          "${modifier}+KP_5" = "exec ${playerctl} play-pause";
          "${modifier}+KP_4" = "exec ${playerctl} previous";
          "${modifier}+KP_6" = "exec ${playerctl} next";
          "${modifier}+KP_8" = "exec ${playerctl} stop";
        };
    };
}