From: Samir Benmendil Date: Mon, 30 Jan 2017 01:14:50 +0000 (+0000) Subject: awesome: use pomodoro again X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/f17cc00a01932a3a5e34ff1e3d4acd1272b079e4?ds=inline awesome: use pomodoro again --- diff --git a/.gitmodules b/.gitmodules index 388b2d8..ab22f2a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/awesome/topbar.lua b/awesome/topbar.lua index 84e30ac..571e5c9 100644 --- a/awesome/topbar.lua +++ b/awesome/topbar.lua @@ -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 index 0000000..c2f8eae --- /dev/null +++ b/awesome/widgets/pomodoro @@ -0,0 +1 @@ +Subproject commit c2f8eae0f97f66206cf6999eadbb6d18c21f5970 diff --git a/awesome/widgets/pomodoro.lua b/awesome/widgets/pomodoro.lua new file mode 100644 index 0000000..942967d --- /dev/null +++ b/awesome/widgets/pomodoro.lua @@ -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 " "..t.."" 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