summaryrefslogtreecommitdiff
path: root/lib/polybar.nix
blob: dc384f6c9b4fcc2bbaf1c4788b02cbd5f8716436 (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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# https://github.com/0x746866/dots/blob/master/polybar/config
{ pkgs, lib, ... }:
let
  inherit (import ./const.nix) fontSize homedir;
  inherit (import ./theme.nix { inherit pkgs lib; })
    colors theme;

  size-int = fontSize*2;
  size = toString size-int;

  bar-common = {
    background = colors."${theme}".background;
    foreground = colors."${theme}".foreground;

    font-0 = "FiraSans:size=${size};0";
    font-1 = "Font Awesome 5:pixelsize=${size};0";
    font-2 = "MaterialIcons:size=${size}:antialias=false;0";

    line-size = "${size}pt";
    border-size = "5pt";

    height = "${toString (size-int+14)}pt";
    width = "100%";
    radius = 6;
    padding-left = 0;
    padding-right = 1;
    module-margin = 1;

    enable-ipc = true;

    # these are deprecated, i need to rework this
    tray-background = colors."${theme}".background;
    tray-detached = false;
    tray-maxsize = size-int;
    tray-padding = 5;
    tray-scale = 1;
  };

in {
  services.polybar = {
    config = {
      "bar/perf" = bar-common // {
        modules-center = "date";
        modules-left = [ "eth" ];
        modules-right = [ "mem" "temp" ];
        radius = 0;
        separator = "|";
        tray-position = "right";
      };

      "bar/cpu" = bar-common // {
        modules-center = ["cpu"];
      };

      "bar/org" = bar-common // {
        modules-right = [ "date" ];
        modules-left = ["ewmh" ];
        radius = 0;
        separator = "|";
      };

      "module/ewmh" = {
        type = "internal/xworkspaces";
        label-active-foreground = "#fff";
      };

      "module/date" = {
        type = "internal/date";
        internal = 5;
        date = "%Y.%m.%d";
        time = "%H.%M";
        label = "%date%..%time%";
      };

      "module/battery" = {
        type = "internal/battery";
        battery = "BAT0";
        adapter = "AC";
        full-at = 99;
      };

      "module/volume-bar" = {
        type = "internal/alsa";
        master-soundcard = "hw:1";
        bar-volume-font = 2;
        bar-volume-width = 9;
        format-volume = "<label-volume><bar-volume>";
        label-volume = " .) ";
        label-muted = " .) mute";
        label-volume-foreground = colors.${theme}.foreground;
        format-muted-foreground = colors.${theme}.foreground;
        bar-volume-foreground-0 = colors.${theme}.foreground;
        bar-volume-foreground-1 = colors.${theme}.foreground;
        bar-volume-foreground-2 = colors.${theme}.foreground;
        bar-volume-foreground-3 = colors.${theme}.foreground;
        bar-volume-foreground-4 = colors.${theme}.foreground;
        bar-volume-foreground-5 = colors.${theme}.foreground;
        bar-volume-foreground-6 = colors.${theme}.foreground;
        bar-volume-gradient = true;
        bar-volume-indicator = "•";
        bar-volume-fill = "•";
        bar-volume-empty = "·";
        bar-volume-empty-foreground = colors.${theme}.foreground;
      };

      "network-base" = {
        type = "internal/network";
        interval = 5;
        format-connected = "<label-connected>";
        format-disconnected = "<label-disconnected>";
        label-disconnected = "%{F#F0C674}%ifname%%{F#707880} disconnected";
      };

      "module/eth" = {
        "inherit" = "network-base";
        interface-type = "wired";
        label-connected = "%{F#F0C674}%ifname%%{F-} %local_ip%";
        #label-connected = "eth up: %upspeed:9% down: %downspeed%";
        #label-disconnected = "no eth";
      };

      "module/wifi" = {
        type = "internal/network";
        interface = "wlan1";
        label-connected = "wifi up: %upspeed% down: %downspeed%";
        label-disconnected = "no wifi";
      };

      "module/cpu" = {
        type = "internal/cpu";
        interval = 3;
        format-padding = 1;
        format = "<label> <ramp-coreload>";
        label = " %percentage:2%%";
        ramp-coreload-0 = "▂";
        ramp-coreload-1 = "▃";
        ramp-coreload-2 = "▄";
        ramp-coreload-3 = "▅";
        ramp-coreload-4 = "▆";
        ramp-coreload-5 = "▇";
        ramp-coreload-0-foreground = colors.${theme}.foreground;
        ramp-coreload-1-foreground = colors.${theme}.foreground;
        ramp-coreload-2-foreground = colors.${theme}.foreground;
        ramp-coreload-3-foreground = colors.${theme}.foreground;
        ramp-coreload-4-foreground = colors.${theme}.foreground;
        ramp-coreload-5-foreground = colors.${theme}.highlight;
      };

      "module/temp" = {
        type = "internal/temperature";
        interval = 3;
        thermal-zone = 0;
        warn-temperature = 70;
        format = "<ramp> <label>";
        format-padding = 1;
        label = "%temperature-c%";
        ramp-0 = "_";
        ramp-1 = ".";
        ramp-2 = ":";
        ramp-3 = "|";
        ramp-4 = "!!";
        ramp-0-foreground = colors.${theme}.foreground;
        ramp-1-foreground = colors.${theme}.foreground;
        ramp-2-foreground = colors.${theme}.foreground;
        ramp-3-foreground = colors.${theme}.foreground;
        ramp-4-foreground = colors.${theme}.highlight;
        format-warn = "<label-warn>";
        label-warn = "  %temperature-c%";
        label-warn-padding = 1;
        label-warn-foreground = colors.${theme}.highlight;
      };

      "module/mem" = {
        type = "internal/memory";
        interval = 3;
        format = "<label>";
        label-padding = 1;
        label = " |[ %percentage_used%% ]|";
      };

    };
  };
}