aboutsummaryrefslogtreecommitdiff
path: root/modules/waybar.nix
blob: 6a54d0d193084433c3b09b4bc0ba4c18a859a02a (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
{ config, lib, pkgs, ... }:

let
  cfg = config.waybar;
in {
  options.waybar.enable = lib.mkEnableOption "Enable and configure Waybar";

  config = lib.mkIf cfg.enable {
    programs.waybar = {
      enable = true;
      settings = {
        mainBar = {
          height = 20;
          layer = "top";
          position = "bottom";
          tray = { spacing = 10; };
          modules-center = [ "sway/window" ];
          modules-left = [ "sway/workspaces" "sway/mode" ];
          modules-right = [
            "pulseaudio"
            "clock"
            "tray"
          ];
          clock = {
            format-alt = "{:%Y-%m-%d}";
            tooltip-format = "{:%Y-%m-%d | %H:%M}";
          };
          pulseaudio = {
            format = "{volume}% {icon} {format_source}";
            format-bluetooth = "{volume}% {icon} {format_source}";
            format-bluetooth-muted = " {icon} {format_source}";
            format-icons = {
              car = "";
              default = [ "" "" "" ];
              handsfree = "";
              headphones = "";
              headset = "";
              phone = "";
              portable = "";
            };
            format-muted = " {format_source}";
            format-source = "{volume}% ";
            format-source-muted = "";
            on-click = "pavucontrol";
          };
        };
      };
      style = ''
        * {
          border: none;
          border-radius: 0;
          font-family: monospace;
          font-size: 12px;
        }

        window#waybar {
          background: #000000;
        }

        #workspaces button {
          padding-left: 5px;
          padding-right: 5px;
        }

        #clock, #pulseaudio, #tray {
          padding-left: 5px;
          padding-right: 5px;
        }
      '';
    };
  };
}