wofi: add module (#3786)

Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
Christoph Heiss 2023-04-20 08:11:30 +02:00 committed by GitHub
parent 571d0ed825
commit 5160039edc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 147 additions and 0 deletions

3
.github/CODEOWNERS vendored
View file

@ -355,6 +355,9 @@ Makefile @thiagokokada
/modules/programs/wezterm.nix @blmhemu
/tests/modules/programs/wezterm @blmhemu
/modules/programs/wofi.nix @christoph-heiss
/tests/modules/programs/wofi @christoph-heiss
/modules/programs/xmobar.nix @t4ccer
/tests/modules/programs/xmobar @t4ccer

View file

@ -197,6 +197,7 @@ let
./programs/waybar.nix
./programs/wezterm.nix
./programs/wlogout.nix
./programs/wofi.nix
./programs/xmobar.nix
./programs/yt-dlp.nix
./programs/z-lua.nix

76
modules/programs/wofi.nix Normal file
View 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; })
];
};
}

View file

@ -167,6 +167,7 @@ import nmt {
./modules/programs/thunderbird
./modules/programs/waybar
./modules/programs/wlogout
./modules/programs/wofi
./modules/programs/xmobar
./modules/programs/yt-dlp
./modules/services/avizo

View file

@ -0,0 +1,6 @@
# Generated by Home Manager.
drun-print_command=true
insensitive=true
show=drun
xoffset=50
yoffset=200

View 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}
'';
};
}

View file

@ -0,0 +1,6 @@
* {
font-family: monospace;
}
window {
background-color: #7c818c;
}

View file

@ -0,0 +1,4 @@
{
wofi-basic-configuration = ./basic-configuration.nix;
wofi-empty-configuration = ./empty-configuration.nix;
}

View 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
'';
};
}