]> git.rmz.io Git - dotfiles.git/blob - awesome/widgets/pomodoro.lua
pomodoro: show started task in pomodoro widget
[dotfiles.git] / awesome / widgets / pomodoro.lua
1 local pomodoro = require("widgets/pomodoro/init")
2 local wibox = require("wibox")
3 local awful = require("awful")
4 local utils = require("utils")
5
6 -- durations in seconds
7 pomodoro.short_pause_duration = 5 * 60
8 pomodoro.long_pause_duration = 30 * 60
9 pomodoro.work_duration = 25 * 60
10
11 -- format string
12 pomodoro.format = function (t) return " <b>"..t.."</b>" end
13 pomodoro.auto_start_pomodoro = true
14
15 pomodoro.init()
16
17 local pombox = wibox.layout.fixed.horizontal()
18 pombox:add(wibox.widget {
19 layout = wibox.layout.align.horizontal,
20 forced_width = 200,
21 expand = "outside",
22 nil,
23 {
24 layout = wibox.container.scroll.horizontal,
25 max_size = 200,
26 extra_space = 10,
27 step_function = wibox.container.scroll.step_functions.linear_increase,
28 speed = 20,
29 {
30 -- TODO: make this context aware
31 widget = awful.widget.watch('task +ACTIVE _unique description',
32 1,
33 function(widget, stdout)
34 if not stdout or stdout == "" then
35 stdout = "No task started!"
36 end
37 widget:set_markup('<b>'..stdout..'</b>')
38 end)
39 },
40 },
41 nil,
42 })
43 pombox:add(pomodoro.icon_widget)
44 pombox:add(pomodoro.widget)
45
46 --TODO connect signals to something sensible (sb:20170130)
47 -- pomodoro:connect_signal("stop_working", function () naughty.notify{ text = "stop_working", timeout = 10 } end)
48 -- pomodoro:connect_signal("stop_pause", function () naughty.notify{ text = "stop_pause", timeout = 10 } end)
49 -- pomodoro:connect_signal("start_working", function () naughty.notify{ text = "start_working", timeout = 10 } end)
50 pomodoro:connect_signal("work_stop", function ()
51 awful.spawn(terminal, {floating = true, placement = awful.centered })
52 end)
53
54 globalkeys = gears.table.join(globalkeys,
55 awful.key({ modkey, "Shift" }, "p", function() pomodoro:toggle() end)
56 )
57
58 return pombox