-[name]
-command=echo $USER@$(hostname)
-label=
-interval=once
-
[uptime]
-command=uptime -p
+command=upt
+label=
interval=60
[speaker volume]
interval=10
[memory]
-command=sb-memory
+command=memu
label=
interval=20
[cpu]
-command=sb-cpu -t 5 -l
-markup=pango
-interval=persist
+command=cpuse
+label=
+interval=10
[temperature]
-command=sb-temperature
+command=stemp k10temp amdgpu
label=
interval=10
[bandwidth]
-command=sb-bandwidth -B -s -t 5
+command=udld
label=
-markup=pango
-interval=persist
+interval=10
[ip]
command=hostname -i
+++ /dev/null
-include
-lib
-share
+++ /dev/null
-electrum
-helpdev
-jp.py
-pip*
-qdarkstyle
-wal
-wheel
-
-sb-bandwidth
-sb-cpu
--- /dev/null
+#!/bin/awk -f
+# cpuse - print average cpu usage since last run
+
+BEGIN {
+ getline < "/tmp/cpuse";
+ ou=$1; ot=$2;
+ while (getline < "/proc/stat") {
+ if ($1 == "cpu") {
+ u=$2+$3+$4+$7+$8+$9+$10+$11; t=u+$5+$6;
+ print u,t > "/tmp/cpuse";
+ printf "%i%%\n", ((u-ou)*100)/(t-ot);
+ exit;
+ }
+ }
+}
--- /dev/null
+#!/bin/awk -f
+# memu - print memory usage
+
+BEGIN {
+ while (getline < "/proc/meminfo") {
+ if ($1 == "MemTotal:") t=$2;
+ if ($1 == "MemAvailable:") {
+ printf "%.1fG/%.1fG\n", (t-$2)/1000000, t/1000000;
+ exit;
+ }
+ }
+}
+++ /dev/null
-#!/bin/sh
-# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>
-
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-TYPE="${BLOCK_INSTANCE:-mem}"
-
-awk -v type=$TYPE '
-/^MemTotal:/ {
- mem_total=$2
-}
-/^MemFree:/ {
- mem_free=$2
-}
-/^Buffers:/ {
- mem_free+=$2
-}
-/^Cached:/ {
- mem_free+=$2
-}
-/^SwapTotal:/ {
- swap_total=$2
-}
-/^SwapFree:/ {
- swap_free=$2
-}
-END {
- if (type == "swap") {
- free=swap_free/1024/1024
- used=(swap_total-swap_free)/1024/1024
- total=swap_total/1024/1024
- } else {
- free=mem_free/1024/1024
- used=(mem_total-mem_free)/1024/1024
- total=mem_total/1024/1024
- }
-
- pct=0
- if (total > 0) {
- pct=used/total*100
- }
-
- # full text
- printf("%.1fG/%.1fG (%.f%%)\n", used, total, pct)
-
- # short text
- printf("%.f%%\n", pct)
-
- # color
- if (pct > 90) {
- print("#FF0000")
- } else if (pct > 80) {
- print("#FFAE00")
- } else if (pct > 70) {
- print("#FFF600")
- }
-}
-' /proc/meminfo
+++ /dev/null
-#!/usr/bin/env perl
-# Copyright 2014 Pierre Mavro <deimos@deimos.fr>
-# Copyright 2014 Vivien Didelot <vivien@didelot.org>
-# Copyright 2014 Andreas Guldstrand <andreas.guldstrand@gmail.com>
-# Copyright 2014 Benjamin Chretien <chretien at lirmm dot fr>
-
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-use strict;
-use warnings;
-use utf8;
-use Getopt::Long;
-
-binmode(STDOUT, ":utf8");
-
-# default values
-my $t_warn = $ENV{T_WARN} || 70;
-my $t_crit = $ENV{T_CRIT} || 90;
-my $chip = $ENV{SENSOR_CHIP} || "";
-my $temperature = -9999;
-
-sub help {
- print "Usage: temperature [-w <warning>] [-c <critical>] [--chip <chip>]\n";
- print "-w <percent>: warning threshold to become yellow\n";
- print "-c <percent>: critical threshold to become red\n";
- print "--chip <chip>: sensor chip\n";
- exit 0;
-}
-
-GetOptions("help|h" => \&help,
- "w=i" => \$t_warn,
- "c=i" => \$t_crit,
- "chip=s" => \$chip);
-
-# Get chip temperature
-open (SENSORS, "sensors -u $chip |") or die;
-while (<SENSORS>) {
- if (/^\s+temp1_input:\s+[\+]*([\-]*\d+\.\d)/) {
- $temperature = $1;
- last;
- }
-}
-close(SENSORS);
-
-$temperature eq -9999 and die 'Cannot find temperature';
-
-# Print short_text, full_text
-print "$temperature°C\n" x2;
-
-# Print color, if needed
-if ($temperature >= $t_crit) {
- print "#FF0000\n";
- exit 33;
-} elsif ($temperature >= $t_warn) {
- print "#FFFC00\n";
-}
-
-exit 0;
--- /dev/null
+#!/bin/sh
+# stemp - print system/sensor temperature
+# $1: sensor name(s) (optional)
+
+for f in /sys/class/hwmon/hwmon*; do
+ paste "$f/name" "$f/temp1_input" 2>/dev/null
+done | if [ -z "$1" ]; then
+ awk '{printf "%s\t%i°C\n",$1,$2/1000}'
+else
+ awk -v n="$*" 'BEGIN {gsub(" ","|",n)} \
+ $1~n {printf "%i°C ",$2/1000} END {printf "\n"}'
+fi
--- /dev/null
+#!/bin/awk -f
+
+BEGIN {
+ while ("for f in /sys/class/net/[ew]*; do paste $f/statistics/[rt]x_bytes; done" | getline) {
+ d+=$1; u+=$2; }
+ getline < "/tmp/test"; od=$1; ou=$2; ot=$3;
+ getline < "/proc/uptime"; t=$1;
+ print d,u,t > "/tmp/test";
+ t=t-ot; if (!t) t=1;
+ printf "%.1f/%.1f MB/s\n", ((d-od)/1000000)/t, ((u-ou)/1000000)/t;
+}
--- /dev/null
+#!/bin/awk -f
+# upt - print uptime in short
+
+BEGIN {
+ getline < "/proc/uptime";
+ m=$1/60; h=0;
+ if (m >= 60) { h=int(m/60); m-=h*60; }
+ printf "%ih %im\n", h, m;
+}