i3status changes

This commit is contained in:
krizej 2024-07-05 01:29:46 +02:00
parent 86aef26643
commit 7d0289f0dd
2 changed files with 37 additions and 1 deletions

34
files/i3status.patch Normal file
View file

@ -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

View file

@ -1,6 +1,7 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
let let
HOME = config.home-manager.users.krizej.home.homeDirectory; HOME = config.home-manager.users.krizej.home.homeDirectory;
i3status_cpufix = pkgs.i3status.overrideAttrs (_: { patches = [ ../files/i3status.patch ]; });
in { in {
services.xserver.windowManager.i3.enable = true; services.xserver.windowManager.i3.enable = true;
home-manager.users.krizej = { home-manager.users.krizej = {
@ -44,7 +45,7 @@ in {
{ {
inherit fonts; inherit fonts;
trayOutput = "primary"; trayOutput = "primary";
statusCommand = "${pkgs.i3status}/bin/i3status"; statusCommand = "${i3status_cpufix}/bin/i3status";
} }
]; ];
@ -168,6 +169,7 @@ in {
programs.i3status = { programs.i3status = {
enable = true; enable = true;
enableDefault = false; enableDefault = false;
package = i3status_cpufix;
general = { general = {
interval = 1; interval = 1;