mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-12-05 03:22:32 +01:00
waybar: scan sysfs for CPU hwmon
This commit is contained in:
parent
45ad0a5c8b
commit
d6008d9d17
3 changed files with 16 additions and 4 deletions
|
@ -1,5 +1,19 @@
|
|||
;<! tmpl:setPostProcessor(opt.fennelToJSON) !>
|
||||
;; vim: ft=fennel
|
||||
<!
|
||||
local cpu_temp_hwmon = nil
|
||||
for d in require("lfs").dir("/sys/class/hwmon") do
|
||||
if d ~= "." and d ~= ".." then
|
||||
local namef = io.open("/sys/class/hwmon/" .. d .. "/name", "r")
|
||||
|
||||
if namef:read("*a"):gsub("%s+", "") == "coretemp" then
|
||||
cpu_temp_hwmon = "/sys/class/hwmon/" .. d .. "/temp1_input"
|
||||
end
|
||||
|
||||
namef:close()
|
||||
end
|
||||
end
|
||||
!>
|
||||
(local format-icons ["▁" "▂" "▃" "▄" "▅" "▆" "▇" "█"])
|
||||
|
||||
{:spacing 4
|
||||
|
@ -41,7 +55,7 @@
|
|||
:interval 2
|
||||
: format-icons}
|
||||
:memory {:format "{}% "}
|
||||
:temperature {:hwmon-path "<% opt.cpu_temp_hwmon %>"
|
||||
:temperature {:hwmon-path "<% cpu_temp_hwmon %>"
|
||||
:critical-threshold 80
|
||||
:format "{temperatureC}°C {icon}"
|
||||
:format-icons ["" "" ""]}
|
||||
|
|
|
@ -47,9 +47,6 @@ opts.cursor = {
|
|||
size = 24,
|
||||
}
|
||||
|
||||
-- hwmon temperature path for CPU temp used by waybar
|
||||
opts.cpu_temp_hwmon = "/sys/class/hwmon/hwmon0/temp1_input"
|
||||
|
||||
opts.gtk_theme = "catppuccin-mocha-red-standard"
|
||||
opts.icon_theme = "candy-icons"
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
libGL
|
||||
libgit2
|
||||
luajit
|
||||
luajitPackages.luafilesystem
|
||||
pkg-config
|
||||
racket
|
||||
roswell
|
||||
|
|
Loading…
Reference in a new issue