Eww update
This commit is contained in:
14
.claude/settings.local.json
Normal file
14
.claude/settings.local.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"permissions": {
|
||||||
|
"allow": [
|
||||||
|
"WebFetch(domain:elkowar.github.io)",
|
||||||
|
"WebFetch(domain:github.com)",
|
||||||
|
"WebFetch(domain:raw.githubusercontent.com)",
|
||||||
|
"WebSearch",
|
||||||
|
"WebFetch(domain:deepwiki.com)",
|
||||||
|
"Bash(amdgpu_top -J -s 1000 -d 1)",
|
||||||
|
"Bash(amdgpu_top -J -s 1000 -n 1)",
|
||||||
|
"Bash(sensors -j)"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
29
modules/home/wayland/apps/eww/bar/css/_colors.scss
Normal file
29
modules/home/wayland/apps/eww/bar/css/_colors.scss
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
$base00: #000000;
|
||||||
|
$base01: #060a0f;
|
||||||
|
$base02: #212c38;
|
||||||
|
$base03: #3f5268;
|
||||||
|
$base04: #617b9a;
|
||||||
|
$base05: #90a7c1;
|
||||||
|
$base06: #c9d3df;
|
||||||
|
$base07: #fcfcfc;
|
||||||
|
$base08: #ffac56;
|
||||||
|
$base09: #feea74;
|
||||||
|
$base0A: #bffe8a;
|
||||||
|
$base0B: #4cfefa;
|
||||||
|
$base0C: #62acfd;
|
||||||
|
$base0D: #9b9bfd;
|
||||||
|
$base0E: #fe9bda;
|
||||||
|
$base0F: #fc8999;
|
||||||
|
|
||||||
|
|
||||||
|
$fg: $base07;
|
||||||
|
$bg0: $base00;
|
||||||
|
$bg1: $base01;
|
||||||
|
|
||||||
|
$border-color: $base03;
|
||||||
|
$border-color-focus: $base04;
|
||||||
|
$border-radius: 8px;
|
||||||
|
$border-width: 2px;
|
||||||
|
|
||||||
|
$gaps-screen: 8px;
|
||||||
|
$gaps-window: 4px;
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
|
.net-icon {
|
||||||
.net {
|
font-size: 14px;
|
||||||
color: $base07;
|
padding: 3pt 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.blt {
|
.net-active { color: $base07; }
|
||||||
color: $base0C;
|
.net-dim { color: $base02; }
|
||||||
}
|
.blt-on { color: $base07; }
|
||||||
|
.blt-connected { color: $base0D; }
|
||||||
|
|||||||
@@ -1,69 +1,186 @@
|
|||||||
|
|
||||||
.cpubar {
|
// Bar module rings
|
||||||
color: $base0C;
|
.cpubar { color: $base0C; }
|
||||||
}
|
.gpubar { color: $base0E; }
|
||||||
|
.membar { color: $base08; }
|
||||||
.gpubar {
|
.batbar { color: $base0B; }
|
||||||
color: $base0E;
|
|
||||||
}
|
.cpubar, .gpubar, .membar, .batbar {
|
||||||
|
background-color: $bg0;
|
||||||
.membar {
|
margin: $gaps-window 0;
|
||||||
color: $base08;
|
|
||||||
}
|
|
||||||
|
|
||||||
.batbar {
|
|
||||||
color: $base0B;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cpubar,
|
|
||||||
.gpubar,
|
|
||||||
.membar,
|
|
||||||
.batbar {
|
|
||||||
background-color: $bg0;
|
|
||||||
margin: $gaps-window 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cpu-core-usage, .gpu-core-usage, .memory-usage {
|
|
||||||
background-color: $bg0;
|
|
||||||
border-radius: $border-radius;
|
|
||||||
padding: 2pt;
|
|
||||||
margin: 1pt;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.cpu-core-usage trough * {
|
|
||||||
background-color: $base0C;
|
|
||||||
border-radius: $border-radius;
|
|
||||||
padding: 2pt;
|
|
||||||
}
|
|
||||||
.gpu-core-usage trough * {
|
|
||||||
background-color: $base0E;
|
|
||||||
border-radius: $border-radius;
|
|
||||||
padding: 2pt;
|
|
||||||
}
|
|
||||||
|
|
||||||
.memory-usage trough * {
|
|
||||||
background-color: $base08;
|
|
||||||
border-radius: $border-radius;
|
|
||||||
padding: 2pt;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.spacer {
|
|
||||||
color: $bg1;
|
|
||||||
padding: $gaps-window;
|
|
||||||
margin:0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Window
|
||||||
.sys-win {
|
.sys-win {
|
||||||
// @include window;
|
padding: 10pt;
|
||||||
// background-color: $bg1;
|
}
|
||||||
// color: $fg;
|
|
||||||
// margin: $gaps-win;
|
.sys-section {
|
||||||
padding: 5pt;
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sys-section-header {
|
||||||
|
margin-bottom: 10pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sys-label {
|
.sys-label {
|
||||||
font-weight: bolder;
|
font-size: 0.72em;
|
||||||
color: $base04;
|
font-weight: bold;
|
||||||
|
letter-spacing: 0.14em;
|
||||||
|
color: $base05;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-accent {
|
||||||
|
min-width: 3px;
|
||||||
|
border-radius: 2px;
|
||||||
|
margin-right: 8pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cpu-accent { background-color: $base0C; }
|
||||||
|
.gpu-accent { background-color: $base0E; }
|
||||||
|
.ram-accent { background-color: $base08; }
|
||||||
|
.bat-accent { background-color: $base0B; }
|
||||||
|
|
||||||
|
.section-sep {
|
||||||
|
background-color: $base02;
|
||||||
|
min-height: 2px;
|
||||||
|
margin: 6pt 0 10pt 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sys-sublabel {
|
||||||
|
font-size: 0.72em;
|
||||||
|
color: $base04;
|
||||||
|
margin-right: 8pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CPU grid
|
||||||
|
.cpu-usage-ring {
|
||||||
|
color: $base0C;
|
||||||
|
background-color: $bg0;
|
||||||
|
margin: 3pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inner freq ring — margin shrinks it inside overlay for concentric effect
|
||||||
|
// 0% = cpu min freq, 100% = cpu max freq
|
||||||
|
.cpu-freq-ring {
|
||||||
|
color: $base0D;
|
||||||
|
background-color: $bg0;
|
||||||
|
margin: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cpu-core-label {
|
||||||
|
font-size: 0.7em;
|
||||||
|
color: $base05;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GPU rings
|
||||||
|
.gpu-ring {
|
||||||
|
color: $base0E;
|
||||||
|
background-color: $bg0;
|
||||||
|
margin: 3pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gpu-freq-ring {
|
||||||
|
color: $base0D;
|
||||||
|
background-color: $bg0;
|
||||||
|
margin: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gpu-ring-value {
|
||||||
|
font-size: 0.82em;
|
||||||
|
font-weight: bold;
|
||||||
|
color: $base05;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gpu-ring-label {
|
||||||
|
font-size: 0.62em;
|
||||||
|
color: $base04;
|
||||||
|
margin-top: 2pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GPU stats row
|
||||||
|
.gpu-stats-row {
|
||||||
|
margin-top: 6pt;
|
||||||
|
margin-bottom: 2pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gpu-stat-value {
|
||||||
|
font-size: 0.85em;
|
||||||
|
font-weight: bold;
|
||||||
|
color: $base05;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gpu-stat-label {
|
||||||
|
font-size: 0.62em;
|
||||||
|
color: $base04;
|
||||||
|
}
|
||||||
|
|
||||||
|
// VRAM bar
|
||||||
|
.vram-row {
|
||||||
|
margin-top: 6pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vram-bar {
|
||||||
|
background-color: $bg0;
|
||||||
|
border-radius: $border-radius;
|
||||||
|
padding: 4pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vram-bar trough * {
|
||||||
|
background-color: $base0E;
|
||||||
|
border-radius: $border-radius;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vram-usage-label {
|
||||||
|
font-size: 0.62em;
|
||||||
|
color: $base04;
|
||||||
|
margin-top: 2pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
// RAM ring
|
||||||
|
.ram-ring {
|
||||||
|
color: $base08;
|
||||||
|
background-color: $bg0;
|
||||||
|
margin: 4pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ram-cached-ring {
|
||||||
|
color: $base02;
|
||||||
|
background-color: transparent;
|
||||||
|
margin: 4pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ram-used-label {
|
||||||
|
font-size: 0.95em;
|
||||||
|
font-weight: bold;
|
||||||
|
color: $base05;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ram-total-label {
|
||||||
|
font-size: 0.72em;
|
||||||
|
color: $base04;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Swap ring
|
||||||
|
.swap-ring {
|
||||||
|
color: $base09;
|
||||||
|
background-color: $bg0;
|
||||||
|
margin: 3pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
.swap-section-label {
|
||||||
|
font-size: 0.62em;
|
||||||
|
color: $base04;
|
||||||
|
margin-top: 2pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Battery ring
|
||||||
|
.bat-ring {
|
||||||
|
background-color: $bg0;
|
||||||
|
margin: 4pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bat-ring-label {
|
||||||
|
font-size: 0.7em;
|
||||||
|
color: $base05;
|
||||||
}
|
}
|
||||||
@@ -1,17 +1,23 @@
|
|||||||
(deflisten net :initial '{"name":"","icon":""}'"scripts/net/net")
|
(deflisten net
|
||||||
|
:initial '{"wifi":{"connected":false,"icon":"","ssid":""},"ethernet":{"connected":false}}'
|
||||||
|
"scripts/net/net")
|
||||||
|
|
||||||
|
(deflisten bluetooth
|
||||||
|
:initial '{"powered":false,"connected":false,"device":""}'
|
||||||
|
"scripts/net/bluetooth")
|
||||||
|
|
||||||
(defwidget net-mod []
|
(defwidget net-mod []
|
||||||
(module
|
(module
|
||||||
(box
|
(box :orientation "v"
|
||||||
:orientation "v"
|
(label
|
||||||
(button
|
:class "net-icon ${net.ethernet.connected ? 'net-active' : 'net-dim'}"
|
||||||
:class "net"
|
:tooltip {net.ethernet.connected ? "Ethernet: Connected" : "Ethernet: Disconnected"}
|
||||||
:tooltip {net.name}
|
:text "")
|
||||||
{net.icon})
|
(label
|
||||||
|
:class "net-icon ${net.wifi.connected ? 'net-active' : 'net-dim'}"
|
||||||
(button
|
:tooltip {net.wifi.connected ? "WiFi: ${net.wifi.ssid}" : "WiFi: Disconnected"}
|
||||||
:class "blt"
|
:text {net.wifi.icon})
|
||||||
(label :class "icon-text" :text "B"))
|
(label
|
||||||
)
|
:class "net-icon ${bluetooth.connected ? 'blt-connected' : bluetooth.powered ? 'blt-on' : 'net-dim'}"
|
||||||
)
|
:tooltip {bluetooth.connected ? "Bluetooth: ${bluetooth.device}" : bluetooth.powered ? "Bluetooth: On" : "Bluetooth: Off"}
|
||||||
)
|
:text {bluetooth.connected ? "" : bluetooth.powered ? "" : ""}))))
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
(deflisten cpu :initial '{}' "scripts/sys/cpu")
|
(deflisten cpu :initial '{}' "scripts/sys/cpu")
|
||||||
(deflisten gpu :initial '{"devices":[{"GRBM2":{}}]}' "scripts/sys/gpu")
|
(deflisten gpu :initial '{"gfx_pct":0,"mem_pct":0,"media_pct":0,"sclk":0,"mclk":0,"sclk_pct":0,"mclk_pct":0,"vclk":0,"vclk_pct":0,"temp":0,"power":0,"vram_used":0,"vram_total":1}' "scripts/sys/gpu")
|
||||||
(deflisten memory :initial '{"human":{"used":"0G","total":"0G"},"used":0.0,"total":1.0}' "scripts/sys/memory")
|
(deflisten memory :initial '{"human":{"used":"0G","total":"0G","cached":"0G"},"used":0.0,"total":1.0,"cached":0.0}' "scripts/sys/memory")
|
||||||
|
|
||||||
(deflisten battery :initial '{"visible":false,"percentage":0.0,"color":"#FFFFFF"}' "scripts/sys/battery")
|
(deflisten battery :initial '{"visible":false,"percentage":0.0,"color":"#FFFFFF"}' "scripts/sys/battery")
|
||||||
|
|
||||||
@@ -8,35 +8,26 @@
|
|||||||
(module
|
(module
|
||||||
(eventbox
|
(eventbox
|
||||||
:onclick "(sleep 0.1 && eww-open-on-current-screen sys --toggle)"
|
:onclick "(sleep 0.1 && eww-open-on-current-screen sys --toggle)"
|
||||||
(box
|
(box :orientation "v"
|
||||||
:orientation "v"
|
(circular-progress
|
||||||
(circular-progress
|
:value {EWW_CPU.avg}
|
||||||
:value {EWW_CPU.avg}
|
:class "cpubar"
|
||||||
:class "cpubar"
|
:width 28 :height 28 :thickness 6
|
||||||
:thickness 6
|
:tooltip "CPU ${round(EWW_CPU.avg, 0)}%")
|
||||||
(label :class "icon-text" :text "C"))
|
(circular-progress
|
||||||
|
:value {gpu.gfx_pct}
|
||||||
(circular-progress
|
:class "gpubar"
|
||||||
:value {gpu.devices[0].GRBM2?.CommandProcessor-Graphics?.value?:0}
|
:width 28 :height 28 :thickness 6
|
||||||
:class "gpubar"
|
:tooltip "GPU ${round(gpu.gfx_pct, 0)}%")
|
||||||
:thickness 6
|
|
||||||
(label :class "icon-text" :text "G"))
|
|
||||||
(circular-progress
|
(circular-progress
|
||||||
:value {100*memory.used/memory.total}
|
:value {100*memory.used/memory.total}
|
||||||
:class "membar"
|
:class "membar"
|
||||||
:thickness 6
|
:width 28 :height 28 :thickness 6
|
||||||
:tooltip "${memory.human.used} / ${memory.human.total}"
|
:tooltip "RAM ${memory.human.used} / ${memory.human.total}")
|
||||||
(label :class "icon-text" :text "M"))
|
|
||||||
|
|
||||||
(circular-progress
|
(circular-progress
|
||||||
:value {battery.percentage}
|
:value {battery.percentage}
|
||||||
:class "batbar"
|
:class "batbar"
|
||||||
:visible {battery.visible}
|
:visible {battery.visible}
|
||||||
:style "color: ${battery.color};"
|
:style "color: ${battery.color};"
|
||||||
:thickness 6
|
:width 28 :height 28 :thickness 6
|
||||||
:tooltip "${battery.status} @ ${battery.wattage}"
|
:tooltip "Bat ${round(battery.percentage, 0)}% · ${battery.status} @ ${battery.wattage}")))))
|
||||||
(label :class "icon-text" :text "B"))
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|||||||
27
modules/home/wayland/apps/eww/bar/scripts/net/bluetooth
Executable file
27
modules/home/wayland/apps/eww/bar/scripts/net/bluetooth
Executable file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
emit() {
|
||||||
|
local powered=false connected=false device=""
|
||||||
|
|
||||||
|
if bluetoothctl show 2>/dev/null | grep -q "Powered: yes"; then
|
||||||
|
powered=true
|
||||||
|
while IFS= read -r line; do
|
||||||
|
mac=$(echo "$line" | awk '{ print $2 }')
|
||||||
|
info=$(bluetoothctl info "$mac" 2>/dev/null)
|
||||||
|
if echo "$info" | grep -q "Connected: yes"; then
|
||||||
|
device=$(echo "$info" | awk -F': ' '/^\tName:/ { print $2; exit }')
|
||||||
|
connected=true
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done < <(bluetoothctl devices 2>/dev/null)
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf '{"powered":%s,"connected":%s,"device":"%s"}\n' "$powered" "$connected" "$device"
|
||||||
|
}
|
||||||
|
|
||||||
|
emit
|
||||||
|
bluetoothctl monitor 2>/dev/null | while IFS= read -r line; do
|
||||||
|
case "$line" in
|
||||||
|
*"Powered"*|*"Connected"*|*"Device"*) emit ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
@@ -1,81 +1,47 @@
|
|||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
function get_time_ms {
|
get_wifi_iface() {
|
||||||
date -u +%s%3N
|
|
||||||
}
|
|
||||||
|
|
||||||
icons=("" "" "" "" "")
|
|
||||||
|
|
||||||
function get_wifi_interface() {
|
|
||||||
awk 'NR > 2 { gsub(":", "", $1); print $1; exit }' /proc/net/wireless
|
awk 'NR > 2 { gsub(":", "", $1); print $1; exit }' /proc/net/wireless
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggle() {
|
signal_icon() {
|
||||||
status=$(rfkill | grep wlan | awk '{print $4}')
|
local dbm="$1"
|
||||||
|
if [ -z "$dbm" ]; then echo ""; return; fi
|
||||||
if [ "$status" = "unblocked" ]; then
|
if [ "$dbm" -ge -50 ]; then echo ""
|
||||||
rfkill block wlan
|
elif [ "$dbm" -ge -60 ]; then echo ""
|
||||||
else
|
elif [ "$dbm" -ge -70 ]; then echo ""
|
||||||
rfkill unblock wlan
|
elif [ "$dbm" -ge -80 ]; then echo ""
|
||||||
fi
|
else echo ""; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function gen_wifi() {
|
make_content() {
|
||||||
wifi_iface=$(get_wifi_interface)
|
local wifi_iface eth_iface
|
||||||
signal=$(awk -v iface="$wifi_iface" '$1 == iface ":" { print $3; exit }' /proc/net/wireless)
|
|
||||||
level=$(awk -v n="$signal" 'BEGIN{print int((n-1)/20)}')
|
wifi_iface=$(get_wifi_iface)
|
||||||
if [ "$level" -gt 4 ]; then
|
eth_iface=$(ip link | awk '/^[0-9]+: en[po]/ { gsub(":",""); print $2; exit }')
|
||||||
level=4
|
|
||||||
|
# Ethernet
|
||||||
|
local eth_connected=false
|
||||||
|
if [ -n "$eth_iface" ]; then
|
||||||
|
eth_state=$(ip link show "$eth_iface" 2>/dev/null | awk '/state/ { print $9 }')
|
||||||
|
[ "$eth_state" = "UP" ] && eth_connected=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
icon=${icons[$level]}
|
# WiFi — use IP presence as connection indicator (more reliable than wpa_cli)
|
||||||
ip="-"
|
local wifi_connected=false wifi_icon="" wifi_ssid=""
|
||||||
class="net-connected"
|
if [ -n "$wifi_iface" ] && ip -4 addr show "$wifi_iface" 2>/dev/null | grep -q "inet "; then
|
||||||
name_raw=$(wpa_cli -g "/run/wpa_supplicant/$wifi_iface" status | grep \^ssid= | sed 's/ssid=//g')
|
wifi_connected=true
|
||||||
name=$(printf "%s" "$name_raw")
|
wifi_ssid=$(wpa_cli -g "/run/wpa_supplicant/$wifi_iface" status 2>/dev/null \
|
||||||
}
|
| awk -F= '/^ssid=/ { print $2 }')
|
||||||
|
signal=$(awk -v iface="$wifi_iface" '$1 == iface ":" { gsub(/\./, "", $4); print $4; exit }' /proc/net/wireless)
|
||||||
function gen_ethernet() {
|
wifi_icon=$(signal_icon "$signal")
|
||||||
icon=""
|
|
||||||
class="net-connected"
|
|
||||||
ip=""
|
|
||||||
name=Wired
|
|
||||||
}
|
|
||||||
|
|
||||||
function make_content() {
|
|
||||||
local ethernet wifi wifi_iface
|
|
||||||
ethernet=$(ip link | rg "^[0-9]+: en[po]+" | head -n1 | sed 's/[a-zA-Z0-9_,><:\ -]*state //g' | sed 's/ mode [a-zA-Z0-9 ]*//g')
|
|
||||||
wifi_iface=$(get_wifi_interface)
|
|
||||||
if [ -n "$wifi_iface" ]; then
|
|
||||||
wifi=$(wpa_cli -g "/run/wpa_supplicant/$wifi_iface" status | rg "^wpa_state=" | sed 's/wpa_state=//g')
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# test ethernet first
|
printf '{"wifi":{"connected":%s,"icon":"%s","ssid":"%s"},"ethernet":{"connected":%s}}\n' \
|
||||||
if [[ $ethernet == "UP" ]]; then
|
"$wifi_connected" "$wifi_icon" "$wifi_ssid" "$eth_connected"
|
||||||
gen_ethernet
|
|
||||||
elif [[ $wifi == "COMPLETED" ]]; then
|
|
||||||
gen_wifi
|
|
||||||
else
|
|
||||||
icon=""
|
|
||||||
ip="-"
|
|
||||||
class="net-disconnected"
|
|
||||||
name="Disconnected"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo '{"icon": "'$icon'", "name": "'$name'", "ip": "'$ip'", "class": "'$class'"}'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$1" = "toggle" ]; then
|
make_content
|
||||||
toggle
|
ip monitor | while read -r _; do
|
||||||
else
|
|
||||||
last_time=$(get_time_ms)
|
|
||||||
make_content
|
make_content
|
||||||
ip monitor | while read -r _; do
|
done
|
||||||
current_time=$(get_time_ms)
|
|
||||||
delta=$((current_time - last_time))
|
|
||||||
if [[ $delta -gt 50 ]]; then
|
|
||||||
make_content
|
|
||||||
last_time=$(get_time_ms)
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|||||||
49
modules/home/wayland/apps/eww/bar/scripts/sys/cpugrid
Normal file
49
modules/home/wayland/apps/eww/bar/scripts/sys/cpugrid
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
COLS=4
|
||||||
|
declare -A prev_idle prev_total
|
||||||
|
|
||||||
|
emit_grid() {
|
||||||
|
local rows=() row_items=()
|
||||||
|
while IFS= read -r line; do
|
||||||
|
[[ $line =~ ^cpu([0-9]+) ]] || continue
|
||||||
|
local core="${BASH_REMATCH[1]}"
|
||||||
|
read -ra f <<< "$line"
|
||||||
|
local idle=$(( f[4] + f[5] ))
|
||||||
|
local total=0
|
||||||
|
for x in "${f[@]:1}"; do (( total += x )); done
|
||||||
|
|
||||||
|
local usage="0.0"
|
||||||
|
if [[ -n "${prev_total[$core]+x}" ]]; then
|
||||||
|
local dt=$(( total - prev_total[$core] ))
|
||||||
|
local di=$(( idle - prev_idle[$core] ))
|
||||||
|
(( dt > 0 )) && usage=$(awk "BEGIN{printf \"%.1f\", 100*(1-$di/$dt)}")
|
||||||
|
fi
|
||||||
|
prev_idle[$core]=$idle
|
||||||
|
prev_total[$core]=$total
|
||||||
|
|
||||||
|
local freq=0
|
||||||
|
local fpath="/sys/devices/system/cpu/cpu${core}/cpufreq/scaling_cur_freq"
|
||||||
|
[[ -r $fpath ]] && freq=$(( $(< "$fpath") / 1000 ))
|
||||||
|
|
||||||
|
row_items+=("{\"core\":$core,\"usage\":$usage,\"freq\":$freq}")
|
||||||
|
|
||||||
|
if (( ${#row_items[@]} == COLS )); then
|
||||||
|
local row; printf -v row '%s,' "${row_items[@]}"; row="${row%,}"
|
||||||
|
rows+=("[$row]")
|
||||||
|
row_items=()
|
||||||
|
fi
|
||||||
|
done < /proc/stat
|
||||||
|
|
||||||
|
if (( ${#row_items[@]} > 0 )); then
|
||||||
|
local row; printf -v row '%s,' "${row_items[@]}"; row="${row%,}"
|
||||||
|
rows+=("[$row]")
|
||||||
|
fi
|
||||||
|
|
||||||
|
local out; printf -v out '%s,' "${rows[@]}"; out="${out%,}"
|
||||||
|
echo "[$out]"
|
||||||
|
}
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
emit_grid
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
3
modules/home/wayland/apps/eww/bar/scripts/sys/cputemp
Executable file
3
modules/home/wayland/apps/eww/bar/scripts/sys/cputemp
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
dir=$(grep -rl k10temp /sys/class/hwmon/*/name 2>/dev/null | head -1 | xargs dirname)
|
||||||
|
awk '{printf "%.0f\n", $1/1000}' "$dir/temp1_input"
|
||||||
@@ -1,3 +1,22 @@
|
|||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env bash
|
||||||
|
amdgpu_top -J -s 5000 | jq -c --unbuffered '.devices[0] | {
|
||||||
amdgpu_top -J -s 5000 | sed 's/ //g'
|
gfx_pct: (.gpu_activity.GFX.value // 0),
|
||||||
|
mem_pct: (.gpu_activity.Memory.value // 0),
|
||||||
|
media_pct: (.gpu_activity.MediaEngine.value // 0),
|
||||||
|
sclk: (.Sensors.GFX_SCLK.value // 0),
|
||||||
|
mclk: (.Sensors.GFX_MCLK.value // 0),
|
||||||
|
sclk_pct: (if (.Info["GPU Clock"].max != .Info["GPU Clock"].min) then
|
||||||
|
100 * ((.Sensors.GFX_SCLK.value // 0) - .Info["GPU Clock"].min) / (.Info["GPU Clock"].max - .Info["GPU Clock"].min)
|
||||||
|
else 0 end),
|
||||||
|
mclk_pct: (if (.Info["Memory Clock"].max != .Info["Memory Clock"].min) then
|
||||||
|
100 * ((.Sensors.GFX_MCLK.value // 0) - .Info["Memory Clock"].min) / (.Info["Memory Clock"].max - .Info["Memory Clock"].min)
|
||||||
|
else 0 end),
|
||||||
|
vclk: (.gpu_metrics.average_vclk_frequency // 0),
|
||||||
|
vclk_pct: (if (.Info["GPU Clock"].max > 0) then
|
||||||
|
100 * (.gpu_metrics.average_vclk_frequency // 0) / .Info["GPU Clock"].max
|
||||||
|
else 0 end),
|
||||||
|
temp: (.Sensors["Edge Temperature"].value // 0),
|
||||||
|
power: (.Sensors["Average Power"].value // 0),
|
||||||
|
vram_used: (.VRAM["Total VRAM Usage"].value // 0),
|
||||||
|
vram_total: (.VRAM["Total VRAM"].value // 1)
|
||||||
|
}'
|
||||||
|
|||||||
@@ -8,5 +8,6 @@ human() {
|
|||||||
|
|
||||||
free --si -s 3 | rg --line-buffered Mem | while read -r line; do
|
free --si -s 3 | rg --line-buffered Mem | while read -r line; do
|
||||||
used=$(echo "$line" | awk '{print $3}')
|
used=$(echo "$line" | awk '{print $3}')
|
||||||
echo '{"human": { "total": "'$(human "$total")'", "used": "'$(human "$used")'"}, "total": "'$total'" , "used": "'$used'"}'
|
cached=$(echo "$line" | awk '{print $6}')
|
||||||
|
echo '{"human": {"total": "'$(human "$total")'", "used": "'$(human "$used")'", "cached": "'$(human "$cached")'"}, "total": "'$total'", "used": "'$used'", "cached": "'$cached'"}'
|
||||||
done
|
done
|
||||||
7
modules/home/wayland/apps/eww/bar/scripts/sys/swap
Executable file
7
modules/home/wayland/apps/eww/bar/scripts/sys/swap
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
free --si | awk '/Swap/ {
|
||||||
|
used=$3; total=$2
|
||||||
|
u = sprintf("%.1fG", used/1000000)
|
||||||
|
t = sprintf("%.1fG", total/1000000)
|
||||||
|
printf "{\"used\":%d,\"total\":%d,\"human\":{\"used\":\"%s\",\"total\":\"%s\"}}\n", used, total, u, t
|
||||||
|
}'
|
||||||
@@ -1,130 +1,212 @@
|
|||||||
|
|
||||||
|
(defpoll swap :interval "5s" "scripts/sys/swap")
|
||||||
|
|
||||||
|
(defpoll cpu-freq-min :interval "60s"
|
||||||
|
"awk '{print $1/1000}' /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq")
|
||||||
|
(defpoll cpu-freq-max :interval "60s"
|
||||||
|
"awk '{print $1/1000}' /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq")
|
||||||
|
(defpoll cpu-temp :interval "2s"
|
||||||
|
"scripts/sys/cputemp")
|
||||||
|
(defpoll cpu-freq-avg :interval "2s"
|
||||||
|
"awk '{sum+=$1; count++} END {printf \"%.1f\", sum/count/1000000}' /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq")
|
||||||
|
|
||||||
|
(deflisten cpu-grid :initial '[[{"core":0,"usage":0,"freq":0}]]'
|
||||||
|
"bash scripts/sys/cpugrid")
|
||||||
|
|
||||||
|
; --- Shared ---
|
||||||
|
|
||||||
|
(defwidget section-header [title accent]
|
||||||
|
(box :orientation "h" :space-evenly false :valign "center" :class "sys-section-header"
|
||||||
|
(box :class "section-accent ${accent}")
|
||||||
|
(label :class "sys-label" :text title)))
|
||||||
|
|
||||||
|
; --- CPU ---
|
||||||
|
|
||||||
|
(defwidget cpu-core-cell [core]
|
||||||
|
(overlay
|
||||||
|
(circular-progress
|
||||||
|
:width 60 :height 60
|
||||||
|
:value {core.usage}
|
||||||
|
:start-at 0
|
||||||
|
:clockwise true
|
||||||
|
:thickness 7
|
||||||
|
:class "cpu-usage-ring")
|
||||||
|
(circular-progress
|
||||||
|
:value {100 * (core.freq - cpu-freq-min) / (cpu-freq-max - cpu-freq-min)}
|
||||||
|
:start-at 0
|
||||||
|
:clockwise true
|
||||||
|
:thickness 4
|
||||||
|
:class "cpu-freq-ring")
|
||||||
|
(box :halign "center" :valign "center"
|
||||||
|
(label :class "cpu-core-label" :text "${core.core}"))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
(defwidget cpu-sys-win []
|
(defwidget cpu-sys-win []
|
||||||
(box
|
(box :orientation "v" :space-evenly false :class "sys-section"
|
||||||
:orientation "v"
|
(section-header :title "CPU" :accent "cpu-accent")
|
||||||
:space-evenly false
|
(box :orientation "v" :space-evenly false :halign "center"
|
||||||
(box :class "sys-label" "CPU")
|
(for row in {cpu-grid}
|
||||||
(box
|
(box :orientation "h" :space-evenly false
|
||||||
:orientation "v"
|
(for core in {row}
|
||||||
(for core in {EWW_CPU.cores}
|
(cpu-core-cell :core {core})))))
|
||||||
(box
|
(box :orientation "h" :space-evenly true :class "gpu-stats-row"
|
||||||
:space-evenly false
|
(box :orientation "v" :halign "center" :space-evenly false
|
||||||
:class "cpu-core ${core.core}"
|
(label :class "gpu-stat-value" :text "${cpu-temp}°C")
|
||||||
(progress
|
(label :class "gpu-stat-label" :text "temp"))
|
||||||
:value {core.usage}
|
(box :orientation "v" :halign "center" :space-evenly false
|
||||||
:orientation "h"
|
(label :class "gpu-stat-value" :text "${cpu-freq-avg}GHz")
|
||||||
:flipped true
|
(label :class "gpu-stat-label" :text "avg clk"))
|
||||||
:class "cpu-core-usage"
|
(box :orientation "v" :halign "center" :space-evenly false
|
||||||
:tooltip "${core.core} @ ${core.freq}Mhz"
|
(label :class "gpu-stat-value" :text "${round(EWW_CPU.avg, 0)}%")
|
||||||
)
|
(label :class "gpu-stat-label" :text "usage")))
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
; --- GPU ---
|
||||||
|
|
||||||
(defwidget gpu-sys-win []
|
(defwidget gpu-sys-win []
|
||||||
(box
|
(box :orientation "v" :space-evenly false :class "sys-section"
|
||||||
:orientation "v"
|
(section-header :title "GPU" :accent "gpu-accent")
|
||||||
:space-evenly false
|
(box :orientation "h" :space-evenly true
|
||||||
(box :class "sys-label" "GPU")
|
; GFX — outer: activity%, inner: clock% of range
|
||||||
(progress
|
(box :orientation "v" :space-evenly false :halign "center"
|
||||||
:value {gpu.devices[0].GRBM2?.CommandProcessor-Compute?.value?:0.0}
|
(overlay
|
||||||
:orientation "h"
|
(circular-progress :width 68 :height 68
|
||||||
:flipped true
|
:value {gpu.gfx_pct}
|
||||||
:class "gpu-core-usage"
|
:start-at 0 :clockwise true :thickness 7
|
||||||
:tooltip "Compute"
|
:class "gpu-ring"
|
||||||
)
|
:tooltip "GFX ${round(gpu.gfx_pct, 1)}%\nClock ${gpu.sclk} MHz (${round(gpu.sclk_pct, 0)}% of range)")
|
||||||
(progress
|
(circular-progress
|
||||||
:value {gpu.devices[0].GRBM2?.CommandProcessor-Fetcher?.value?:0.0}
|
:value {gpu.sclk_pct}
|
||||||
:orientation "h"
|
:start-at 0 :clockwise true :thickness 4
|
||||||
:flipped true
|
:class "gpu-freq-ring")
|
||||||
:class "gpu-core-usage"
|
(box :halign "center" :valign "center"
|
||||||
:tooltip "Fetcher"
|
(label :class "gpu-ring-value" :text "${round(gpu.gfx_pct, 0)}%")))
|
||||||
)
|
(label :class "gpu-ring-label" :text "GFX" :halign "center"))
|
||||||
(progress
|
; Memory — outer: activity%, inner: memory clock% of range
|
||||||
:value {gpu.devices[0].GRBM2?.CommandProcessor-Graphics?.value?:0.0}
|
(box :orientation "v" :space-evenly false :halign "center"
|
||||||
:orientation "h"
|
(overlay
|
||||||
:flipped true
|
(circular-progress :width 68 :height 68
|
||||||
:class "gpu-core-usage"
|
:value {gpu.mem_pct}
|
||||||
:tooltip "Graphics"
|
:start-at 0 :clockwise true :thickness 7
|
||||||
)
|
:class "gpu-ring"
|
||||||
(box :class "spacer")
|
:tooltip "Memory ${round(gpu.mem_pct, 1)}%\nClock ${gpu.mclk} MHz (${round(gpu.mclk_pct, 0)}% of range)")
|
||||||
(progress
|
(circular-progress
|
||||||
:value {gpu.devices[0]?.gpu_activity?.GFX?.value?:0.0}
|
:value {gpu.mclk_pct}
|
||||||
:orientation "h"
|
:start-at 0 :clockwise true :thickness 4
|
||||||
:flipped true
|
:class "gpu-freq-ring")
|
||||||
:class "gpu-core-usage"
|
(box :halign "center" :valign "center"
|
||||||
:tooltip "GFX"
|
(label :class "gpu-ring-value" :text "${round(gpu.mem_pct, 0)}%")))
|
||||||
)
|
(label :class "gpu-ring-label" :text "Mem" :halign "center"))
|
||||||
(progress
|
; Media — outer: activity%, inner: video clock% of GPU clock max
|
||||||
:value {gpu.devices[0]?.gpu_activity?.Memory?.value?:0.0}
|
(box :orientation "v" :space-evenly false :halign "center"
|
||||||
:orientation "h"
|
(overlay
|
||||||
:flipped true
|
(circular-progress :width 68 :height 68
|
||||||
:class "gpu-core-usage"
|
:value {gpu.media_pct}
|
||||||
:tooltip "Memory"
|
:start-at 0 :clockwise true :thickness 7
|
||||||
)
|
:class "gpu-ring"
|
||||||
(progress
|
:tooltip "Media Engine ${round(gpu.media_pct, 1)}%\nVideo Clock ${gpu.vclk} MHz")
|
||||||
:value {gpu.devices[0]?.gpu_activity?.MediaEngine?.value?:0.0}
|
(circular-progress
|
||||||
:orientation "h"
|
:value {gpu.vclk_pct}
|
||||||
:flipped true
|
:start-at 0 :clockwise true :thickness 4
|
||||||
:class "gpu-core-usage"
|
:class "gpu-freq-ring")
|
||||||
:tooltip "Media"
|
(box :halign "center" :valign "center"
|
||||||
)
|
(label :class "gpu-ring-value" :text "${round(gpu.media_pct, 0)}%")))
|
||||||
(box :class "spacer")
|
(label :class "gpu-ring-label" :text "Med" :halign "center")))
|
||||||
(progress
|
(box :orientation "v" :space-evenly false :class "vram-row"
|
||||||
:value {100*(gpu.devices[0]?.VRAM?.TotalVRAMUsage?.value?:0.0)/(gpu.devices[0]?.VRAM?.TotalVRAM?.value?:1.0)}
|
(progress
|
||||||
:orientation "h"
|
:value {100 * gpu.vram_used / gpu.vram_total}
|
||||||
:flipped true
|
:orientation "h" :flipped true :hexpand true
|
||||||
:class "gpu-core-usage"
|
:class "vram-bar"
|
||||||
:tooltip "VRAM"
|
:tooltip "VRAM ${round(100 * gpu.vram_used / gpu.vram_total, 1)}%")
|
||||||
|
(box :orientation "h" :space-evenly false
|
||||||
|
(label :class "vram-usage-label" :halign "start" :hexpand true :text "VRAM")
|
||||||
|
(label :class "vram-usage-label" :halign "end"
|
||||||
|
:text "${round(gpu.vram_used / 1024, 1)} / ${round(gpu.vram_total / 1024, 1)} GiB")))
|
||||||
|
(box :orientation "h" :space-evenly true :class "gpu-stats-row"
|
||||||
|
(box :orientation "v" :halign "center" :space-evenly false
|
||||||
|
(label :class "gpu-stat-value" :text "${gpu.temp}°C")
|
||||||
|
(label :class "gpu-stat-label" :text "temp"))
|
||||||
|
(box :orientation "v" :halign "center" :space-evenly false
|
||||||
|
(label :class "gpu-stat-value" :text "${gpu.power}W")
|
||||||
|
(label :class "gpu-stat-label" :text "power")))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
; --- RAM ---
|
||||||
|
|
||||||
|
(defwidget ram-sys-win []
|
||||||
|
(box :orientation "v" :space-evenly false :class "sys-section"
|
||||||
|
(section-header :title "RAM" :accent "ram-accent")
|
||||||
|
(box :orientation "h" :space-evenly false :halign "center" :spacing 16 :valign "center"
|
||||||
|
(overlay
|
||||||
|
(circular-progress
|
||||||
|
:width 88 :height 88
|
||||||
|
:value {100*memory.used/memory.total}
|
||||||
|
:start-at 0
|
||||||
|
:clockwise true
|
||||||
|
:thickness 9
|
||||||
|
:class "ram-ring"
|
||||||
|
:tooltip "RAM\nUsed ${memory.human.used} / ${memory.human.total}\nCached ${memory.human.cached}")
|
||||||
|
(circular-progress
|
||||||
|
:value {100*memory.cached/memory.total}
|
||||||
|
:start-at {100*memory.used/memory.total}
|
||||||
|
:clockwise true
|
||||||
|
:thickness 9
|
||||||
|
:class "ram-cached-ring")
|
||||||
|
(box :orientation "v" :valign "center" :halign "center" :space-evenly false
|
||||||
|
(label :class "ram-used-label" :text "${memory.human.used}")
|
||||||
|
(label :class "ram-total-label" :text "${memory.human.total}")))
|
||||||
|
(box :orientation "v" :space-evenly false :halign "center" :valign "center"
|
||||||
|
(overlay
|
||||||
|
(circular-progress
|
||||||
|
:width 60 :height 60
|
||||||
|
:value {100*swap.used/swap.total}
|
||||||
|
:start-at 0 :clockwise true :thickness 7
|
||||||
|
:class "swap-ring"
|
||||||
|
:tooltip "Swap\n${swap.human.used} / ${swap.human.total}")
|
||||||
|
(box :orientation "v" :valign "center" :halign "center" :space-evenly false
|
||||||
|
(label :class "ram-used-label" :text "${swap.human.used}")
|
||||||
|
(label :class "ram-total-label" :text "${swap.human.total}"))))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
(defwidget ram-sys-win []
|
; --- Battery ---
|
||||||
(box
|
|
||||||
:orientation "v"
|
(defwidget bat-sys-win []
|
||||||
:space-evenly false
|
(box :orientation "v" :space-evenly false :class "sys-section" :visible {battery.visible}
|
||||||
(box :class "sys-label" "RAM")
|
(section-header :title "Battery" :accent "bat-accent")
|
||||||
(progress
|
(overlay
|
||||||
:value {100*memory.used/memory.total}
|
(circular-progress
|
||||||
:orientation "h"
|
:width 60 :height 60
|
||||||
:flipped true
|
:value {battery.percentage}
|
||||||
:class "memory-usage"
|
:start-at 0
|
||||||
:tooltip "RAM"
|
:clockwise true
|
||||||
)
|
:thickness 6
|
||||||
|
:class "bat-ring"
|
||||||
|
:style "color: ${battery.color};"
|
||||||
|
:tooltip "Battery ${round(battery.percentage, 0)}%\n${battery.status} @ ${battery.wattage}")
|
||||||
|
(label :class "bat-ring-label"
|
||||||
|
:text "${round(battery.percentage, 0)}%"))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
; --- Root ---
|
||||||
|
|
||||||
(defwidget sys-win []
|
(defwidget sys-win []
|
||||||
(box
|
(box
|
||||||
:class "sys-win"
|
:class "sys-win"
|
||||||
:space-evenly false
|
:space-evenly false
|
||||||
:orientation "h"
|
:orientation "v"
|
||||||
(box
|
(cpu-sys-win)
|
||||||
:space-evenly false
|
(box :class "section-sep")
|
||||||
:orientation "v"
|
(gpu-sys-win)
|
||||||
(cpu-sys-win)
|
(box :class "section-sep")
|
||||||
(box :class "spacer")
|
(ram-sys-win)
|
||||||
(box :class "spacer")
|
(box :class "section-sep" :visible {battery.visible})
|
||||||
(gpu-sys-win)
|
(bat-sys-win)
|
||||||
(box :class "spacer")
|
|
||||||
(box :class "spacer")
|
|
||||||
(ram-sys-win)
|
|
||||||
)
|
|
||||||
(box
|
|
||||||
:visible {battery.visible}
|
|
||||||
:height 200
|
|
||||||
(graph
|
|
||||||
:height 200
|
|
||||||
:value {battery.percentage}
|
|
||||||
:time-range "30min"
|
|
||||||
:min "0.0"
|
|
||||||
:max "100.0"
|
|
||||||
:dynamic true
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -134,7 +216,7 @@
|
|||||||
:geometry (geometry
|
:geometry (geometry
|
||||||
:x "0%"
|
:x "0%"
|
||||||
:y "0%"
|
:y "0%"
|
||||||
:anchor "bottom right"
|
:anchor "bottom right"
|
||||||
:width "0px"
|
:width "320px"
|
||||||
:height "0px")
|
:height "0px")
|
||||||
(window (sys-win)))
|
(window (sys-win)))
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ ... }: {
|
{ ... }: {
|
||||||
services.fwupd.enable = true;
|
services.fwupd.enable = true;
|
||||||
hardware.enableAllFirmware = true;
|
hardware.enableAllFirmware = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user