From ae65789fbd30d3991205e9d5ee542e8407202553 Mon Sep 17 00:00:00 2001 From: Boris Petrov Date: Mon, 2 Sep 2024 14:08:56 +0200 Subject: [PATCH] Add module for KRunner --- modules/default.nix | 1 + modules/krunner.nix | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 modules/krunner.nix diff --git a/modules/default.nix b/modules/default.nix index fc245a55..8b40fb37 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -8,6 +8,7 @@ ./fonts.nix ./hotkeys.nix ./input.nix + ./krunner.nix ./kscreenlocker.nix ./kwin.nix ./panels.nix diff --git a/modules/krunner.nix b/modules/krunner.nix new file mode 100644 index 00000000..2b60db26 --- /dev/null +++ b/modules/krunner.nix @@ -0,0 +1,43 @@ +{ config, lib, ... }: +let cfg = config.programs.plasma; +in with lib; { + options.programs.plasma.krunner = { + position = mkOption { + type = with types; nullOr (enum [ "Top" "Center" ]); + default = null; + example = "Center"; + description = "Position of KRunner on screen."; + }; + activateWhenTypingOnDesktop = mkOption { + type = with types; nullOr bool; + default = null; + description = "Activate KRunner when typing on the desktop."; + }; + historyBehavior = mkOption { + type = with types; + nullOr (enum [ "Disabled" "EnableSuggestions" "EnableAutoComplete" ]); + default = null; + example = "Disabled"; + description = "Behavior of KRunner’s history."; + }; + }; + + config.programs.plasma.configFile."krunnerrc" = (mkMerge [ + (mkIf (cfg.krunner.position != null) { + General.FreeFloating = cfg.krunner.position == "Center"; + }) + (mkIf (cfg.krunner.activateWhenTypingOnDesktop != null) { + General.ActivateWhenTypingOnDesktop = + cfg.krunner.activateWhenTypingOnDesktop; + }) + (mkIf (cfg.krunner.historyBehavior != null) { + General.historyBehavior = + (if cfg.krunner.historyBehavior == "EnableSuggestions" then + "CompletionSuggestion" + else if cfg.krunner.historyBehavior == "EnableAutoComplete" then + "ImmediateCompletion" + else + cfg.krunner.historyBehavior); + }) + ]); +}