New Setup 📦
This commit is contained in:
parent
d16174b447
commit
415dbd08a1
10194 changed files with 1368647 additions and 4 deletions
48
home/.config/awesome/ui/sidebar/uptime.lua
Normal file
48
home/.config/awesome/ui/sidebar/uptime.lua
Normal file
|
@ -0,0 +1,48 @@
|
|||
-- ## Uptime ##
|
||||
-- ~~~~~~~~~~~~
|
||||
|
||||
-- Requirements :
|
||||
-- ~~~~~~~~~~~~~~
|
||||
local awful = require("awful")
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
local beautiful = require ("beautiful")
|
||||
local dpi = beautiful.xresources.apply_dpi
|
||||
|
||||
-- Icon
|
||||
local icon = wibox.widget.textbox()
|
||||
icon.font = "Roboto Medium 24"
|
||||
icon.align = 'center'
|
||||
icon.markup = "<span foreground='"..colors.yellow.."'></span>"
|
||||
|
||||
-- Uptime
|
||||
local uptime = wibox.widget.textbox()
|
||||
uptime.font = "Roboto Medium 16"
|
||||
uptime.align = 'center'
|
||||
|
||||
local function get_uptime()
|
||||
local script = [[
|
||||
uptime -p
|
||||
]]
|
||||
|
||||
awful.spawn.easy_async_with_shell(script, function(stdout)
|
||||
stdout = string.gsub(stdout, "\n", "")
|
||||
uptime.markup = stdout
|
||||
end)
|
||||
end
|
||||
|
||||
gears.timer {
|
||||
timeout = 60,
|
||||
autostart = true,
|
||||
call_now = true,
|
||||
callback = function()
|
||||
get_uptime()
|
||||
end
|
||||
}
|
||||
|
||||
return wibox.widget {
|
||||
icon,
|
||||
uptime,
|
||||
spacing = dpi(10),
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue