aboutsummaryrefslogtreecommitdiff
path: root/modules/hosts/desktop/waybar.nix
blob: aebc0f7f6cb02ed310e20cba2bca9411f4bfd61a (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
114
115
116
117
118
119
{
  config,
  lib,
  username,
  ...
}:

let
  inherit (lib) mkEnableOption mkIf;
  cfg = config.nx.desktop.waybar;
in
{
  options.nx.desktop.waybar.enable = mkEnableOption "Enable and configure Waybar";

  config = mkIf cfg.enable {
    home-manager.users.${username} = {
      programs.waybar = {
        enable = true;
        settings = {
          mainBar = {
            height = 32;
            layer = "top";
            position = "bottom";
            modules-center = [ "mpris" ];
            modules-left = [ "wlr/workspaces" ];
            modules-right = [
              "privacy"
              "tray"
              "battery"
              "pulseaudio"
              "network"
              "bluetooth"
              "clock"
            ];

            mpris = {
              format = "{title}";
              tooltip-format = "{artist} - {album}";
            };

            tray = {
              spacing = 10;
            };

            privacy = {
              icon-size = 16;
            };

            network = {
              format-disconnect = "󰌙";
              format-ethernet = "󰌘";
              format-wifi = "{icon}";
              format-icons = [
                "󰤟"
                "󰤢"
                "󰤥"
                "󰤨"
              ];
              tooltip-format-wifi = "{essid} | {signalStrength}%";
              tooltip-format-ethernet = "{ifname}";
            };

            bluetooth = {
              format = " {status}";
              format-disabled = "";
              format-no-controller = "";
              format-connected = " {device_alias}";
            };

            clock = {
              format-alt = "{:%Y-%m-%d}";
              tooltip-format = "{:%Y-%m-%d | %H:%M}";
            };

            pulseaudio = {
              format = "{icon}";
              format-icons = {
                default = [
                  ""
                  ""
                  ""
                ];
              };
              tooltip-format = "{desc} | {volume}%";
            };
          };
        };

        style = ''
          * {
            border: none;
            border-radius: 0;
            font-family: monospace;
            font-size: 12px;
            background: none;
          }

          window#waybar {
            background: rgba(0, 0, 0, 0.9);
          }

          #workspaces button {
            padding-left: 5px;
            padding-right: 5px;
          }

          #workspaces button.focused {
            font-weight: bold;
          }

          #clock, #pulseaudio, #tray, #network, #battery, #bluetooth {
            padding-left: 10px;
            padding-right: 10px;
          }
        '';
      };
    };
  };
}