5/9
This commit is contained in:
2
cpu_used.sh
Executable file
2
cpu_used.sh
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
mpstat 1 1 | awk '/Average/ {print 100 - $NF}'
|
||||||
10
eww.scss
10
eww.scss
@@ -48,6 +48,16 @@
|
|||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.netdown-dash {
|
||||||
|
font-size: 50px;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.netup-dash {
|
||||||
|
font-size: 50px;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
|
||||||
.clock-date {
|
.clock-date {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
|
|||||||
47
eww.yuck
47
eww.yuck
@@ -151,6 +151,44 @@
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
(defpoll cpu_used :interval "2s"
|
||||||
|
"sh ~/.config/eww/cpu_used.sh")
|
||||||
|
|
||||||
|
(defpoll cpu_ratio :interval "5s"
|
||||||
|
"top -bn1 | awk '/Cpu\\(s\\)/ {printf \"%.0f%%\", 100 - $8}'")
|
||||||
|
|
||||||
|
(defwidget cpu_circle []
|
||||||
|
(box
|
||||||
|
:orientation "v"
|
||||||
|
:class "clock-box"
|
||||||
|
:space-evenly false
|
||||||
|
(label :text {cpu_used} :class "clock-time-dash")
|
||||||
|
(label :text "%" :class "mem-dash")
|
||||||
|
(progress
|
||||||
|
:value {cpu_used}
|
||||||
|
:min 0
|
||||||
|
:max 100
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defpoll net_down :interval "2s"
|
||||||
|
"sh ~/.config/eww/net_down.sh")
|
||||||
|
|
||||||
|
(defpoll net_up :interval "2s"
|
||||||
|
"sh ~/.config/eww/net_up.sh")
|
||||||
|
|
||||||
|
(defwidget net_circle []
|
||||||
|
(box
|
||||||
|
:orientation "v"
|
||||||
|
:class "clock-box"
|
||||||
|
:space-evenly true
|
||||||
|
|
||||||
|
(label :text {net_down} :class "netdown-dash")
|
||||||
|
(label :text {net_up} :class "netup-dash")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
;(defwidget memory []
|
;(defwidget memory []
|
||||||
; (box
|
; (box
|
||||||
; :orientation "v"
|
; :orientation "v"
|
||||||
@@ -241,8 +279,8 @@
|
|||||||
:monitor 0
|
:monitor 0
|
||||||
:stacking "bg"
|
:stacking "bg"
|
||||||
:geometry (geometry
|
:geometry (geometry
|
||||||
:width "80%"
|
:width "90%"
|
||||||
:height "50%"
|
:height "40%"
|
||||||
:anchor "center"
|
:anchor "center"
|
||||||
)
|
)
|
||||||
(box
|
(box
|
||||||
@@ -251,8 +289,9 @@
|
|||||||
(media-small :art art)
|
(media-small :art art)
|
||||||
)
|
)
|
||||||
(box
|
(box
|
||||||
(box :orientation "h" (common-ports))
|
:orientation "h"
|
||||||
(box :orientation "v" (clock-dash) (mem_circle))
|
(box :orientation "v" (clock-dash) (mem_circle))
|
||||||
)
|
(box :orientation "v" (cpu_circle) (net_circle))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
14
net_down.sh
Executable file
14
net_down.sh
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
IFACE="wlan0"
|
||||||
|
|
||||||
|
FILE="/tmp/net_rx_$IFACE"
|
||||||
|
|
||||||
|
rx_now=$(awk -v iface="$IFACE" '$0 ~ iface":" {gsub(/:/,""); print $2}' /proc/net/dev)
|
||||||
|
rx_prev=$(cat "$FILE" 2>/dev/null || echo 0)
|
||||||
|
|
||||||
|
echo "$rx_now" > "$FILE"
|
||||||
|
|
||||||
|
diff=$(( (rx_now - rx_prev) / 1024 ))
|
||||||
|
[ "$diff" -lt 0 ] && diff=0
|
||||||
|
|
||||||
|
printf "↓ %d KB/s" "$diff"
|
||||||
14
net_up.sh
Executable file
14
net_up.sh
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
IFACE="wlan0"
|
||||||
|
|
||||||
|
FILE="/tmp/net_tx_$IFACE"
|
||||||
|
|
||||||
|
tx_now=$(awk -v iface="$IFACE" '$0 ~ iface":" {gsub(/:/,""); print $10}' /proc/net/dev)
|
||||||
|
tx_prev=$(cat "$FILE" 2>/dev/null || echo 0)
|
||||||
|
|
||||||
|
echo "$tx_now" > "$FILE"
|
||||||
|
|
||||||
|
diff=$(( (tx_now - tx_prev) / 1024 ))
|
||||||
|
[ "$diff" -lt 0 ] && diff=0
|
||||||
|
|
||||||
|
printf "↑ %d KB/s" "$diff"
|
||||||
4
net_used.sh
Executable file
4
net_used.sh
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
IFACE="wlan0"
|
||||||
|
|
||||||
|
cat /sys/class/net/$IFACE/operstate | grep -q "up" && echo 100 || echo 0
|
||||||
Reference in New Issue
Block a user