mirror of
https://github.com/elenapan/dotfiles.git
synced 2026-01-22 07:38:50 +08:00
17 lines
461 B
Lua
17 lines
461 B
Lua
-- Provides:
|
|
-- evil::uptime
|
|
-- uptime (string)
|
|
local awful = require("awful")
|
|
|
|
local update_interval = 60
|
|
local uptime_script = [[
|
|
sh -c "
|
|
uptime -p | sed 's/^...//;s/ weeks\?,/w/;s/ days\?,/d/;s/ hours\?,/h/;s/ minutes\?/m/'
|
|
"]]
|
|
|
|
-- Periodically get uptime
|
|
awful.widget.watch(uptime_script, update_interval, function(widget, stdout)
|
|
local uptime = string.gsub(stdout, '^%s*(.-)%s*$', '%1')
|
|
awesome.emit_signal("evil::uptime", uptime)
|
|
end)
|
|
|