Codebergdnkl

foot

master
ply6 git calls28 ms35 KiB5 cachedprotocol v2
794 lines24 KiBRaw
1#include "notify.h"
3#include <errno.h>
4#include <stdlib.h>
5#include <string.h>
6#include <unistd.h>
8#include <sys/epoll.h>
9#include <sys/stat.h>
10#include <fcntl.h>
12#define LOG_MODULE "notify"
13#define LOG_ENABLE_DBG 0
14#include "log.h"
15#include "config.h"
16#include "spawn.h"
17#include "terminal.h"
18#include "util.h"
19#include "wayland.h"
20#include "xmalloc.h"
21#include "xsnprintf.h"
23void
24notify_free(struct terminal *term, struct notification *notif)
26 if (notif->pid > 0)
27 fdm_del(term->fdm, notif->stdout_fd);
29 free(notif->id);
30 free(notif->title);
31 free(notif->body);
32 free(notif->category);
33 free(notif->app_id);
34 free(notif->icon_cache_id);
35 free(notif->icon_symbolic_name);
36 free(notif->icon_data);
37 free(notif->sound_name);
38 free(notif->xdg_token);
39 free(notif->stdout_data);
41 tll_free_and_free(notif->actions, free);
43 if (notif->icon_path != NULL) {
44 unlink(notif->icon_path);
45 free(notif->icon_path);
47 if (notif->icon_fd >= 0)
48 close(notif->icon_fd);
49 }
51 memset(notif, 0, sizeof(*notif));
54static bool
55write_icon_file(const void *data, size_t data_sz, int *fd, char **filename,
56 char **symbolic_name)
58 xassert(*filename == NULL);
59 xassert(*symbolic_name == NULL);
61 char name[64] = "/tmp/foot-notification-icon-XXXXXX";
63 *filename = NULL;
64 *symbolic_name = NULL;
65 *fd = mkostemp(name, O_CLOEXEC);
67 if (*fd < 0) {
68 LOG_ERRNO("failed to create temporary file for icon cache");
69 return false;
70 }
72 if (write(*fd, data, data_sz) != (ssize_t)data_sz) {
73 LOG_ERRNO("failed to write icon data to temporary file");
74 close(*fd);
75 *fd = -1;
76 return false;
77 }
79 LOG_DBG("wrote icon data to %s", name);
80 *filename = xstrdup(name);
81 *symbolic_name = xstrjoin("file://", *filename);
82 return true;
85static bool
86to_integer(const char *line, size_t len, uint32_t *res)
88 bool is_id = true;
89 uint32_t maybe_id = 0;
91 for (size_t i = 0; i < len; i++) {
92 char digit = line[i];
93 if (digit < '0' || digit > '9') {
94 is_id = false;
95 break;
96 }
98 maybe_id *= 10;
99 maybe_id += digit - '0';
100 }
102 *res = maybe_id;
103 return is_id;
106static void
107consume_stdout(struct notification *notif, bool eof)
109 char *data = notif->stdout_data;
110 const char *line = data;
111 size_t left = notif->stdout_sz;
113 /* Process stdout, line-by-line */
114 while (left > 0) {
115 line = data;
116 size_t len = left;
117 char *eol = (char *)memchr(line, '\n', left);
119 if (eol != NULL) {
120 *eol = '\0';
121 len = strlen(line);
122 data = eol + 1;
123 } else if (!eof)
124 break;
126 uint32_t maybe_id = 0;
127 uint32_t maybe_button_nr = 0;
129 /* Check for daemon assigned ID, either '123', or 'id=123' */
130 if ((notif->external_id == 0 && to_integer(line, len, &maybe_id)) ||
131 (len > 3 && memcmp(line, "id=", 3) == 0 &&
132 to_integer(&line[3], len - 3, &maybe_id)))
133 {
134 notif->external_id = maybe_id;
135 LOG_DBG("external ID: %u", notif->external_id);
136 }
138 /* Check for triggered action, either 'default' or 'action=default' */
139 else if ((len == 7 && memcmp(line, "default", 7) == 0) ||
140 (len == 7 + 7 && memcmp(line, "action=default", 7 + 7) == 0))
141 {
142 notif->activated = true;
143 LOG_DBG("notification's default action was triggered");
144 }
146 else if (len > 7 && memcmp(line, "action=", 7) == 0) {
147 notif->activated = true;
149 if (to_integer(&line[7], len - 7, &maybe_button_nr)) {
150 notif->activated_button = maybe_button_nr;
151 LOG_DBG("custom action %u triggered", notif->activated_button);
152 } else {
153 LOG_DBG("unrecognized action triggered: %.*s",
154 (int)(len - 7), &line[7]);
155 }
156 }
158 else if (notif->external_id > 0 &&
159 to_integer(line, len, &maybe_button_nr) &&
160 maybe_button_nr > 0 &&
161 maybe_button_nr <= notif->button_count)
162 {
163 /* Single integer, appearing *after* the ID, and is within
164 the custom button/action range */
165 notif->activated = true;
166 notif->activated_button = maybe_button_nr;
167 LOG_DBG("custom action %u triggered", notif->activated_button);
168 }
170 /* Check for XDG activation token, 'xdgtoken=xyz' */
171 else if (len > 9 && memcmp(line, "xdgtoken=", 9) == 0) {
172 notif->xdg_token = xstrndup(&line[9], len - 9);
173 LOG_DBG("XDG token: \"%s\"", notif->xdg_token);
174 }
176 left -= len + (eol != NULL ? 1 : 0);
177 }
179 if (left > 0)
180 memmove(notif->stdout_data, data, left);
182 notif->stdout_sz = left;
185static bool
186fdm_notify_stdout(struct fdm *fdm, int fd, int events, void *data)
188 const struct terminal *term = data;
189 struct notification *notif = NULL;
191 /* Find notification */
192 tll_foreach(term->active_notifications, it) {
193 if (it->item.stdout_fd == fd) {
194 notif = &it->item;
195 break;
196 }
197 }
199 if (events & EPOLLIN) {
200 char buf[512];
201 ssize_t count = read(fd, buf, sizeof(buf) - 1);
203 if (count < 0) {
204 if (errno == EINTR)
205 return true;
207 LOG_ERRNO("failed to read notification activation token");
208 return false;
209 }
211 if (count > 0 && notif != NULL) {
212 if (notif->stdout_data == NULL) {
213 xassert(notif->stdout_sz == 0);
214 notif->stdout_data = xmemdup(buf, count);
215 } else {
216 notif->stdout_data = xrealloc(notif->stdout_data, notif->stdout_sz + count);
217 memcpy(&notif->stdout_data[notif->stdout_sz], buf, count);
218 }
220 notif->stdout_sz += count;
221 consume_stdout(notif, false);
222 }
223 }
225 if (events & EPOLLHUP) {
226 fdm_del(fdm, fd);
227 if (notif != NULL) {
228 notif->stdout_fd = -1;
229 consume_stdout(notif, true);
230 }
231 }
233 return true;
236struct done_context {
237 struct wayland *wayl;
238 struct terminal *term;
239};
241static void
242notif_done(struct reaper *reaper, pid_t pid, int status, void *data)
244 struct done_context *ctx = data;
245 const struct wayland *wayl = ctx->wayl;
246 const struct terminal *wanted_term = ctx->term;
247 free(ctx);
249 struct terminal *term = NULL;
250 tll_foreach(wayl->terms, it) {
251 if (it->item == wanted_term) {
252 term = it->item;
253 break;
254 }
255 }
257 if (term == NULL) {
258 LOG_WARN("notification closed, but the associated terminal instance is already gone");
259 return;
260 }
262 tll_foreach(term->active_notifications, it) {
263 struct notification *notif = &it->item;
264 if (notif->pid != pid)
265 continue;
267 LOG_DBG("notification %s closed",
268 notif->id != NULL ? notif->id : "<unset>");
270 if (notif->activated && notif->focus) {
271 if (notif->xdg_token == NULL) {
272 /* No token so request our own and let the compositor decide focus vs. urgency */
273 LOG_DBG("set window urgency on notification activation (no XDG token available)");
274 if (!wayl_win_set_urgent(term->window))
275 LOG_WARN("cannot focus window: no activation token available");
276 } else {
277 LOG_DBG("focus window on notification activation: \"%s\"",
278 notif->xdg_token);
279 wayl_activate(term->wl, term->window, notif->xdg_token);
280 }
281 }
283 if (notif->activated && notif->report_activated) {
284 LOG_DBG("sending notification activation event to client");
286 const char *id = notif->id != NULL ? notif->id : "0";
288 char button_nr[16] = {0};
289 if (notif->activated_button > 0) {
290 xsnprintf(
291 button_nr, sizeof(button_nr), "%u", notif->activated_button);
292 }
294 char reply[7 + strlen(id) + 1 + strlen(button_nr) + 2 + 1];
295 size_t n = xsnprintf(
296 reply, sizeof(reply), "\033]99;i=%s;%s\033\\", id, button_nr);
297 term_to_slave(term, reply, n);
298 }
300 if (notif->report_closed) {
301 LOG_DBG("sending notification close event to client");
303 const char *id = notif->id != NULL ? notif->id : "0";
304 char reply[7 + strlen(id) + 1 + 7 + 1 + 2 + 1];
305 size_t n = xsnprintf(
306 reply, sizeof(reply), "\033]99;i=%s:p=close;\033\\", id);
307 term_to_slave(term, reply, n);
308 }
310 notify_free(term, notif);
311 tll_remove(term->active_notifications, it);
312 return;
313 }
316static bool
317expand_action_to_argv(struct terminal *term, const char *name, const char *label,
318 size_t *argc, char ***argv)
320 char **expanded = NULL;
321 size_t count = 0;
323 if (!spawn_expand_template(
324 &term->conf->desktop_notifications.command_action_arg, 2,
325 (const char *[]){"action-name", "action-label"},
326 (const char *[]){name, label},
327 &count, &expanded))
328 {
329 return false;
330 }
332 /* Append to the "global" actions argv */
333 *argv = xrealloc(*argv, (*argc + count) * sizeof((*argv)[0]));
334 memcpy(&(*argv)[*argc], expanded, count * sizeof(expanded[0]));
335 *argc += count;
337 free(expanded);
338 return true;
341bool
342notify_notify(struct terminal *term, struct notification *notif)
344 xassert(notif->xdg_token == NULL);
345 xassert(notif->external_id == 0);
346 xassert(notif->pid == 0);
347 xassert(notif->stdout_fd <= 0);
348 xassert(notif->stdout_data == NULL);
349 xassert(notif->icon_path == NULL);
350 xassert(notif->icon_fd <= 0);
352 notif->pid = -1;
353 notif->stdout_fd = -1;
354 notif->icon_fd = -1;
356 if (term->conf->desktop_notifications.command.argv.args == NULL)
357 return false;
359 if ((term->conf->desktop_notifications.inhibit_when_focused ||
360 notif->when != NOTIFY_ALWAYS)
361 && term->kbd_focus)
362 {
363 /* No notifications while we're focused */
364 return false;
365 }
367 const char *app_id = notif->app_id != NULL
368 ? notif->app_id
369 : term->app_id != NULL
370 ? term->app_id
371 : term->conf->app_id;
372 const char *title = notif->title != NULL ? notif->title : notif->body;
373 const char *body = notif->title != NULL && notif->body != NULL ? notif->body : "";
375 /* Icon: symbolic name if present, otherwise a filename */
376 const char *icon_name_or_path = "";
378 if (notif->icon_cache_id != NULL) {
379 for (size_t i = 0; i < ALEN(term->notification_icons); i++) {
380 const struct notification_icon *icon = &term->notification_icons[i];
382 if (icon->id != NULL && streq(icon->id, notif->icon_cache_id)) {
383 /* For now, we set the symbolic name to 'file:///path'
384 * when using a file based icon. */
385 xassert(icon->symbolic_name != NULL);
386 icon_name_or_path = icon->symbolic_name;
388 LOG_DBG("using icon from cache (cache ID: %s): %s",
389 icon->id, icon_name_or_path);
390 break;
391 }
392 }
393 } else if (notif->icon_symbolic_name != NULL) {
394 icon_name_or_path = notif->icon_symbolic_name;
395 LOG_DBG("using symbolic icon from notification: %s", icon_name_or_path);
396 } else if (notif->icon_data_sz > 0) {
397 xassert(notif->icon_data != NULL);
399 if (write_icon_file(
400 notif->icon_data, notif->icon_data_sz,
401 &notif->icon_fd,
402 &notif->icon_path,
403 &notif->icon_symbolic_name))
404 icon_name_or_path = notif->icon_symbolic_name;
406 LOG_DBG("using icon data from notification: %s", icon_name_or_path);
407 }
409 bool track_notification = notif->focus ||
410 notif->report_activated ||
411 notif->may_be_programatically_closed;
413 uint32_t replaces_id = 0;
414 if (notif->id != NULL) {
415 tll_foreach(term->active_notifications, it) {
416 struct notification *existing = &it->item;
418 if (existing->id == NULL)
419 continue;
421 /*
422 * When replacing/updating a notification, we may have
423 * *multiple* notification helpers running for the "same"
424 * notification. Make sure only the *last* notification's
425 * report closed/activated are honored, to avoid sending
426 * multiple reports.
427 *
428 * This also means we cannot 'break' out of the loop - we
429 * must check *all* notifications.
430 */
431 if (existing->external_id != 0 && streq(existing->id, notif->id)) {
432 replaces_id = existing->external_id;
433 existing->report_activated = false;
434 existing->report_closed = false;
435 }
436 }
437 }
439 char replaces_id_str[16];
440 xsnprintf(replaces_id_str, sizeof(replaces_id_str), "%u", replaces_id);
442 const char *urgency_str =
443 notif->urgency == NOTIFY_URGENCY_LOW
444 ? "low"
445 : notif->urgency == NOTIFY_URGENCY_NORMAL
446 ? "normal" : "critical";
448 LOG_DBG("notify: title=\"%s\", body=\"%s\", app-id=\"%s\", category=\"%s\", "
449 "urgency=\"%s\", icon=\"%s\", expires=%d, replaces=%u, muted=%s, "
450 "sound-name=%s (tracking: %s)",
451 title, body, app_id, notif->category, urgency_str, icon_name_or_path,
452 notif->expire_time, replaces_id,
453 notif->muted ? "yes" : "no", notif->sound_name,
454 track_notification ? "yes" : "no");
456 xassert(title != NULL);
457 if (title == NULL)
458 return false;
460 char **argv = NULL;
461 size_t argc = 0;
462 char **action_argv = NULL;
463 size_t action_argc = 0;
465 char expire_time[16];
466 xsnprintf(expire_time, sizeof(expire_time), "%d", notif->expire_time);
468 if (term->conf->desktop_notifications.command_action_arg.argv.args) {
469 if (!expand_action_to_argv(
470 term, "default", "Activate", &action_argc, &action_argv))
471 {
472 return false;
473 }
475 size_t action_idx = 1;
476 tll_foreach(notif->actions, it) {
478 /* Custom actions use a numerical name, starting at 1 */
479 char name[16];
480 xsnprintf(name, sizeof(name), "%zu", action_idx++);
482 if (!expand_action_to_argv(
483 term, name, it->item, &action_argc, &action_argv))
484 {
485 for (size_t i = 0; i < action_argc; i++)
486 free(action_argv[i]);
487 free(action_argv);
488 return false;
489 }
490 }
491 }
493 if (!spawn_expand_template(
494 &term->conf->desktop_notifications.command, 12,
495 (const char *[]){
496 "app-id", "window-title", "icon", "title", "body", "category",
497 "urgency", "muted", "sound-name", "expire-time", "replace-id",
498 "action-argument"},
499 (const char *[]){
500 app_id, term->window_title, icon_name_or_path, title,
501 body != NULL ? body : "",
502 notif->category != NULL ? notif->category : "", urgency_str,
503 notif->muted ? "true" : "false",
504 notif->sound_name != NULL ? notif->sound_name : "",
505 expire_time, replaces_id_str,
507 /* Custom expansion below, since we need to expand to multiple arguments */
508 "${action-argument}"},
509 &argc, &argv))
510 {
511 return false;
512 }
514 /* Post-process the expanded argv, and patch in all the --action
515 arguments we expanded earlier */
516 for (size_t i = 0; i < argc; i++) {
517 if (!streq(argv[i], "${action-argument}"))
518 continue;
520 if (action_argc == 0) {
521 free(argv[i]);
523 /* Remove ${command-argument}, but include terminating NULL */
524 memmove(&argv[i], &argv[i + 1], (argc - i) * sizeof(argv[0]));
525 argc--;
526 break;
527 }
529 /* Remove the "${action-argument}" entry, add all actions argument
530 from earlier, but include terminating NULL */
531 argv = xrealloc(argv, (argc + action_argc) * sizeof(argv[0]));
533 /* Move remaining arguments to after the action arguments */
534 memmove(&argv[i + action_argc],
535 &argv[i + 1],
536 (argc - i) * sizeof(argv[0])); /* Include terminating NULL */
538 free(argv[i]); /* Free xstrdup("${action-argument}"); */
540 /* Insert the action arguments */
541 for (size_t j = 0; j < action_argc; j++) {
542 argv[i + j] = action_argv[j];
543 action_argv[j] = NULL;
544 }
546 argc += action_argc;
547 argc--; /* The ${action-argument} option has been removed */
548 break;
549 }
551 LOG_DBG("notify command:");
552 for (size_t i = 0; i < argc; i++)
553 LOG_DBG(" argv[%zu] = \"%s\"", i, argv[i]);
554 xassert(argv[argc] == NULL);
556 int stdout_fds[2] = {-1, -1};
557 if (track_notification) {
558 if (pipe2(stdout_fds, O_CLOEXEC | O_NONBLOCK) < 0) {
559 LOG_WARN("failed to create stdout pipe");
560 track_notification = false;
561 /* Non-fatal */
562 } else {
563 tll_push_back(term->active_notifications, *notif);
565 /* We've taken over ownership of all data; clear, so that
566 notify_free() doesn't double free */
567 notif->id = NULL;
568 notif->title = NULL;
569 notif->body = NULL;
570 notif->category = NULL;
571 notif->app_id = NULL;
572 notif->icon_cache_id = NULL;
573 notif->icon_symbolic_name = NULL;
574 notif->icon_data = NULL;
575 notif->icon_data_sz = 0;
576 notif->icon_path = NULL;
577 notif->sound_name = NULL;
578 notif->icon_fd = -1;
579 notif->stdout_fd = -1;
580 struct notification *new_notif = &tll_back(term->active_notifications);
582 /* We don't need these anymore. They'll be free:d by the caller */
583 new_notif->button_count = tll_length(notif->actions);
584 memset(&new_notif->actions, 0, sizeof(new_notif->actions));
585 notif = new_notif;
586 }
587 }
589 if (stdout_fds[0] >= 0) {
590 fdm_add(term->fdm, stdout_fds[0], EPOLLIN,
591 &fdm_notify_stdout, (void *)term);
592 }
594 struct done_context *ctx = NULL;
595 if (track_notification) {
596 ctx = xmalloc(sizeof(*ctx));
597 ctx->wayl = term->wl;
598 ctx->term = term;
599 }
601 /* Redirect stdin to /dev/null, but ignore failure to open */
602 int devnull = open("/dev/null", O_RDONLY);
603 pid_t pid = spawn(
604 term->reaper, NULL, argv, devnull, stdout_fds[1], -1,
605 track_notification ? &notif_done : NULL, ctx, NULL);
607 if (stdout_fds[1] >= 0) {
608 /* Close write-end of stdout pipe */
609 close(stdout_fds[1]);
610 }
612 if (pid < 0 && stdout_fds[0] >= 0) {
613 /* Remove FDM callback if we failed to spawn */
614 fdm_del(term->fdm, stdout_fds[0]);
615 }
617 if (devnull >= 0)
618 close(devnull);
620 for (size_t i = 0; i < argc; i++)
621 free(argv[i]);
622 free(argv);
623 for (size_t i = 0; i < action_argc; i++)
624 free(action_argv[i]);
625 free(action_argv);
627 notif->pid = pid;
628 notif->stdout_fd = stdout_fds[0];
629 return true;
632void
633notify_close(struct terminal *term, const char *id)
635 xassert(id != NULL);
636 LOG_DBG("close notification %s", id);
638 tll_foreach(term->active_notifications, it) {
639 const struct notification *notif = &it->item;
640 if (notif->id == NULL || !streq(notif->id, id))
641 continue;
643 if (term->conf->desktop_notifications.close.argv.args == NULL) {
644 LOG_DBG(
645 "trying to close notification \"%s\" by sending SIGINT to %u",
646 id, notif->pid);
648 if (notif->pid == 0) {
649 LOG_WARN(
650 "cannot close notification \"%s\": no helper process running",
651 id);
652 } else {
653 /* Best-effort... */
654 kill(notif->pid, SIGINT);
655 }
656 } else {
657 LOG_DBG(
658 "trying to close notification \"%s\" "
659 "by running user defined command", id);
661 if (notif->external_id == 0) {
662 LOG_WARN("cannot close notification \"%s\": "
663 "no daemon assigned notification ID available", id);
664 return;
665 }
667 char **argv = NULL;
668 size_t argc = 0;
670 char external_id[16];
671 xsnprintf(external_id, sizeof(external_id), "%u", notif->external_id);
673 if (!spawn_expand_template(
674 &term->conf->desktop_notifications.close, 1,
675 (const char *[]){"id"},
676 (const char *[]){external_id},
677 &argc, &argv))
678 {
679 return;
680 }
682 int devnull = open("/dev/null", O_RDONLY);
683 spawn(term->reaper, NULL, argv, devnull, -1, -1, NULL, NULL, NULL);
685 if (devnull >= 0)
686 close(devnull);
688 for (size_t i = 0; i < argc; i++)
689 free(argv[i]);
690 free(argv);
691 }
693 return;
694 }
696 LOG_WARN("cannot close notification \"%s\": no such notification", id);
699static void
700add_icon(struct notification_icon *icon, const char *id, const char *symbolic_name,
701 const uint8_t *data, size_t data_sz)
703 icon->id = xstrdup(id);
704 icon->symbolic_name = symbolic_name != NULL ? xstrdup(symbolic_name) : NULL;
705 icon->tmp_file_name = NULL;
706 icon->tmp_file_fd = -1;
708 /*
709 * Dump in-line data to a temporary file. This allows us to pass
710 * the filename as a parameter to notification helpers
711 * (i.e. notify-send -i <path>).
712 *
713 * Optimization: since we always prefer (i.e. use) the symbolic
714 * name if present, there's no need to create a file on disk if we
715 * have a symbolic name.
716 */
717 if (symbolic_name == NULL && data_sz > 0) {
718 write_icon_file(
719 data, data_sz,
720 &icon->tmp_file_fd,
721 &icon->tmp_file_name,
722 &icon->symbolic_name);
723 }
725 LOG_DBG("added icon to cache: ID=%s: sym=%s, file=%s",
726 icon->id, icon->symbolic_name, icon->tmp_file_name);
729void
730notify_icon_add(struct terminal *term, const char *id,
731 const char *symbolic_name, const uint8_t *data, size_t data_sz)
733#if defined(_DEBUG)
734 for (size_t i = 0; i < ALEN(term->notification_icons); i++) {
735 struct notification_icon *icon = &term->notification_icons[i];
736 if (icon->id != NULL && streq(icon->id, id)) {
737 BUG("notification icon cache already contains \"%s\"", id);
738 }
739 }
740#endif
742 for (size_t i = 0; i < ALEN(term->notification_icons); i++) {
743 struct notification_icon *icon = &term->notification_icons[i];
744 if (icon->id == NULL) {
745 add_icon(icon, id, symbolic_name, data, data_sz);
746 return;
747 }
748 }
750 /* Cache full - throw out first entry, add new entry last */
751 notify_icon_free(&term->notification_icons[0]);
752 memmove(&term->notification_icons[0],
753 &term->notification_icons[1],
754 ((ALEN(term->notification_icons) - 1) *
755 sizeof(term->notification_icons[0])));
757 add_icon(
758 &term->notification_icons[ALEN(term->notification_icons) - 1],
759 id, symbolic_name, data, data_sz);
762void
763notify_icon_del(struct terminal *term, const char *id)
765 for (size_t i = 0; i < ALEN(term->notification_icons); i++) {
766 struct notification_icon *icon = &term->notification_icons[i];
768 if (icon->id == NULL || !streq(icon->id, id))
769 continue;
771 LOG_DBG("expelled %s from the notification icon cache", icon->id);
772 notify_icon_free(icon);
773 return;
774 }
777void
778notify_icon_free(struct notification_icon *icon)
780 if (icon->tmp_file_name != NULL) {
781 unlink(icon->tmp_file_name);
782 if (icon->tmp_file_fd >= 0)
783 close(icon->tmp_file_fd);
784 }
786 free(icon->id);
787 free(icon->symbolic_name);
788 free(icon->tmp_file_name);
790 icon->id = NULL;
791 icon->symbolic_name = NULL;
792 icon->tmp_file_name = NULL;
793 icon->tmp_file_fd = -1;
Diagnostics6 git calls · 28 ms
CallStatusSizeTime028 ms
discover200178 B3 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=178
git.server.agent=git/2.56.1-Linux
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch server-option object-format
git.server.fetch=shallow wait-for-done filter
git.protocol.version=2
git.pkt.frames=9
git.pkt.data=7
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=178
git.pkt.payload.max=35
ls-refs20010 KiB · hit3 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=3
git.response.bytes=10322
git.response.cache=HIT
git.response.duration_ms=3
git.protocol.version=2
git.pkt.frames=108
git.pkt.data=107
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=10322
git.pkt.payload.max=106
git.ls_refs.count=107
git.ls_refs.head=refs/heads/master
fetchtree:0 · deepen 102009.3 KiB · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
git.response.bytes=9489
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=tree:0
git.fetch.wants=c0d2c3e95d74cb60526ff28aec9f34ee3df545e0
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=7
git.pkt.data=5
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=9489
git.pkt.payload.max=9389
git.sideband.band1.bytes=9389
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=10
git.pack.bytes=9389
git.pack.ofs_delta=0
git.pack.ref_delta=0
git.pack.chain.max=0
git.pack.trailer=de930681b6073ba5b599a0f956bfbd114762ad5a
git.pack.full=10
Open pack map
fetchtree:0 · deepen 12001.1 KiB · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
git.response.bytes=1154
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=tree:0
git.fetch.wants=c0d2c3e95d74cb60526ff28aec9f34ee3df545e0
git.fetch.haves.count=0
git.fetch.deepen=1
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=7
git.pkt.data=5
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=1154
git.pkt.payload.max=1054
git.sideband.band1.bytes=1054
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=1054
git.pack.trailer=f9afe4130b8e969286b1fa36663bbb8999db09ea
Open pack map
fetchcombine:blob:none+tree:2 · deepen 12008.6 KiB · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=22
git.response.bytes=8830
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=combine:blob:none+tree:2
git.fetch.wants=c0d2c3e95d74cb60526ff28aec9f34ee3df545e0
git.fetch.haves.count=0
git.fetch.deepen=1
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=7
git.pkt.data=5
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=8830
git.pkt.payload.max=8730
git.sideband.band1.bytes=8730
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=14
git.pack.bytes=8730
git.fetch.wide.objects=14
git.fetch.wide.extra_bytes=9909
git.fetch.wide.blobs=0
fetch2006.1 KiB · hit22 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=6219
git.response.cache=HIT
git.response.duration_ms=22
git.fetch.wants=3ee329d9569f3716be4f769fd6e2da7b523f5691
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=4
git.pkt.data=3
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=6219
git.pkt.payload.max=6192
git.sideband.band1.bytes=6192
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://codeberg.org/dnkl/foot
Ref
refs/heads/master
Commit
c0d2c3e95d74cb60526ff28aec9f34ee3df545e0
cf-ray
a5ea932e3d2ca87d
Request
b8ff94bf…
Protocol
v2 · sha1
Agent
git/2.56.1-Linux
Filter
advertised
Fetch
shallow wait-for-done filter
Capabilities
agent ls-refs fetch server-option object-format