Add anyrun config

This commit is contained in:
DashieTM 2024-09-08 14:44:27 +02:00
parent a3d3b15507
commit 3ac742cc45

View file

@ -8,13 +8,49 @@
}: }:
{ {
options.mods = { options.mods = {
hyprland.anyrun = { hyprland = {
anyrun = {
enable = lib.mkOption { enable = lib.mkOption {
default = true; default = true;
example = false; example = false;
type = lib.types.bool; type = lib.types.bool;
description = "Enables anyrun"; description = "Enables anyrun";
}; };
use_default_config = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = ''
Use preconfigured anyrun config.
'';
};
custom_config = lib.mkOption {
default = { };
example = { };
type = with lib.types; attrsOf anything;
description = ''
Custom anyrun configuration.
Will be merged with default configuration if enabled.
'';
};
use_default_css = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = ''
Use preconfigured anyrun css.
'';
};
custom_css = lib.mkOption {
default = { };
example = { };
type = with lib.types; attrsOf anything;
description = ''
Custom anyrun css.
Will be merged with default css if enabled.
'';
};
};
}; };
}; };
@ -22,7 +58,9 @@
lib.optionalAttrs (options ? programs.anyrun) { lib.optionalAttrs (options ? programs.anyrun) {
programs.anyrun = { programs.anyrun = {
enable = true; enable = true;
config = { config =
if config.mods.hyprland.anyrun.use_default_config then
{
plugins = [ plugins = [
inputs.anyrun.packages.${pkgs.system}.applications inputs.anyrun.packages.${pkgs.system}.applications
inputs.anyrun.packages.${pkgs.system}.rink inputs.anyrun.packages.${pkgs.system}.rink
@ -40,9 +78,14 @@
layer = "overlay"; layer = "overlay";
hidePluginInfo = true; hidePluginInfo = true;
closeOnClick = true; closeOnClick = true;
}; }
// config.mods.hyprland.anyrun.custom_config
else
config.mods.hyprland.anyrun.custom_config;
extraCss = '' extraCss =
if config.mods.hyprland.anyrun.use_default_css then
''
#window { #window {
border-radius: 10px; border-radius: 10px;
background-color: none; background-color: none;
@ -89,7 +132,10 @@
* { * {
border-radius: 10px; border-radius: 10px;
} }
''; ''
++ config.mods.hyprland.anyrun.custom_css
else
config.mods.hyprland.anyrun.custom_css;
}; };
} }
); );