summaryrefslogtreecommitdiff
path: root/waybar.nix
blob: dfa6d8d91eab4409676b1695b0a6b6ccbfc37d2a (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
{
  pkgs,
  inputs,
  ...
}: let
  jsonFormat = pkgs.formats.json {};
in {
  xdg.configFile."waybar/config".source = jsonFormat.generate "config" {
    layer = "top";
    position = "left";
    "modules-left" = [
      "niri/workspaces"
      "niri/scratchpad"
    ];
    modules-center = [
      "niri/window"
    ];
    modules-right = [
      "wireplumber"
      "bluetooth"
      "temperature"
      "battery"
      "cpu"
      "memory"
      "clock#time"
      "clock#date"
      "tray"
    ];
    "clock#time" = {
      interval = 10;
      format = "{:%H\n%M}";
      tooltip = false;
    };
    "clock#date" = {
      interval = 20;
      format = "{:%d\n%m}";
      tooltip = false;
    };
    cpu = {
      "format" = "{usage}";
      "tooltip" = false;
    };
    memory = {
      "format" = "{:2}";
    };
    "temperature" = {
      "thermal-zone" = 2;
      "hwmon-path" = "/sys/class/hwmon/hwmon2/temp1_input";
      "critical-threshold" = 80;
      "format-icons" = [
        ""
        ""
        ""
        ""
        ""
      ];
      "format" = "{icon}";
      "on-click" = "ghostty -e btop";
    };
    "battery" = {
      "states" = {
        "warning" = 30;
        "critical" = 15;
      };
      "format" = "{icon}";
      "format-charging" = "󰂄";
      "format-plugged" = "{icon}";
      "format-alt" = "{capacity} {time} {icon}";
      "format-icons" = [
        "󰂎"
        "󰁺"
        "󰁻"
        "󰁼"
        "󰁽"
        "󰁾"
        "󰁿"
        "󰂀"
        "󰂁"
        "󰂂"
        "󰁹"
      ];
    };
    "wireplumber" = {
      "format" = "{icon}";
      "return-type" = "json";
      "signal" = 8;
      "interval" = "once";
      "format-icons" = {
        "mute" = "";
        "default" = [
          ""
          "󰖀"
          "󰕾"
        ];
      };
      "exec" = "pw-volume status";
      "on-click" = "pavucontrol";
    };
    "bluetooth" = {
      "format-on" = "󰂯";
      "format-off" = "󰂲";
      "format-disabled" = "";
      "format-connected" = "󰂱";
      "tooltip-format-connected" = "{device_enumerate}";
      "tooltip-format-enumerate-connected" = "{device_alias}\t{device_address}";
    };
    "niri/window" = {
      "format" = "{title}";
      "icon" = false;
      "max-length" = 300;
      "rotate" = 90;
    };
  };

  xdg.configFile."waybar/style.css".text = ''
    * {
        border: none;
        border-radius: 0;
        min-height: 0;
        margin: 0;
        padding: 0;
        box-shadow: none;
        text-shadow: none;
    }

    #waybar {
        font-family: iosevka;
    }

    #clock.time,
    #workspaces button.focused {
        color: white;
        background: black;
    }
  '';
}