Compare commits

..

2 commits

Author SHA1 Message Date
krizej
7d0289f0dd i3status changes 2024-07-05 01:29:46 +02:00
krizej
86aef26643 xdg changes 2024-07-05 01:26:15 +02:00
3 changed files with 66 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

@ -42,5 +42,34 @@ in {
templates = "${HOME}/templates";
videos = "${HOME}/videos";
};
home.file = {
".config/python/pythonrc".text = ''
def is_vanilla() -> bool:
import sys
return not hasattr(__builtins__, '__IPYTHON__') and 'bpython' not in sys.argv[0]
def setup_history():
import os
import atexit
import readline
from pathlib import Path
if state_home := os.environ.get('XDG_STATE_HOME'):
state_home = Path(state_home)
else:
state_home = Path.home() / '.local' / 'state'
history: Path = state_home / 'python_history'
readline.read_history_file(str(history))
atexit.register(readline.write_history_file, str(history))
if is_vanilla():
setup_history()
'';
};
};
}

View file

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