* GNOME: Suggesting ‘guix gc’ upon low disk space
@ 2020-09-17 12:39 Ludovic Courtès
2020-09-18 11:54 ` Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2020-09-17 12:39 UTC (permalink / raw)
To: Guix Devel
[-- 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) {
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: GNOME: Suggesting ‘guix gc’ upon low disk space
2020-09-17 12:39 GNOME: Suggesting ‘guix gc’ upon low disk space Ludovic Courtès
@ 2020-09-18 11:54 ` Ludovic Courtès
2020-09-18 12:31 ` Ricardo Wurmus
0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2020-09-18 11:54 UTC (permalink / raw)
To: Guix Devel
[-- Attachment #1: Type: text/plain, Size: 101 bytes --]
Hi!
I found the answer to my questions soon after I sent my message, and
here’s the result:
[-- Attachment #2: GNOME low disk space notification --]
[-- Type: image/png, Size: 70843 bytes --]
[-- Attachment #3: Type: text/plain, Size: 576 bytes --]
Neat no? :-)
https://git.savannah.gnu.org/cgit/guix.git/commit/?id=98b89f432103b66efacee0bcba41a94148b8e870
I initially tested it in a VM but somehow ‘gsd-housekeeping’ doesn’t
trigger low disk space notification in VMs. So I reconfigured a
victim’s actual laptop, filled the disk, and waited for the
notification. (Worry not, I have since freed disk space and the victim
now has the status of happy user.)
Is there a way we could get the message of that button translated?
Or is the only way to do that to submit the patch upstream?
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GNOME: Suggesting ‘guix gc’ upon low disk space
2020-09-18 11:54 ` Ludovic Courtès
@ 2020-09-18 12:31 ` Ricardo Wurmus
2020-09-30 17:05 ` Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: Ricardo Wurmus @ 2020-09-18 12:31 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
Ludovic Courtès <ludo@gnu.org> writes:
> I found the answer to my questions soon after I sent my message, and
> here’s the result:
>
>
> Neat no? :-)
It’s very nice!
It never occurred to me to patch applications to do more useful things
in a Guix context, because we have always been rather conservative in
applying patches. But I think this is a good idea.
> I initially tested it in a VM but somehow ‘gsd-housekeeping’ doesn’t
> trigger low disk space notification in VMs. So I reconfigured a
> victim’s actual laptop, filled the disk, and waited for the
> notification. (Worry not, I have since freed disk space and the victim
> now has the status of happy user.)
Heh :)
> Is there a way we could get the message of that button translated?
> Or is the only way to do that to submit the patch upstream?
I don’t know the answer. If we submit the patch upstream, though, we’d
probably have to make it conditional, perhaps depending on the presence
of /gnu/store or something like that.
--
Ricardo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GNOME: Suggesting ‘guix gc’ upon low disk space
2020-09-18 12:31 ` Ricardo Wurmus
@ 2020-09-30 17:05 ` Ludovic Courtès
0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2020-09-30 17:05 UTC (permalink / raw)
To: Ricardo Wurmus; +Cc: guix-devel
Hello!
Ricardo Wurmus <rekado@elephly.net> skribis:
> It never occurred to me to patch applications to do more useful things
> in a Guix context, because we have always been rather conservative in
> applying patches. But I think this is a good idea.
Yes, it’s an exception to our zero-patch policy, but I think it’s worth
it.
> I don’t know the answer. If we submit the patch upstream, though, we’d
> probably have to make it conditional, perhaps depending on the presence
> of /gnu/store or something like that.
Yeah. It may be a hard sell, even within an #ifdef.
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-09-30 17:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-17 12:39 GNOME: Suggesting ‘guix gc’ upon low disk space Ludovic Courtès
2020-09-18 11:54 ` Ludovic Courtès
2020-09-18 12:31 ` Ricardo Wurmus
2020-09-30 17:05 ` Ludovic Courtès
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).