mirror of
https://github.com/nix-community/home-manager
synced 2024-12-24 02:39:48 +01:00
yambar: add module
This commit is contained in:
parent
f2c5ba5e72
commit
5514ed3210
8 changed files with 130 additions and 0 deletions
|
@ -1642,6 +1642,20 @@ in {
|
|||
https://github.com/hyprwm/hyprpaper for more.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2024-05-10T21:28:38+00:00";
|
||||
condition = hostPlatform.isLinux;
|
||||
message = ''
|
||||
A new module is available: 'programs.yambar'.
|
||||
|
||||
Yambar is a lightweight and configurable status panel for X11 and
|
||||
Wayland, that goes to great lengths to be both CPU and battery
|
||||
efficient - polling is only done when absolutely necessary.
|
||||
|
||||
See https://codeberg.org/dnkl/yambar for more.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -254,6 +254,7 @@ let
|
|||
./programs/wpaperd.nix
|
||||
./programs/xmobar.nix
|
||||
./programs/xplr.nix
|
||||
./programs/yambar.nix
|
||||
./programs/yazi.nix
|
||||
./programs/yt-dlp.nix
|
||||
./programs/z-lua.nix
|
||||
|
|
55
modules/programs/yambar.nix
Normal file
55
modules/programs/yambar.nix
Normal file
|
@ -0,0 +1,55 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.yambar;
|
||||
yamlFormat = pkgs.formats.yaml { };
|
||||
|
||||
in {
|
||||
meta.maintainers = [ lib.maintainers.carpinchomug ];
|
||||
|
||||
options.programs.yambar = {
|
||||
enable = lib.mkEnableOption "Yambar";
|
||||
|
||||
package = lib.mkPackageOption pkgs "yambar" { };
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = yamlFormat.type;
|
||||
default = { };
|
||||
example = lib.literalExpression ''
|
||||
bar = {
|
||||
location = "top";
|
||||
height = 26;
|
||||
background = "00000066";
|
||||
|
||||
right = [
|
||||
{
|
||||
clock.content = [
|
||||
{
|
||||
string.text = "{time}";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
'';
|
||||
description = ''
|
||||
Configuration written to {file}`$XDG_CONFIG_HOME/yambar/config.yml`.
|
||||
See {manpage}`yambar(5)` for options.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
assertions = [
|
||||
(lib.hm.assertions.assertPlatform "programs.yambar" pkgs
|
||||
lib.platforms.linux)
|
||||
];
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile."yambar/config.yml" = lib.mkIf (cfg.settings != { }) {
|
||||
source = yamlFormat.generate "config.yml" cfg.settings;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -219,6 +219,7 @@ in import nmtSrc {
|
|||
./modules/programs/wofi
|
||||
./modules/programs/wpaperd
|
||||
./modules/programs/xmobar
|
||||
./modules/programs/yambar
|
||||
./modules/programs/yt-dlp
|
||||
./modules/services/activitywatch
|
||||
./modules/services/avizo
|
||||
|
|
4
tests/modules/programs/yambar/default.nix
Normal file
4
tests/modules/programs/yambar/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
yambar-empty-settings = ./empty-settings.nix;
|
||||
yambar-example-settings = ./example-settings.nix;
|
||||
}
|
11
tests/modules/programs/yambar/empty-settings.nix
Normal file
11
tests/modules/programs/yambar/empty-settings.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.yambar.enable = true;
|
||||
|
||||
test.stubs.yambar = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/yambar
|
||||
'';
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
bar:
|
||||
background: '00000066'
|
||||
height: 26
|
||||
location: top
|
||||
right:
|
||||
- clock:
|
||||
content:
|
||||
- string:
|
||||
text: '{time}'
|
35
tests/modules/programs/yambar/example-settings.nix
Normal file
35
tests/modules/programs/yambar/example-settings.nix
Normal file
|
@ -0,0 +1,35 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
programs.yambar = {
|
||||
enable = true;
|
||||
package = config.lib.test.mkStubPackage { };
|
||||
|
||||
settings = {
|
||||
bar = {
|
||||
location = "top";
|
||||
height = 26;
|
||||
background = "00000066";
|
||||
right = [{ clock.content = [{ string.text = "{time}"; }]; }];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent \
|
||||
home-files/.config/yambar/config.yml \
|
||||
${
|
||||
builtins.toFile "yambar-expected.yml" ''
|
||||
bar:
|
||||
background: '00000066'
|
||||
height: 26
|
||||
location: top
|
||||
right:
|
||||
- clock:
|
||||
content:
|
||||
- string:
|
||||
text: '{time}'
|
||||
''
|
||||
}
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue