Hello Guix! GNOME (actually ‘gnome-settings-daemon’) pops up a notification upon low disk space that looks like this:
Low Disk Space on “filesystem root” [ Empty Trash ] [ Examine ] The “Examine” button spawns the Disk Space Analyzer (aka Baobab) and the “Empty Trash” button does its thing. The untested patch below adds a ‘guix gc’ button, which is probably more important than the other two on Guix System. I’m not sure whether implementing it is as simple as this: is it OK to block during GC or should it be done in a separate process? If someone here has more insight or would like to give it a try, please let me know! Ludo’.
diff --git a/plugins/housekeeping/gsd-disk-space.c b/plugins/housekeeping/gsd-disk-space.c index bd3437e..870430b 100644 --- a/plugins/housekeeping/gsd-disk-space.c +++ b/plugins/housekeeping/gsd-disk-space.c @@ -546,6 +546,20 @@ empty_trash_callback (NotifyNotification *n, notify_notification_close (n, NULL); } +static void +guix_gc_callback (NotifyNotification *n, + const char *action) +{ + GDateTime *old; + + g_assert (action != NULL); + g_assert (strcmp (action, "run-guix-gc") == 0); + + system ("guix gc"); + + notify_notification_close (n, NULL); +} + static void on_notification_closed (NotifyNotification *n) { @@ -591,6 +605,13 @@ ldsm_notify (const char *summary, g_free); } + notify_notification_add_action (notification, + "run-guix-gc", + _("Collect Unused Guix Items"), + (NotifyActionCallback) guix_gc_callback, + NULL, + NULL); + has_trash = ldsm_mount_has_trash (mount_path); if (has_trash) {