From 7d0289f0dd6a1ccced3e641cbb051a89ffc5105a Mon Sep 17 00:00:00 2001 From: krizej <60076189+krizej@users.noreply.github.com> Date: Fri, 5 Jul 2024 01:29:46 +0200 Subject: [PATCH] i3status changes --- files/i3status.patch | 34 ++++++++++++++++++++++++++++++++++ programs/i3.nix | 4 +++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 files/i3status.patch diff --git a/files/i3status.patch b/files/i3status.patch new file mode 100644 index 0000000..e9ec2a9 --- /dev/null +++ b/files/i3status.patch @@ -0,0 +1,34 @@ +From 9758bc03df33fc0d6e61b2be86e3efe714b90dee Mon Sep 17 00:00:00 2001 +From: krizej <60076189+krizej@users.noreply.github.com> +Date: Fri, 5 Jul 2024 01:17:31 +0200 +Subject: [PATCH] japierdole + +--- + src/print_cpu_usage.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/print_cpu_usage.c b/src/print_cpu_usage.c +index a7ee2e4..1821a99 100644 +--- a/src/print_cpu_usage.c ++++ b/src/print_cpu_usage.c +@@ -201,7 +201,7 @@ void print_cpu_usage(cpu_usage_ctx_t *ctx) { + *(outwalk++) = *walk; + + } else if (BEGINS_WITH(walk + 1, "usage")) { +- outwalk += sprintf(outwalk, "%02d%s", diff_usage, pct_mark); ++ outwalk += sprintf(outwalk, "%d%s", diff_usage, pct_mark); + walk += strlen("usage"); + } + #if defined(__linux__) +@@ -217,7 +217,7 @@ void print_cpu_usage(cpu_usage_ctx_t *ctx) { + int cpu_diff_idle = curr_cpus[number].idle - prev_cpus[number].idle; + int cpu_diff_total = curr_cpus[number].total - prev_cpus[number].total; + int cpu_diff_usage = (cpu_diff_total ? (1000 * (cpu_diff_total - cpu_diff_idle) / cpu_diff_total + 5) / 10 : 0); +- outwalk += sprintf(outwalk, "%02d%s", cpu_diff_usage, pct_mark); ++ outwalk += sprintf(outwalk, "%d%s", cpu_diff_usage, pct_mark); + } + walk += length; + } +-- +2.45.1 + diff --git a/programs/i3.nix b/programs/i3.nix index 643a5df..731423a 100644 --- a/programs/i3.nix +++ b/programs/i3.nix @@ -1,6 +1,7 @@ { config, pkgs, ... }: let HOME = config.home-manager.users.krizej.home.homeDirectory; + i3status_cpufix = pkgs.i3status.overrideAttrs (_: { patches = [ ../files/i3status.patch ]; }); in { services.xserver.windowManager.i3.enable = true; home-manager.users.krizej = { @@ -44,7 +45,7 @@ in { { inherit fonts; trayOutput = "primary"; - statusCommand = "${pkgs.i3status}/bin/i3status"; + statusCommand = "${i3status_cpufix}/bin/i3status"; } ]; @@ -168,6 +169,7 @@ in { programs.i3status = { enable = true; enableDefault = false; + package = i3status_cpufix; general = { interval = 1;