]> git.rmz.io Git - dotfiles.git/blobdiff - awesome/widgets/pomodoro.lua
awesome: use pomodoro again
[dotfiles.git] / awesome / widgets / pomodoro.lua
diff --git a/awesome/widgets/pomodoro.lua b/awesome/widgets/pomodoro.lua
new file mode 100644 (file)
index 0000000..942967d
--- /dev/null
@@ -0,0 +1,28 @@
+local pomodoro = require("widgets/pomodoro/init")
+local wibox = require("wibox")
+
+-- durations in seconds
+pomodoro.short_pause_duration = 0.5 * 60
+pomodoro.long_pause_duration = 1 * 60
+pomodoro.work_duration = 1 * 60
+
+-- format string
+pomodoro.format = function (t) return " <b>"..t.."</b>" end
+
+pomodoro.init()
+
+pombox = wibox.layout.fixed.horizontal()
+pombox:add(pomodoro.icon_widget)
+pombox:add(pomodoro.widget)
+
+--TODO connect signals to something sensible  (sb:20170130)
+pomodoro:connect_signal("stop_working",  function () naughty.notify{ text = "stop_working",  timeout = 10 } end)
+pomodoro:connect_signal("stop_pause",    function () naughty.notify{ text = "stop_pause",    timeout = 10 } end)
+pomodoro:connect_signal("start_working", function () naughty.notify{ text = "start_working", timeout = 10 } end)
+pomodoro:connect_signal("start_pause",   function () naughty.notify{ text = "start_pause",   timeout = 10 } end)
+
+globalkeys = awful.util.table.join(globalkeys,
+    awful.key({ modkey, "Shift" }, "p", function() pomodoro:start() end)
+)
+
+return pombox