Add per-process network drawer to the Network widget

Clicking the Network pill now toggles a drawer listing processes ranked
by network throughput, refreshed live only while open — mirroring the
CPU widget's top-processes drawer.

services/topnet.sh (single-shot, like topproc.sh) takes two `ss` snapshots
procInterval apart, diffs each TCP socket's cumulative rx/tx bytes by inode,
sums positive deltas per owning PID, and prints ranked "N <rx/s> <tx/s>
<name>" frames. SysStats re-runs it while netProcPollEnabled (drawer open)
using the same SplitParser-accumulate / parse-on-exit / re-arm plumbing as
procScan. Network.qml wraps its Pill in an Item and hangs a fixed-size
PopupWindow drawer off it.

ss (iproute2) is added to runtimeInputs since per-process byte accounting
has no virtual-file equivalent. Caveat: ss only exposes byte counters for
TCP sockets, so UDP/QUIC traffic is not attributed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-02 18:40:26 +02:00
parent eecf1a1b6a
commit dfb16cce4e
4 changed files with 383 additions and 32 deletions

View File

@@ -24,12 +24,14 @@
qsPkg = quickshell.packages.${pkgs.system}.default;
# Runtime tools the bar relies on: discover.sh (one-shot hardware
# probe) and the periodic `df` for disk usage. Everything else is
# read from /proc and /sys directly in QML.
# probe), the periodic `df` for disk usage, and `ss` (iproute2) for
# the per-process network drawer (topnet.sh). Everything else is read
# from /proc and /sys directly in QML.
runtimeInputs = [
qsPkg
pkgs.bash
pkgs.coreutils # df, cat
pkgs.iproute2 # ss, for topnet.sh per-process network usage
];
# Self-contained font set so Nerd Font glyphs always render,
@@ -69,6 +71,7 @@
quickshell.packages.${pkgs.system}.default
pkgs.bash
pkgs.coreutils
pkgs.iproute2 # ss, for topnet.sh
pkgs.nerd-fonts.jetbrains-mono
pkgs.inter
pkgs.qt6.qtdeclarative # qmlls / qmlformat for editing