aboutsummaryrefslogtreecommitdiff
path: root/modules/hosts/desktop/waybar.nix
blob: 23b0f59a5fd6dd0e647d2c125f59b00843a4ba7b (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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
{
  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 = [ "sway/workspaces" ];
            modules-right = [
              "privacy"
              "tray"
              "battery"
              "pulseaudio"
              "network"
              "bluetooth"
              "clock"
            ];

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

            tray = {
              spacing = 10;
            };

            privacy = {
              icon-size = 16;
            };

            cpu = {
              format = "󰻠";
              tooltip = true;
            };

            memory = {
              format = "";
            };

            temperature = {
              critical-threshold = 80;
              format = "";
            };

            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}";
              tooltip = false;
            };

            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, #cpu, #memory, #temperature, #custom-expand, #group-expand {
                    padding-left: 10px;
                    padding-right: 10px;
                  }
        '';
      };
    };
  };
}