41 lines
1.1 KiB
Nix
41 lines
1.1 KiB
Nix
{ config, pkgs, ... }:
|
|
let
|
|
cleanup-launcher = pkgs.writeShellScriptBin "cleanup-sway-launcher" ''
|
|
HIST_FILE="''${XDG_CACHE_HOME:-$HOME/.cache}/.sway-launcher-desktop-wrapped-history.txt"
|
|
|
|
# Delete the history file to clear duplicates
|
|
if [[ -f "$HIST_FILE" ]]; then
|
|
rm "$HIST_FILE"
|
|
echo "Cleared sway-launcher history at $HIST_FILE"
|
|
fi
|
|
|
|
# Run purge to clean up any broken entries
|
|
${pkgs.sway-launcher-desktop}/bin/sway-launcher-desktop purge 2>/dev/null || true
|
|
|
|
echo "Sway launcher cleanup completed"
|
|
'';
|
|
in {
|
|
environment.systemPackages = [ cleanup-launcher ];
|
|
|
|
systemd.user.timers = {
|
|
cleanup-sway-launcher = {
|
|
description = "Clean up sway-launcher-desktop cache";
|
|
timerConfig = {
|
|
OnCalendar = "Sun 03:00";
|
|
Persistent = true;
|
|
};
|
|
wantedBy = [ "timers.target" ];
|
|
};
|
|
};
|
|
|
|
systemd.user.services = {
|
|
cleanup-sway-launcher = {
|
|
description = "Clean up sway-launcher-desktop cache and remove broken entries";
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
ExecStart = "${cleanup-launcher}/bin/cleanup-sway-launcher";
|
|
};
|
|
};
|
|
};
|
|
}
|