]> git.rmz.io Git - dotfiles.git/commitdiff
awesome: use pomodoro again
authorSamir Benmendil <me@rmz.io>
Mon, 30 Jan 2017 01:14:50 +0000 (01:14 +0000)
committerSamir Benmendil <me@rmz.io>
Mon, 30 Jan 2017 01:14:50 +0000 (01:14 +0000)
.gitmodules
awesome/topbar.lua
awesome/widgets/pomodoro [new submodule]
awesome/widgets/pomodoro.lua [new file with mode: 0644]

index 388b2d8e7c68ea9047f9734397b394f53cc4cea9..ab22f2ab05637c2281d752c78e95372c547e80ba 100644 (file)
@@ -22,3 +22,6 @@
 [submodule "weechat/lua/matrix"]
        path = weechat/lua/matrix
        url = https://github.com/torhve/weechat-matrix-protocol-script
+[submodule "awesome/widgets/pomodoro"]
+       path = awesome/widgets/pomodoro
+       url = git@github.com:ram-z/awesome-pomodoro
index 84e30ac7b42680eeeb01938cca154c8707ef4a17..571e5c92bd4fd0285d8c4b79f172ef6864a9f0b5 100644 (file)
@@ -89,6 +89,8 @@ awful.screen.connect_for_each_screen(function(s)
     local right_layout = wibox.layout.fixed.horizontal()
     right_layout:add(wibox.widget.systray())
     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.has_battery() then
diff --git a/awesome/widgets/pomodoro b/awesome/widgets/pomodoro
new file mode 160000 (submodule)
index 0000000..c2f8eae
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit c2f8eae0f97f66206cf6999eadbb6d18c21f5970
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