mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 14:40:29 +00:00
wofi: add module (#3786)
Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
parent
571d0ed825
commit
5160039edc
9 changed files with 147 additions and 0 deletions
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
|
@ -355,6 +355,9 @@ Makefile @thiagokokada
|
||||||
/modules/programs/wezterm.nix @blmhemu
|
/modules/programs/wezterm.nix @blmhemu
|
||||||
/tests/modules/programs/wezterm @blmhemu
|
/tests/modules/programs/wezterm @blmhemu
|
||||||
|
|
||||||
|
/modules/programs/wofi.nix @christoph-heiss
|
||||||
|
/tests/modules/programs/wofi @christoph-heiss
|
||||||
|
|
||||||
/modules/programs/xmobar.nix @t4ccer
|
/modules/programs/xmobar.nix @t4ccer
|
||||||
/tests/modules/programs/xmobar @t4ccer
|
/tests/modules/programs/xmobar @t4ccer
|
||||||
|
|
||||||
|
|
|
@ -197,6 +197,7 @@ let
|
||||||
./programs/waybar.nix
|
./programs/waybar.nix
|
||||||
./programs/wezterm.nix
|
./programs/wezterm.nix
|
||||||
./programs/wlogout.nix
|
./programs/wlogout.nix
|
||||||
|
./programs/wofi.nix
|
||||||
./programs/xmobar.nix
|
./programs/xmobar.nix
|
||||||
./programs/yt-dlp.nix
|
./programs/yt-dlp.nix
|
||||||
./programs/z-lua.nix
|
./programs/z-lua.nix
|
||||||
|
|
76
modules/programs/wofi.nix
Normal file
76
modules/programs/wofi.nix
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.programs.wofi;
|
||||||
|
|
||||||
|
toConfig = attrs:
|
||||||
|
''
|
||||||
|
# Generated by Home Manager.
|
||||||
|
'' + generators.toKeyValue { }
|
||||||
|
(filterAttrs (name: value: value != null) attrs);
|
||||||
|
in {
|
||||||
|
meta.maintainers = [ maintainers.christoph-heiss ];
|
||||||
|
|
||||||
|
options.programs.wofi = {
|
||||||
|
enable = mkEnableOption
|
||||||
|
"wofi: a launcher/menu program for wlroots based wayland compositors such as sway";
|
||||||
|
|
||||||
|
package = mkPackageOption pkgs "wofi" { };
|
||||||
|
|
||||||
|
settings = mkOption {
|
||||||
|
default = { };
|
||||||
|
type = types.attrs;
|
||||||
|
description = ''
|
||||||
|
Configuration options for wofi. See
|
||||||
|
<citerefentry>
|
||||||
|
<refentrytitle>wofi</refentrytitle>
|
||||||
|
<manvolnum>5</manvolnum>
|
||||||
|
</citerefentry>.
|
||||||
|
'';
|
||||||
|
example = literalExpression ''
|
||||||
|
{
|
||||||
|
location = "bottom-right";
|
||||||
|
allow_markup = true;
|
||||||
|
width = 250;
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
style = mkOption {
|
||||||
|
default = null;
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
description = ''
|
||||||
|
CSS style for wofi to use as a stylesheet. See
|
||||||
|
<citerefentry>
|
||||||
|
<refentrytitle>wofi</refentrytitle>
|
||||||
|
<manvolnum>7</manvolnum>
|
||||||
|
</citerefentry>.
|
||||||
|
'';
|
||||||
|
example = ''
|
||||||
|
* {
|
||||||
|
font-family: monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
window {
|
||||||
|
background-color: #7c818c;
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
assertions =
|
||||||
|
[ (hm.assertions.assertPlatform "programs.wofi" pkgs platforms.linux) ];
|
||||||
|
|
||||||
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
|
xdg.configFile = mkMerge [
|
||||||
|
(mkIf (cfg.settings != { }) {
|
||||||
|
"wofi/config".text = toConfig cfg.settings;
|
||||||
|
})
|
||||||
|
(mkIf (cfg.style != null) { "wofi/style.css".text = cfg.style; })
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
|
@ -167,6 +167,7 @@ import nmt {
|
||||||
./modules/programs/thunderbird
|
./modules/programs/thunderbird
|
||||||
./modules/programs/waybar
|
./modules/programs/waybar
|
||||||
./modules/programs/wlogout
|
./modules/programs/wlogout
|
||||||
|
./modules/programs/wofi
|
||||||
./modules/programs/xmobar
|
./modules/programs/xmobar
|
||||||
./modules/programs/yt-dlp
|
./modules/programs/yt-dlp
|
||||||
./modules/services/avizo
|
./modules/services/avizo
|
||||||
|
|
6
tests/modules/programs/wofi/basic-configuration.conf
Normal file
6
tests/modules/programs/wofi/basic-configuration.conf
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# Generated by Home Manager.
|
||||||
|
drun-print_command=true
|
||||||
|
insensitive=true
|
||||||
|
show=drun
|
||||||
|
xoffset=50
|
||||||
|
yoffset=200
|
35
tests/modules/programs/wofi/basic-configuration.nix
Normal file
35
tests/modules/programs/wofi/basic-configuration.nix
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
config = {
|
||||||
|
programs.wofi = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.writeScriptBin "dummy-wofi" "";
|
||||||
|
style = ''
|
||||||
|
* {
|
||||||
|
font-family: monospace;
|
||||||
|
}
|
||||||
|
window {
|
||||||
|
background-color: #7c818c;
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
settings = {
|
||||||
|
drun-print_command = true;
|
||||||
|
insensitive = true;
|
||||||
|
show = "drun";
|
||||||
|
xoffset = 50;
|
||||||
|
yoffset = 200;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.config/wofi/config
|
||||||
|
assertFileContent home-files/.config/wofi/config \
|
||||||
|
${./basic-configuration.conf}
|
||||||
|
|
||||||
|
assertFileExists home-files/.config/wofi/style.css
|
||||||
|
assertFileContent home-files/.config/wofi/style.css \
|
||||||
|
${./basic-style.css}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
6
tests/modules/programs/wofi/basic-style.css
Normal file
6
tests/modules/programs/wofi/basic-style.css
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
* {
|
||||||
|
font-family: monospace;
|
||||||
|
}
|
||||||
|
window {
|
||||||
|
background-color: #7c818c;
|
||||||
|
}
|
4
tests/modules/programs/wofi/default.nix
Normal file
4
tests/modules/programs/wofi/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
wofi-basic-configuration = ./basic-configuration.nix;
|
||||||
|
wofi-empty-configuration = ./empty-configuration.nix;
|
||||||
|
}
|
15
tests/modules/programs/wofi/empty-configuration.nix
Normal file
15
tests/modules/programs/wofi/empty-configuration.nix
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
config = {
|
||||||
|
programs.wofi = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.writeScriptBin "dummy-wofi" "";
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertPathNotExists home-files/.config/wofi/config
|
||||||
|
assertPathNotExists home-files/.config/wofi/style.css
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue