From 98b89f432103b66efacee0bcba41a94148b8e870 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 18 Sep 2020 00:04:49 +0200 Subject: gnu: gnome-settings-daemon: Add "guix gc" to low disk space notification. * gnu/packages/patches/gnome-settings-daemon-gc.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/gnome.scm (gnome-settings-daemon)[source]: Use it. --- .../patches/gnome-settings-daemon-gc.patch | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 gnu/packages/patches/gnome-settings-daemon-gc.patch (limited to 'gnu/packages/patches/gnome-settings-daemon-gc.patch') diff --git a/gnu/packages/patches/gnome-settings-daemon-gc.patch b/gnu/packages/patches/gnome-settings-daemon-gc.patch new file mode 100644 index 0000000000..688544b418 --- /dev/null +++ b/gnu/packages/patches/gnome-settings-daemon-gc.patch @@ -0,0 +1,43 @@ +This patch adds a "guix gc" button to the low disk space notification +that 'gsd-housekeeping' emits. + +diff --git a/plugins/housekeeping/gsd-disk-space.c b/plugins/housekeeping/gsd-disk-space.c +index bd3437e..89027d8 100644 +--- a/plugins/housekeeping/gsd-disk-space.c ++++ b/plugins/housekeeping/gsd-disk-space.c +@@ -546,6 +546,21 @@ empty_trash_callback (NotifyNotification *n, + notify_notification_close (n, NULL); + } + ++static void ++guix_gc_callback (NotifyNotification *n, ++ const char *action) ++{ ++ const gchar *argv[] = { "guix", "gc", NULL }; ++ ++ g_assert (action != NULL); ++ g_assert (strcmp (action, "run-guix-gc") == 0); ++ ++ g_spawn_async (NULL, (gchar **) argv, NULL, G_SPAWN_SEARCH_PATH, ++ NULL, NULL, NULL, NULL); ++ ++ notify_notification_close (n, NULL); ++} ++ + static void + on_notification_closed (NotifyNotification *n) + { +@@ -591,6 +606,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) { -- cgit v1.2.3