mirror of
https://github.com/nix-community/home-manager
synced 2024-12-26 11:49:47 +01:00
da92360208
Polybar's config format is a bit strange, and lists in particular are annoying to handle. This enables using normal nix lists and nested attrsets instead. This change is not backwards-compatible, because the INI converter converts lists of strings to space-separated values, and this does something else. I expect that this is only relevant for the `modules-left` etc bar setting, but that's enough to break things :(.
58 lines
1.6 KiB
Nix
58 lines
1.6 KiB
Nix
{ config, pkgs, ... }:
|
|
|
|
{
|
|
config = {
|
|
services.polybar = {
|
|
enable = true;
|
|
package = pkgs.writeScriptBin "dummy-polybar" "";
|
|
script = "polybar bar &";
|
|
config = {
|
|
"bar/top" = {
|
|
monitor = "\${env:MONITOR:eDP1}";
|
|
width = "100%";
|
|
height = "3%";
|
|
radius = 0;
|
|
modules-center = "date";
|
|
};
|
|
"module/date" = {
|
|
type = "internal/date";
|
|
internal = 5;
|
|
date = "%d.%m.%y";
|
|
time = "%H:%M";
|
|
label = "%time% %date%";
|
|
};
|
|
};
|
|
settings = {
|
|
"module/volume" = {
|
|
type = "internal/pulseaudio";
|
|
format.volume = "<ramp-volume> <label-volume>";
|
|
label.muted.text = "🔇";
|
|
label.muted.foreground = "#666";
|
|
ramp.volume = [ "🔈" "🔉" "🔊" ];
|
|
click.right = "pavucontrol &";
|
|
};
|
|
};
|
|
extraConfig = ''
|
|
[module/date]
|
|
type = internal/date
|
|
interval = 5
|
|
date = "%d.%m.%y"
|
|
time = %H:%M
|
|
format-prefix-foreground = ''${colors.foreground-alt}
|
|
label = %time% %date%
|
|
'';
|
|
};
|
|
|
|
nmt.script = ''
|
|
serviceFile=home-files/.config/systemd/user/polybar.service
|
|
|
|
assertFileExists $serviceFile
|
|
assertFileRegex $serviceFile 'X-Restart-Triggers=.*polybar\.conf'
|
|
assertFileRegex $serviceFile 'ExecStart=.*/bin/polybar-start'
|
|
|
|
assertFileExists home-files/.config/polybar/config
|
|
assertFileContent home-files/.config/polybar/config \
|
|
${./basic-configuration.conf}
|
|
'';
|
|
};
|
|
}
|