Skip to content

Instantly share code, notes, and snippets.

@ak-seyam
Last active November 16, 2021 00:55
Show Gist options
  • Save ak-seyam/1a44dd91861d82ec007114b88071956c to your computer and use it in GitHub Desktop.
Save ak-seyam/1a44dd91861d82ec007114b88071956c to your computer and use it in GitHub Desktop.
Hello world awesome widget (A timer)
-- this can be considerd as a hello world that does somthing example for awesome wibar widgets
-- you can modify this slightly to make some useful widgets (i.e. pomodoro widget)
local textbox = require("wibox.widget.textbox")
local timer = require("gears.timer")
local counter = 10
local w = textbox()
local function update_timer()
w.text = "⌚: " .. counter
if counter == 0 then
timer:connect_signal("timer::stop")
end
counter = counter - 1
end
timer {
timeout = 1,
call_now = true,
autostart = true,
callback = update_timer
}
return w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment