Add anyrun config

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

View file

@ -8,12 +8,48 @@
}: }:
{ {
options.mods = { options.mods = {
hyprland.anyrun = { hyprland = {
enable = lib.mkOption { anyrun = {
default = true; enable = lib.mkOption {
example = false; default = true;
type = lib.types.bool; example = false;
description = "Enables anyrun"; type = lib.types.bool;
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,74 +58,84 @@
lib.optionalAttrs (options ? programs.anyrun) { lib.optionalAttrs (options ? programs.anyrun) {
programs.anyrun = { programs.anyrun = {
enable = true; enable = true;
config = { config =
plugins = [ if config.mods.hyprland.anyrun.use_default_config then
inputs.anyrun.packages.${pkgs.system}.applications {
inputs.anyrun.packages.${pkgs.system}.rink plugins = [
inputs.anyrun.packages.${pkgs.system}.translate inputs.anyrun.packages.${pkgs.system}.applications
inputs.anyrun.packages.${pkgs.system}.websearch inputs.anyrun.packages.${pkgs.system}.rink
]; inputs.anyrun.packages.${pkgs.system}.translate
#position = "center"; inputs.anyrun.packages.${pkgs.system}.websearch
hideIcons = false; ];
width = { #position = "center";
fraction = 0.3; hideIcons = false;
}; width = {
y = { fraction = 0.3;
fraction = 0.5; };
}; y = {
layer = "overlay"; fraction = 0.5;
hidePluginInfo = true; };
closeOnClick = true; layer = "overlay";
}; hidePluginInfo = true;
closeOnClick = true;
}
// config.mods.hyprland.anyrun.custom_config
else
config.mods.hyprland.anyrun.custom_config;
extraCss = '' extraCss =
#window { if config.mods.hyprland.anyrun.use_default_css then
border-radius: 10px; ''
background-color: none; #window {
} border-radius: 10px;
background-color: none;
}
box#main { box#main {
border-radius: 10px; border-radius: 10px;
} }
list#main { list#main {
border-radius: 10px; border-radius: 10px;
margin: 0px 10px 10px 10px; margin: 0px 10px 10px 10px;
} }
list#plugin { list#plugin {
border-radius: 10px; border-radius: 10px;
} }
list#match { list#match {
border-radius: 10px; border-radius: 10px;
} }
entry#entry { entry#entry {
border: none; border: none;
border-radius: 10px; border-radius: 10px;
margin: 10px 10px 0px 10px; margin: 10px 10px 0px 10px;
} }
label#match-desc { label#match-desc {
font-size: 12px; font-size: 12px;
border-radius: 10px; border-radius: 10px;
} }
label#match-title { label#match-title {
font-size: 12px; font-size: 12px;
border-radius: 10px; border-radius: 10px;
} }
label#plugin { label#plugin {
font-size: 16px; font-size: 16px;
border-radius: 10px; border-radius: 10px;
} }
* { * {
border-radius: 10px; border-radius: 10px;
} }
''; ''
++ config.mods.hyprland.anyrun.custom_css
else
config.mods.hyprland.anyrun.custom_css;
}; };
} }
); );