aboutsummaryrefslogtreecommitdiff
path: root/modules/user/desktop/components/waybar/default.nix
blob: 02747c4ed88355faac7db009472b457b605b14df (plain) (blame)
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
{
  config,
  lib,
  options,
  ...
}:
{
  options.desktop.components.waybar.enable = lib.mkEnableOption "waybar";
  config.programs.waybar = {
    enable = config.desktop.components.waybar.enable;
    settings = {
      main = {
        modules-left = [
          "sway/workspaces"
          "tray"
        ];

        modules-center = [ "clock" ];
        modules-right = [
          "backlight"
          "battery"
          "network"
          "wireplumber"
          "cpu"
          "memory"
        ];

        backlight = {
          format = "{icon}";
          format-icons = [
            ""
            "󰖨"
          ];

          tooltip-format = "{percent}%";
        };

        battery = {
          format = "{icon}";
          format-critical = "{icon} ({capacity}%)";
          format-icons = [
            ""
            ""
            ""
            ""
          ];

          format-time = "{H}h{m}m";
          format-warning = "{icon} ({capacity}%)";
          states = {
            critical = 15;
            warning = 25;
          };

          tooltip-format = "{time} remaining, {health}% battery health";
          tooltip-format-critical = "plug yo shit in NOW!!";
        };

        cpu.format = "{avg_frequency} GHz";
        clock = {
          format = "{:%A, %b %d %Y - %H:%M %Z}";
          # i am the time god. fear me.
          timezones = [
            "America/Toronto"
            "America/Vancouver"
            "America/Edmonton"
            "America/Regina"
            "America/Toronto" # duplicated so it appears in the list too
            "America/Halifax"
            "America/St_Johns"
            "America/Sao_Paulo"
            "Etc/UTC"
            "Australia/Perth"
          ];

          tooltip-format = "{tz_list}";
        };

        memory = {
          format = "{used}/{total} GiB";
          states = {
            critical = 90;
            warning = 70;
          };

          tooltip-format = "{percentage}% used";
        };

        network = {
          format-disabled = "󰀝";
          format-disconnected = "󰌙";
          format-ethernet = "󰌗 {ipaddr}/{cidr}";
          format-icons = [
            "󰤟"
            "󰤢"
            "󰤥"
            "󰤨"
          ];

          format-wifi = "{icon}";
          interval = 1;
          tooltip-format = "{ifname} tx: {bandwidthUpBytes} rx: {bandwidthDownBytes}";
          tooltip-format-wifi = ''
            <b>Network:</b> {essid}
            <b>{ifname}:</b> {ipaddr}/{cidr}
            <b>tx:</b> {bandwidthUpBytes}
            <b>rx:</b> {bandwidthDownBytes}
          '';
        };

        position = "bottom";
        "sway/workspaces" = {
          all-outputs = true;
          disable-scroll = true;
          format = "";
          persistent-workspaces = {
            "1" = [
              "DP-1"
              "eDP-1"
            ];

            "2" = [
              "DP-2"
              "eDP-1"
            ];

            "3" = [ ];
            "4" = [ ];
            "5" = [ ];
            "6" = [ ];
            "7" = [ ];
            "8" = [ ];
            "9" = [ ];
          };
        };

        wireplumber = {
          format = "{icon}";
          format-icons = [
            "󰕿"
            "󰖀"
            "󰕾"
          ];

          format-muted = "󰸈";
          on-click = "wpctl set-mute @DEFAULT_SINK@ toggle";
          tooltip-format = "{node_name} - {volume}%";
        };
      };
    };

    style = builtins.readFile ./style-${config.desktop.accent}.css;
  };
}