summaryrefslogtreecommitdiff
path: root/.config/awesome/large_clock.lua
blob: 564bfb118c45e8d608866f4e04962c0c7f1cd21f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
local gears = require("gears")
local awful = require("awful")
local textclock = require("wibox.widget.textclock")

local large_clock_widget = { mt = {} }

function large_clock_widget.mt:__call(...)
    local clock = textclock("<span size=\"100pt\">%H:%M</span>", 60, nil)

    local popup = awful.popup {
        ontop = true,
        visible = false,
        border_width = 1,
        widget = clock,
        placement = function(p)
            awful.placement.top_right(p, { margins = { top = 30 }, parent = awful.screen.focused() })
        end
    }

    function popup:toggle()
        if self.visible then
            self.visible = false
        else
            self.visible = true
        end
    end

    return popup
end

return setmetatable(large_clock_widget, large_clock_widget.mt)