mirror of
https://github.com/nix-community/plasma-manager.git
synced 2024-11-30 01:39:16 +03:00
Fix problem with startup-scripts when using overrideConfig option (#67)
This commit is contained in:
parent
91b5335d43
commit
290cd65b65
@ -75,12 +75,23 @@ let
|
||||
"plasmashellrc"
|
||||
"systemsettingsrc"
|
||||
];
|
||||
|
||||
# Creates command to remove file iff the file is present
|
||||
removeFileIfExistsCmd = f: "if [ -f ${f} ]; then rm ${f}; fi";
|
||||
# Here cfg should be sent in with programs.plasma when called.
|
||||
createResetScript = cfg: pkgs.writeScript "reset-plasma-config"
|
||||
(builtins.concatStringsSep
|
||||
"\n"
|
||||
(map (e: "if [ -f ${config.xdg.configHome}/${e} ]; then rm ${config.xdg.configHome}/${e}; fi")
|
||||
(lib.lists.subtractLists cfg.overrideConfigExclude cfg.overrideConfigFiles)));
|
||||
((map removeFileIfExistsCmd
|
||||
# The files in overrideConfigFiles are in XDG_CONFIG_HOME, so we need to
|
||||
# add this to the names to get the full path
|
||||
(map (f: "${config.xdg.configHome}/${f}") (lib.lists.subtractLists cfg.overrideConfigExclude cfg.overrideConfigFiles)))
|
||||
# Some of the startup-scripts may keep track of when they were last ran
|
||||
# in order to only run once for each generation. These files start with
|
||||
# last_run and is located in $XDG_DATA_HOME/plasma-manager. When we
|
||||
# reset all the other config-files these startup-scripts should be
|
||||
# re-ran, so we delete these files to ensure they are.
|
||||
++ [ "for file in ${config.xdg.dataHome}/plasma-manager/last_run*; do ${removeFileIfExistsCmd "$file"}; done" ]));
|
||||
in
|
||||
{
|
||||
options.programs.plasma = {
|
||||
@ -145,7 +156,7 @@ in
|
||||
config = lib.mkIf (plasmaCfg.enable && (builtins.length (builtins.attrNames cfg) > 0)) {
|
||||
home.activation.configure-plasma = (lib.hm.dag.entryAfter [ "writeBoundary" ]
|
||||
''
|
||||
$DRY_RUN_CMD ${if config.programs.plasma.overrideConfig then (createResetScript config.programs.plasma) else ""}
|
||||
$DRY_RUN_CMD ${if plasmaCfg.overrideConfig then (createResetScript plasmaCfg) else ""}
|
||||
$DRY_RUN_CMD ${script}
|
||||
'');
|
||||
};
|
||||
|
@ -181,7 +181,7 @@ in
|
||||
text = ''
|
||||
layout_file="${config.xdg.dataHome}/plasma-manager/${cfg.startup.dataDir}/layout.js"
|
||||
last_update=$(stat -c %Y $layout_file)
|
||||
last_update_file=${config.xdg.dataHome}/plasma-manager/last_update_layouts
|
||||
last_update_file=${config.xdg.dataHome}/plasma-manager/last_run_layouts
|
||||
stored_last_update=0
|
||||
if [ -f "$last_update_file" ]; then
|
||||
stored_last_update=$(cat "$last_update_file")
|
||||
|
@ -105,7 +105,7 @@ in
|
||||
programs.plasma.startup.autoStartScript."apply_themes" = {
|
||||
text = ''
|
||||
last_update=$(stat -c %Y "$0")
|
||||
last_update_file=${config.xdg.dataHome}/plasma-manager/last_update
|
||||
last_update_file=${config.xdg.dataHome}/plasma-manager/last_run_themes
|
||||
stored_last_update=0
|
||||
if [ -f "$last_update_file" ]; then
|
||||
stored_last_update=$(cat "$last_update_file")
|
||||
|
Loading…
Reference in New Issue
Block a user