Skip to content

Commit f3fbb50

Browse files
committed
polybar: add test case
1 parent a6657d6 commit f3fbb50

File tree

4 files changed

+71
-0
lines changed

4 files changed

+71
-0
lines changed

tests/default.nix

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import nmt {
5050
./modules/programs/firefox
5151
./modules/programs/getmail
5252
./modules/programs/rofi
53+
./modules/services/polybar
5354
./modules/services/sxhkd
5455
./modules/services/window-managers/i3
5556
./modules/systemd
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[bar/top]
2+
height=3%
3+
modules-center=date
4+
monitor=${env:MONITOR:eDP1}
5+
radius=0
6+
width=100%
7+
8+
[module/date]
9+
date=%d.%m.%y
10+
internal=5
11+
label=%time% %date%
12+
time=%H:%M
13+
type=internal/date
14+
15+
[module/date]
16+
type = internal/date
17+
interval = 5
18+
date = "%d.%m.%y"
19+
time = %H:%M
20+
format-prefix-foreground = ${colors.foreground-alt}
21+
label = %time% %date%
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{ config, pkgs, ... }:
2+
3+
{
4+
config = {
5+
services.polybar = {
6+
enable = true;
7+
package = pkgs.writeScriptBin "dummy-polybar" "";
8+
script = "polybar bar &";
9+
config = {
10+
"bar/top" = {
11+
monitor = "\${env:MONITOR:eDP1}";
12+
width = "100%";
13+
height = "3%";
14+
radius = 0;
15+
modules-center = "date";
16+
};
17+
"module/date" = {
18+
type = "internal/date";
19+
internal = 5;
20+
date = "%d.%m.%y";
21+
time = "%H:%M";
22+
label = "%time% %date%";
23+
};
24+
};
25+
extraConfig = ''
26+
[module/date]
27+
type = internal/date
28+
interval = 5
29+
date = "%d.%m.%y"
30+
time = %H:%M
31+
format-prefix-foreground = ''${colors.foreground-alt}
32+
label = %time% %date%
33+
'';
34+
};
35+
36+
nmt.script = ''
37+
local serviceFile=home-files/.config/systemd/user/polybar.service
38+
39+
assertFileExists $serviceFile
40+
assertFileRegex $serviceFile 'X-Restart-Triggers=.*polybar\.conf'
41+
assertFileRegex $serviceFile 'ExecStart=.*/bin/polybar-start'
42+
43+
assertFileExists home-files/.config/polybar/config
44+
assertFileContent home-files/.config/polybar/config \
45+
${./basic-configuration.conf}
46+
'';
47+
};
48+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ polybar-basic-configuration = ./basic-configuration.nix; }

0 commit comments

Comments
 (0)