}
END {
- lo = devices["lo"]
- #eth = devices["enp0s25"]
- wifi = devices["wlp3s0"]
- printf("[%s | %s %s]", lo, wifi_conn, wifi)
+ lo = devices["lo"]
+ #eth = devices["enp0s25"]
+ wifi_io = devices["wlp3s0"]
+ if (wifi_conn == "--") {
+ wifi = wifi_conn
+ } else {
+ wifi = wifi_conn " " wifi_io
+ }
+ printf("[%s | %s]", lo, wifi)
}
' /proc/net/dev
)
'
)
-mpd_current_file=$(
+mpd_current=$(
echo 'currentsong' \
| nc 127.0.0.1 6600 \
| awk -v max_chars=10 '
- /^file:/ {
- file = $2
- for (i=3; i<=NF; i++) {file = file " " $i}
- last = split(file, parts, "/")
- print substr(parts[last], 1, max_chars)
+ /^OK/ {
+ next
+ }
+
+ {
+ key = $1
+ val = $2
+ for (i=3; i<=NF; i++) {val = val " " $i}
+ data[key] = val
+ }
+
+ END {
+ if (data["Name:"]) {
+ out = data["Name:"]
+ } else {
+ file = data["file:"]
+ last = split(file, parts, "/")
+ out = parts[last]
+ }
+ printf("%s", substr(out, 1, max_chars))
+ }
+ '
+)
+
+graphics_card=$(
+ nvidia-smi \
+ --format=csv,noheader,nounits \
+ --query-gpu=memory.total,memory.used,temperature.gpu \
+ | awk -F ',' '
+ {
+ mem_total = $1;
+ mem_used = $2;
+ temp = $3;
+ mem_used_percent = (100 * mem_used) / mem_total;
+ printf("[%d%% %dC]", mem_used_percent, temp);
}
'
)
E$energy\
\
\
+ G=$graphics_card\
+ \
+ \
M$memory\
\
\
\
V=$volume\
\
- [$mpd_state $mpd_current_file]\
+ [$mpd_state $mpd_current]\
\
$signal_last_msg_age\
\