parent
2a54c353a9
commit
f4f9f1a618
14 changed files with 688 additions and 0 deletions
80
tests/modules/programs/waybar/broken-settings.nix
Normal file
80
tests/modules/programs/waybar/broken-settings.nix
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
package = pkgs.writeScriptBin "dummy-waybar" "" // { outPath = "@waybar@"; };
|
||||
expected = pkgs.writeText "expected-json" ''
|
||||
[
|
||||
{
|
||||
"height": 26,
|
||||
"layer": "top",
|
||||
"modules-center": [
|
||||
"sway/window"
|
||||
],
|
||||
"modules-left": [
|
||||
"sway/workspaces",
|
||||
"sway/mode"
|
||||
],
|
||||
"modules-right": [
|
||||
"idle_inhibitor",
|
||||
"pulseaudio",
|
||||
"network",
|
||||
"cpu",
|
||||
"memory",
|
||||
"backlight",
|
||||
"tray",
|
||||
"clock"
|
||||
],
|
||||
"output": [
|
||||
"DP-1",
|
||||
"eDP-1",
|
||||
"HEADLESS-1"
|
||||
],
|
||||
"position": "top",
|
||||
"sway/workspaces": {
|
||||
"all-outputs": true
|
||||
}
|
||||
}
|
||||
]
|
||||
'';
|
||||
in {
|
||||
config = {
|
||||
programs.waybar = {
|
||||
inherit package;
|
||||
enable = true;
|
||||
systemd.enable = true;
|
||||
settings = [{
|
||||
layer = "top";
|
||||
position = "top";
|
||||
height = 26;
|
||||
output = [ "DP-1" "eDP-1" "HEADLESS-1" ];
|
||||
modules-left = [ "sway/workspaces" "sway/mode" ];
|
||||
modules-center = [ "sway/window" ];
|
||||
modules-right = [
|
||||
"idle_inhibitor"
|
||||
"pulseaudio"
|
||||
"network"
|
||||
"cpu"
|
||||
"memory"
|
||||
"backlight"
|
||||
"tray"
|
||||
"clock"
|
||||
];
|
||||
|
||||
modules = { "sway/workspaces".all-outputs = true; };
|
||||
}];
|
||||
};
|
||||
|
||||
nmt.description = ''
|
||||
Test for the broken configuration
|
||||
https://github.com/rycee/home-manager/pull/1329#issuecomment-653253069
|
||||
'';
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/waybar/style.css
|
||||
assertFileContent \
|
||||
home-files/.config/waybar/config \
|
||||
${expected}
|
||||
'';
|
||||
};
|
||||
}
|
||||
8
tests/modules/programs/waybar/default.nix
Normal file
8
tests/modules/programs/waybar/default.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
waybar-systemd-with-graphical-session-target =
|
||||
./systemd-with-graphical-session-target.nix;
|
||||
waybar-styling = ./styling.nix;
|
||||
waybar-settings-complex = ./settings-complex.nix;
|
||||
# Broken configuration from https://github.com/rycee/home-manager/pull/1329#issuecomment-653253069
|
||||
waybar-broken-settings = ./broken-settings.nix;
|
||||
}
|
||||
46
tests/modules/programs/waybar/settings-complex-expected.json
Normal file
46
tests/modules/programs/waybar/settings-complex-expected.json
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
[
|
||||
{
|
||||
"custom/my-module": {
|
||||
"exec": "@dummy@/bin/dummy",
|
||||
"format": "hello from {}"
|
||||
},
|
||||
"height": 30,
|
||||
"idle_inhibitor": {
|
||||
"format": "{icon}"
|
||||
},
|
||||
"layer": "top",
|
||||
"modules-center": [
|
||||
"sway/window"
|
||||
],
|
||||
"modules-left": [
|
||||
"sway/workspaces",
|
||||
"sway/mode",
|
||||
"custom/my-module"
|
||||
],
|
||||
"modules-right": [
|
||||
"idle_inhibitor",
|
||||
"pulseaudio",
|
||||
"network",
|
||||
"cpu",
|
||||
"memory",
|
||||
"backlight",
|
||||
"tray",
|
||||
"battery",
|
||||
"clock"
|
||||
],
|
||||
"output": [
|
||||
"DP-1"
|
||||
],
|
||||
"position": "top",
|
||||
"sway/mode": {
|
||||
"tooltip": false
|
||||
},
|
||||
"sway/window": {
|
||||
"max-length": 120
|
||||
},
|
||||
"sway/workspaces": {
|
||||
"all-outputs": true,
|
||||
"disable-scroll": true
|
||||
}
|
||||
}
|
||||
]
|
||||
59
tests/modules/programs/waybar/settings-complex.nix
Normal file
59
tests/modules/programs/waybar/settings-complex.nix
Normal file
|
|
@ -0,0 +1,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}
|
||||
'';
|
||||
};
|
||||
}
|
||||
23
tests/modules/programs/waybar/styling-expected.css
Normal file
23
tests/modules/programs/waybar/styling-expected.css
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
* {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
font-family: Source Code Pro;
|
||||
font-weight: bold;
|
||||
color: #abb2bf;
|
||||
font-size: 18px;
|
||||
min-height: 0px;
|
||||
}
|
||||
window#waybar {
|
||||
background: #16191C;
|
||||
color: #aab2bf;
|
||||
}
|
||||
#window {
|
||||
padding: 0 0px;
|
||||
}
|
||||
#workspaces button:hover {
|
||||
box-shadow: inherit;
|
||||
text-shadow: inherit;
|
||||
background: #16191C;
|
||||
border: #16191C;
|
||||
padding: 0 3px;
|
||||
}
|
||||
46
tests/modules/programs/waybar/styling.nix
Normal file
46
tests/modules/programs/waybar/styling.nix
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
package = pkgs.writeScriptBin "dummy-waybar" "" // { outPath = "@waybar@"; };
|
||||
in {
|
||||
config = {
|
||||
programs.waybar = {
|
||||
inherit package;
|
||||
enable = true;
|
||||
style = ''
|
||||
* {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
font-family: Source Code Pro;
|
||||
font-weight: bold;
|
||||
color: #abb2bf;
|
||||
font-size: 18px;
|
||||
min-height: 0px;
|
||||
}
|
||||
window#waybar {
|
||||
background: #16191C;
|
||||
color: #aab2bf;
|
||||
}
|
||||
#window {
|
||||
padding: 0 0px;
|
||||
}
|
||||
#workspaces button:hover {
|
||||
box-shadow: inherit;
|
||||
text-shadow: inherit;
|
||||
background: #16191C;
|
||||
border: #16191C;
|
||||
padding: 0 3px;
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/waybar/config
|
||||
assertFileContent \
|
||||
home-files/.config/waybar/style.css \
|
||||
${./styling-expected.css}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
package = pkgs.writeScriptBin "dummy-waybar" "" // { outPath = "@waybar@"; };
|
||||
in {
|
||||
config = {
|
||||
programs.waybar = {
|
||||
inherit package;
|
||||
enable = true;
|
||||
systemd.enable = true;
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/waybar/config
|
||||
assertPathNotExists home-files/.config/waybar/style.css
|
||||
|
||||
assertFileContent \
|
||||
home-files/.config/systemd/user/waybar.service \
|
||||
${./systemd-with-graphical-session-target.service}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
[Install]
|
||||
WantedBy=graphical-session.target
|
||||
|
||||
[Service]
|
||||
BusName=fr.arouillard.waybar
|
||||
ExecStart=@waybar@/bin/waybar
|
||||
Restart=always
|
||||
RestartSec=1sec
|
||||
Type=dbus
|
||||
|
||||
[Unit]
|
||||
After=dbus.service
|
||||
Description=Highly customizable Wayland bar for Sway and Wlroots based compositors.
|
||||
Documentation=https://github.com/Alexays/Waybar/wiki
|
||||
PartOf=graphical-session.target
|
||||
Requisite=dbus.service
|
||||
Loading…
Add table
Add a link
Reference in a new issue