aboutsummaryrefslogtreecommitdiff
path: root/users/tdback/modules/polybar/default.nix
blob: 833a260ae21da003c7c9e5dbce4c953e845ea73f (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
{ lib, pkgs, ... }:
{
  services.polybar = {
    enable = true;
    package = pkgs.polybar.override { pulseSupport = true; };
    script = "polybar main &";
    settings =
      let
        colors = {
          alert = "#505050";
          foreground = "#F1F1F1";
          background = "#050505";
          background-alt = "#373B41";
        };
      in
      {
        "bar/main" = {
          bottom = true;
          width = "100%";
          height = "16pt";
          line.size = "3pt";
          font = [ "Iosevka Comfy Motion Fixed:size=8" ];

          foreground = "${colors.foreground}";
          background = "${colors.background}";

          separator = "|";
          padding = {
            left = 1;
            right = 1;
          };

          module.margin = 1;
          modules = {
            left = "bspwm";
            center = "time";
            right = "volume cpu memory date";
          };

          wm.restack = "bspwm";
          cursor.click = "pointer";
        };

        "module/bspwm" = {
          type = "internal/bspwm";
          pin.workspaces = true;
          label = {
            focused = {
              text = "%index%";
              foreground = "${colors.foreground}";
              padding = 1;
            };
            occupied = {
              text = "%index%";
              foreground = "${colors.alert}";
              padding = 1;
            };
            urgent = {
              text = "%index%";
              foreground = "${colors.foreground}";
              background = "${colors.background-alt}";
              padding = 1;
            };
            empty.text = "";
          };
        };

        "module/cpu" = {
          type = "internal/cpu";
          interval = 3;
          label = "CPU %percentage%%";
        };

        "module/memory" = {
          type = "internal/memory";
          interval = 3;
          label = "RAM %percentage_used%%";
        };

        "module/volume" = {
          type = "internal/pulseaudio";
          label = {
            volume = "VOL %percentage%%";
            muted = "VOL 0%";
          };
          click.right = "${lib.getExe pkgs.pavucontrol}";
        };

        "module/time" = {
          type = "internal/date";
          interval = 1;
          label = "%time%";
          time = "%H:%M";
        };

        "module/date" = {
          type = "internal/date";
          interval = 1;
          label = "%date%";
          date = "%m.%d.%Y";
        };

        "settings" = {
          screenchange.reload = true;
          pseudo.transparency = true;
        };
      };
  };

  # Make sure polybar starts only during graphical sessions.
  systemd.user.services.polybar.Install.WantedBy = [ "graphical-session.target" ];
}