aboutsummaryrefslogtreecommitdiff
path: root/tests/modules/programs/waybar/settings-complex.nix
blob: 750e52f4581c72c3b5fbcf4d3fc968ff45796221 (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
{ config, lib, pkgs, ... }:

with lib;

let
  package = pkgs.writeScriptBin "dummy-waybar" "" // { outPath = "@waybar@"; };
in {
  config = {
    programs.waybar = {
      inherit package;
      enable = true;
      settings = [{
        layer = "top";
        position = "top";
        height = 30;
        output = [ "DP-1" ];
        modules-left = [ "sway/workspaces" "sway/mode" "custom/my-module" ];
        modules-center = [ "sway/window" ];
        modules-right = [
          "idle_inhibitor"
          "pulseaudio"
          "network"
          "cpu"
          "memory"
          "backlight"
          "tray"
          "battery"
          "clock"
        ];

        modules = {
          "sway/workspaces" = {
            disable-scroll = true;
            all-outputs = true;
          };
          "sway/mode" = { tooltip = false; };
          "sway/window" = { max-length = 120; };
          "idle_inhibitor" = { format = "{icon}"; };
          "custom/my-module" = {
            format = "hello from {}";
            exec = let
              dummyScript =
                pkgs.writeShellScriptBin "dummy" "echo within waybar" // {
                  outPath = "@dummy@";
                };
            in "${dummyScript}/bin/dummy";
          };
        };
      }];
    };

    nmt.script = ''
      assertPathNotExists home-files/.config/waybar/style.css
      assertFileContent \
        home-files/.config/waybar/config \
        ${./settings-complex-expected.json}
    '';
  };
}