luca-awesome-dotfiles/home/.config/awesome/ui/widgets/temprature.lua
Hydroxycarbamide 2401cfcee2 Add revelation
Update and add bling task_preview, tag_preview and window_switcher
Add catppuccin-macchiato
Use my weather key
Update keybindings
Update autorun
Fix sliders
2023-03-20 09:51:48 +01:00

46 lines
1.1 KiB
Lua

-- ## Temprature ##
-- ~~~~~~~~~~~~~~~~
-- Requirements :
-- ~~~~~~~~~~~~~~
local wibox = require('wibox')
local watch = require('awful.widget.watch')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
-- # Libs :
-- ~~~~~~~~
local helpers = require("libs.helpers")
local temprature = wibox.widget.textbox()
temprature.font = theme.font
watch([[ bash -c "sensors | grep 'Tctl:' | awk '{print $2}'" ]], 30, function(_, stdout)
local temp_num = tonumber(stdout:match("%d+"))
if temp_num == nil then
temp_num = -1
end
temprature.text = math.floor(temp_num) .. "°C"
end)
-- Icon :
local widget_icon = ""
local icon = wibox.widget {
font = theme.icon_font,
markup = helpers.colorize_text(widget_icon, colors.main_scheme),
widget = wibox.widget.textbox,
valign = "center",
align = "center"
}
return wibox.widget {
icon,
wibox.widget {
temprature,
fg = colors.brightwhite,
widget = wibox.container.background
},
spacing = dpi(2),
layout = wibox.layout.fixed.horizontal
}