about summary refs log tree commit diff
path: root/home/profiles/waybar.nix
blob: 4a313777707a0f1579f7f26236445ea4af70cdc9 (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
{ config, lib, pkgs, ... }:
{
  programs.waybar = {
    enable = true;
    systemd.enable = true;

    settings = [{
      layer = "bottom";
      height = 25;
      position = "top";
      margin-top = 0;
      margin-left = 0;
      margin-right = 0;
      margin-bottom = 0;
      modules-left = [ "sway/workspaces" "sway/mode" ];
      modules-right = [ "custom/systemd" "pulseaudio" "network" "battery" "clock" "tray" ];
      "sway/workspaces" = {
        format = "{name}";
        disable-scroll = true;
      };
      "sway/mode" = { format = "{}"; };
      tray = { spacing = 10; };
      clock = { format = "{: %a %b %d %R}"; };
      battery = {
        states = {
          warning = 30;
          critical = 15;
        };
        format = "bat:{capacity}%";
        tooltip = true;
        tooltip-format = "{timeTo} ({capacity}%)";
      };
      "custom/systemd" = {
        exec = "${pkgs.tools.waybar-systemd-units}/bin/waybar-systemd-units";
        format = "failed units: {}";
        return-type = "json";
        interval = 60;
      };
      pulseaudio = {
        format = "vol:{volume}%";
        format-bluetooth = "bt:{volume}%";
        format-bluetooth-muted = "bt:{volume}%";
        format-muted = "vol:{volume}%";
        on-click = "pavucontrol";
      };
      "network" = {
        format-wifi = "{essid}:{signalStrength}%";
        format-ethernet = "{ipaddr}/{cidr}";
        format-linked = "{ifname} (No IP)";
        format-disconnected = "network unavailable";
        format-alt = "{ifname}: {ipaddr}/{cidr}";
        tooltip = false;
      };
    }];
  };

  programs.waybar.style = pkgs.writeText "style.css" ''
    * {
      border-radius: 0;
      border: none;
      font-family: "Roboto Mono, Font Awesome 5 Free, Font Awesome 5 Brands, Arial, sans-serif";
      font-size: 15px;
      color: #C5C8C6;
      min-height: 24px;
    }
    window#waybar {
      background-color: #282A2E;
      color: #C5C8C6;
    }
    #window {
      font-weight: bold;
      font-family: "Roboto Mono, Font Awesome 5 Free, Font Awesome 5 Brands, Arial, sans-serif";
    }
    #workspaces button {
      padding: 0 5px;
      background-color: transparent;
      color: #C5C8C6;
    }
    #workspaces button.focused {
      background-color: #373B41;
      border-bottom: 2px solid #F0C674;
    }
    #clock,
    #battery,
    #network,
    #pulseaudio,
    #tray,
    #mode {
      padding: 0 6px;
      margin: 0 3px;
    }
    #battery.warning {
      border-bottom: 2px solid #efc673;
    }
    #battery.critical {
      border-bottom: 2px solid #ef8773;
    }
    #network {
      /* No styles */
    }
    #network.disconnected {
      color: #efc673;
    }
    #pulseaudio {
      /* No styles */
    }
    #pulseaudio.muted {
      color: #8c8f91;
    }
    #custom-systemd.errors {
      border-bottom: 2px solid #ef8773;
    }
  '';
}