]> git.rmz.io Git - dotfiles.git/commitdiff
awesome: add pomodoro widget
authorSamir Benmendil <samir.benmendil@gmail.com>
Thu, 4 Jun 2015 21:59:20 +0000 (22:59 +0100)
committerSamir Benmendil <samir.benmendil@gmail.com>
Thu, 4 Jun 2015 21:59:20 +0000 (22:59 +0100)
awesome/topbar.lua
awesome/widgets/pomodoro [new submodule]
awesome/widgets/pomodoro.lua [new file with mode: 0644]

index 7986af062689ae0f357d1f6e3a0e298e2fbc2984..91b04faccb6c399ca708b7de9006e8aac73bef0b 100644 (file)
@@ -89,6 +89,8 @@ for s = 1, screen.count() do
     local right_layout = wibox.layout.fixed.horizontal()
     if s == 1 then right_layout:add(wibox.widget.systray()) end
     right_layout:add(separator)
+    right_layout:add(require("widgets/pomodoro"))
+    right_layout:add(separator)
     right_layout:add(require("widgets/awesompd"))
     right_layout:add(require("widgets/volume_widget"))
     if utils.host == "chronos" then
diff --git a/awesome/widgets/pomodoro b/awesome/widgets/pomodoro
new file mode 160000 (submodule)
index 0000000..a861385
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit a861385355d0ac10091eda49757fc9eda05480a3
diff --git a/awesome/widgets/pomodoro.lua b/awesome/widgets/pomodoro.lua
new file mode 100644 (file)
index 0000000..3c7af63
--- /dev/null
@@ -0,0 +1,22 @@
+local pomodoro = require("widgets/pomodoro/init")
+local wibox = require("wibox")
+
+-- durations in seconds
+pomodoro.short_pause_duration = 5 * 60
+pomodoro.long_pause_duration = 30 * 60
+pomodoro.work_duration = 25 * 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)
+
+globalkeys = awful.util.table.join(globalkeys,
+    awful.key({ modkey, "Shift" }, "p", function() pomodoro:start() end)
+)
+
+return pombox