plasma-manager/modules/krunner.nix
Heitor Augusto 6f1db348fc
Some checks failed
GitHub Pages Docs Generation / publish (ubuntu-latest) (push) Has been cancelled
Add treefmt for formatting and format everything (#370)
2024-09-22 12:57:32 -03:00

59 lines
1.6 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ config, lib, ... }:
let
cfg = config.programs.plasma;
in
{
options.programs.plasma.krunner = {
position = lib.mkOption {
type =
with lib.types;
nullOr (enum [
"top"
"center"
]);
default = null;
example = "center";
description = "Position of KRunner on screen.";
};
activateWhenTypingOnDesktop = lib.mkOption {
type = with lib.types; nullOr bool;
default = null;
example = true;
description = "Activate KRunner when typing on the desktop.";
};
historyBehavior = lib.mkOption {
type =
with lib.types;
nullOr (enum [
"disabled"
"enableSuggestions"
"enableAutoComplete"
]);
default = null;
example = "disabled";
description = "Behavior of KRunners history.";
};
};
config.programs.plasma.configFile."krunnerrc" = (
lib.mkMerge [
(lib.mkIf (cfg.krunner.position != null) {
General.FreeFloating = cfg.krunner.position == "center";
})
(lib.mkIf (cfg.krunner.activateWhenTypingOnDesktop != null) {
General.ActivateWhenTypingOnDesktop = cfg.krunner.activateWhenTypingOnDesktop;
})
(lib.mkIf (cfg.krunner.historyBehavior != null) {
General.historyBehavior = (
if cfg.krunner.historyBehavior == "enableSuggestions" then
"CompletionSuggestion"
else if cfg.krunner.historyBehavior == "enableAutoComplete" then
"ImmediateCompletion"
else
"Disabled"
);
})
]
);
}