linux-qubasis
linux oasis port as a qubes template
git clone https://9o.is/git/linux-qubasis.git
commit ab49a44a5485826f09615ff840a0352f2b23a155 parent 077f9b159f774b7bd9f149ff05fb84fe8c62561a Author: Jul <jul@9o.is> Date: Wed, 30 Jul 2025 00:05:00 -0400 add dvtm client child process count to status bar Diffstat:
| M | pkg/dvtm/patches/0001-customize-personal-UI.patch | | | 6 | +++--- |
| M | pkg/dvtm/patches/0002-allow-focusing-left-right-fullscreen.patch | | | 6 | +++--- |
| A | pkg/dvtm/patches/0003-add-client-child-process-count-to-status-bar.patch | | | 84 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
3 files changed, 90 insertions(+), 6 deletions(-)
diff --git a/pkg/dvtm/patches/0001-customize-personal-UI.patch b/pkg/dvtm/patches/0001-customize-personal-UI.patch @@ -1,7 +1,7 @@ -From cda1adb0b039f605ba2662f87091edfd0b988e9b Mon Sep 17 00:00:00 2001 +From 460b3aa8833d93f5e9103fb49afe0673a34ba2ec Mon Sep 17 00:00:00 2001 From: Jul <jul@qh.is> Date: Sat, 19 Jul 2025 14:05:33 -0400 -Subject: [PATCH 1/2] customize personal UI +Subject: [PATCH 1/3] customize personal UI --- dvtm.c | 231 +++++++++++++++++++++++++++++++++++---------------------- @@ -279,5 +279,5 @@ index 8382c83..3a5be5c 100644 } -- -2.50.0 +2.50.1 diff --git a/pkg/dvtm/patches/0002-allow-focusing-left-right-fullscreen.patch b/pkg/dvtm/patches/0002-allow-focusing-left-right-fullscreen.patch @@ -1,7 +1,7 @@ -From 37a5789e85f39bd7220a75a3e603627f641d163d Mon Sep 17 00:00:00 2001 +From e2af1e71395e1c9498bd07e6598b5d6833c43b9f Mon Sep 17 00:00:00 2001 From: Jul <jul@qh.is> Date: Sat, 19 Jul 2025 20:49:03 -0400 -Subject: [PATCH 2/2] allow focusing left/right fullscreen +Subject: [PATCH 2/3] allow focusing left/right fullscreen --- dvtm.c | 2 -- @@ -21,5 +21,5 @@ index 3a5be5c..dc59514 100644 if (x >= c->x && x < c->x + c->w && y >= c->y && y < c->y + c->h) { debug("mouse event, x: %d y: %d client: %d\n", x, y, c->order); -- -2.50.0 +2.50.1 diff --git a/pkg/dvtm/patches/0003-add-client-child-process-count-to-status-bar.patch b/pkg/dvtm/patches/0003-add-client-child-process-count-to-status-bar.patch @@ -0,0 +1,84 @@ +From 96cb8eba8dd033e70289f57fa4efee31683e493e Mon Sep 17 00:00:00 2001 +From: Jul <jul@qh.is> +Date: Wed, 30 Jul 2025 00:02:37 -0400 +Subject: [PATCH 3/3] add client child process count to status bar + +--- + dvtm.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 47 insertions(+) + +diff --git a/dvtm.c b/dvtm.c +index dc59514..5ded956 100644 +--- a/dvtm.c ++++ b/dvtm.c +@@ -33,6 +33,8 @@ + #include <stdbool.h> + #include <errno.h> + #include <pwd.h> ++#include <dirent.h> ++#include <ctype.h> + #if defined __CYGWIN__ || defined __sun + # include <termios.h> + #endif +@@ -322,6 +324,41 @@ showbar(void) { + bar.pos = bar.lastpos; + } + ++ ++int count_child_processes(pid_t parent_pid) { ++ int count = 0; ++ DIR *proc_dir = opendir("/proc"); ++ struct dirent *entry; ++ ++ if (proc_dir == NULL) { ++ perror("opendir"); ++ return -1; ++ } ++ ++ while ((entry = readdir(proc_dir)) != NULL) { ++ if (isdigit(entry->d_name[0])) { ++ pid_t pid = atoi(entry->d_name); ++ char path[256]; ++ snprintf(path, sizeof(path), "/proc/%d/stat", pid); ++ FILE *stat_file = fopen(path, "r"); ++ ++ if (stat_file) { ++ int ppid; ++ fscanf(stat_file, "%*d %*s %*s %d", &ppid); ++ fclose(stat_file); ++ ++ if (ppid == parent_pid) { ++ count++; ++ count += count_child_processes(pid); ++ } ++ } ++ } ++ } ++ ++ closedir(proc_dir); ++ return count; ++} ++ + static unsigned int + total_visible_clients(void) { + unsigned int total = 0; +@@ -441,6 +478,16 @@ drawbar(void) { + printw("%s", buffer_clients); + } + ++ if (sel) { ++ int count = 1 + count_child_processes(sel->pid); ++ if (count > 1) { ++ unsigned int len_procs = count >= 10 ? 3 : 2; ++ move(bar.y, screen.w - len_rhs - len_procs - 1); ++ len_rhs += len_procs + 1; ++ printw("P%d", count); ++ } ++ } ++ + move(bar.y, len_lhs + 1); + getyx(stdscr, y, x); + (void)y; +-- +2.50.1 +