Skip to content

Commit

Permalink
pkgs/profpatsch/display-infos: add 5 minute load
Browse files Browse the repository at this point in the history
  • Loading branch information
Profpatsch committed Aug 8, 2024
1 parent a613281 commit 41aa0d0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkgs/profpatsch/display-infos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ let
p.terminate()
return str(sft.strip().decode())
def get_5_min_load():
with open('/proc/loadavg', 'r') as f:
return f.read().split(' ')[1]
charging = readint("/sys/class/power_supply/AC/online")
full = 0
Expand Down Expand Up @@ -48,13 +52,15 @@ let
bat = round( now/full, 2 )
ac = "⚡ " if charging else ""
sft_remaining = seconds_to_sft(seconds_remaining)
date = sub.run(["date", "+%d.%m. [%V] %a %T"], stdout=sub.PIPE).stdout.strip().decode()
date = sub.run(["date", "+%d.%m. KW%V %a %T"], stdout=sub.PIPE).stdout.strip().decode()
dottime = sub.run(["date", "--utc", "+%H·%M"], stdout=sub.PIPE).stdout.strip().decode()
sftdate = sub.run(["@sfttime@"], stdout=sub.PIPE).stdout.strip().decode()
notify = "BAT: {percent}% {ac}{charge}| {date} | {sftdate} | {dottime}".format(
load = get_5_min_load()
notify = "BAT: {percent}% {ac}{charge}{{{load}}} | {date} | {sftdate} | {dottime}".format(
percent = int(bat*100),
ac = ac,
charge = "{} ".format(sft_remaining) if seconds_remaining else "",
load = load,
date = date,
sftdate = sftdate,
dottime = dottime
Expand Down

0 comments on commit 41aa0d0

Please sign in to comment.