Download raw body.
[x11/i3status] fix disk usage reporting
Hello,
I'd like to add a patch for x11/i3status to fix disk space reporting.
The current version does not report the available disk space correctly
(reporting multiple TB of available space on a 500GB drive).
I sent a PR to the project many month ago on GitHub but it looks like the
project is inactive.
Denis
Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/i3status/Makefile,v
diff -u -p -r1.67 Makefile
--- Makefile 31 Mar 2025 14:37:47 -0000 1.67
+++ Makefile 10 Jan 2026 16:11:26 -0000
@@ -4,6 +4,7 @@ COMMENT= generate a statusbar for use w
DISTNAME= i3status-2.15
CATEGORIES= x11 sysutils
+REVISION= 0
HOMEPAGE= https://i3wm.org/i3status/
Index: patches/patch-src_print_disk_info_c
===================================================================
RCS file: patches/patch-src_print_disk_info_c
diff -N patches/patch-src_print_disk_info_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_print_disk_info_c 10 Jan 2026 16:11:26 -0000
@@ -0,0 +1,28 @@
+Index: src/print_disk_info.c
+--- src/print_disk_info.c.orig
++++ src/print_disk_info.c
+@@ -73,13 +73,13 @@ static bool below_threshold(struct statvfs buf, const
+ } else if (strcasecmp(threshold_type, "percentage_avail") == 0) {
+ return 100.0 * (double)buf.f_bavail / (double)buf.f_blocks < low_threshold;
+ } else if (strcasecmp(threshold_type, "bytes_free") == 0) {
+-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__APPLE__)
+ return (double)buf.f_bsize * (double)buf.f_bfree < low_threshold;
+ #else
+ return (double)buf.f_frsize * (double)buf.f_bfree < low_threshold;
+ #endif
+ } else if (strcasecmp(threshold_type, "bytes_avail") == 0) {
+-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__APPLE__)
+ return (double)buf.f_bsize * (double)buf.f_bavail < low_threshold;
+ #else
+ return (double)buf.f_frsize * (double)buf.f_bavail < low_threshold;
+@@ -198,7 +198,7 @@ void print_disk_info(disk_info_ctx_t *ctx) {
+ char string_percentage_used[STRING_SIZE];
+ char string_percentage_avail[STRING_SIZE];
+
+-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__APPLE__)
+ print_bytes_human(string_free, (uint64_t)buf.f_bsize * (uint64_t)buf.f_bfree, ctx->prefix_type);
+ print_bytes_human(string_used, (uint64_t)buf.f_bsize * ((uint64_t)buf.f_blocks - (uint64_t)buf.f_bfree), ctx->prefix_type);
+ print_bytes_human(string_total, (uint64_t)buf.f_bsize * (uint64_t)buf.f_blocks, ctx->prefix_type);
[x11/i3status] fix disk usage reporting