From: "Ludovic Courtès" <ludovic.courtes@inria.fr>
To: Guix Devel <guix-devel@gnu.org>
Subject: GNOME: Suggesting ‘guix gc’ upon low disk space
Date: Thu, 17 Sep 2020 14:39:30 +0200 [thread overview]
Message-ID: <87y2l8shkt.fsf@inria.fr> (raw)
[-- Attachment #1: Type: text/plain, Size: 700 bytes --]
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’.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1272 bytes --]
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) {
next reply other threads:[~2020-09-17 12:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-17 12:39 Ludovic Courtès [this message]
2020-09-18 11:54 ` GNOME: Suggesting ‘guix gc’ upon low disk space Ludovic Courtès
2020-09-18 12:31 ` Ricardo Wurmus
2020-09-30 17:05 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y2l8shkt.fsf@inria.fr \
--to=ludovic.courtes@inria.fr \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).