-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6cb0aed
commit 2936685
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ config, lib, ... }: | ||
let | ||
cfg = config.programs.plasma; | ||
in | ||
{ | ||
options.programs.plasma.session = { | ||
general = { | ||
askForConfirmationOnLogout = lib.mkOption { | ||
type = with lib.types; nullOr bool; | ||
default = null; | ||
example = true; | ||
description = "Whether to ask for confirmation when shutting down, restarting or logging out"; | ||
}; | ||
}; | ||
sessionRestore = { | ||
restoreOpenApplicationsOnLogin = | ||
let | ||
options = { | ||
onLastLogout = "restorePreviousLogout"; | ||
whenSessionWasManuallySaved = "restoreSavedSession"; | ||
startWithEmptySession = "emptySession"; | ||
}; | ||
in | ||
lib.mkOption { | ||
type = with lib.types; nullOr (enum (builtins.attrNames options)); | ||
default = null; | ||
example = "startWithEmptySession"; | ||
description = '' | ||
Controls how applications are restored on login: | ||
- "onLastLogout": Restores applications that were open during the last logout. | ||
- "whenSessionWasManuallySaved": Restores applications based on a manually saved session. | ||
- "startWithEmptySession": Starts with a clean, empty session each time. | ||
''; | ||
apply = option: if option == null then null else options.${option}; | ||
}; | ||
excludeApplications = lib.mkOption { | ||
type = with lib.types; nullOr (listOf str); | ||
default = null; | ||
example = [ | ||
"firefox" | ||
"xterm" | ||
]; | ||
description = "List of applications to exclude from session restore"; | ||
apply = apps: if apps == null then null else builtins.concatStringsSep "," apps; | ||
}; | ||
}; | ||
}; | ||
|
||
config.programs.plasma.configFile."ksmserverrc".General = lib.mkMerge [ | ||
(lib.mkIf (cfg.session.general.askForConfirmationOnLogout != null) { | ||
confirmLogout = cfg.session.general.askForConfirmationOnLogout; | ||
}) | ||
(lib.mkIf (cfg.session.sessionRestore.excludeApplications != null) { | ||
excludeApps = cfg.session.sessionRestore.excludeApplications; | ||
}) | ||
(lib.mkIf (cfg.session.sessionRestore.restoreOpenApplicationsOnLogin != null) { | ||
loginMode = cfg.session.sessionRestore.restoreOpenApplicationsOnLogin; | ||
}) | ||
]; | ||
} |