Spruced up the pomodoro module.

Added icons/colors to the pomodoro module and shortened the display text.
This commit is contained in:
Karthik Chikmagalur 2019-09-28 16:27:26 -07:00
parent 3c1f127fef
commit d6072d0eb7
21 changed files with 361 additions and 90 deletions

View file

@ -7,6 +7,7 @@ Right click will cancel the timer.
from __future__ import absolute_import
import datetime
from math import ceil
import bumblebee.input
import bumblebee.output
@ -15,12 +16,13 @@ import bumblebee.engine
class Module(bumblebee.engine.Module):
def __init__(self, engine, config):
widgets = bumblebee.output.Widget(full_text=self.text)
self.remaining_time = datetime.timedelta(minutes=25)
self.remaining_time_str = "{}min{}s ".format(int((self.remaining_time.seconds / 60)),
round((self.remaining_time.seconds/60) % 1*60))
self._work_period = 25
self._play_period = 5
self.remaining_time = datetime.timedelta(minutes=self._work_period)
self.remaining_time_str = "{}m ".format(ceil((self.remaining_time.seconds / 60)))
self.time = None
self.pomodoro = { "state":"OFF", "type": "n/a"}
self._text = self.remaining_time_str + self.pomodoro["type"] + " " + self.pomodoro["state"]
self.pomodoro = { "state":"OFF", "type": ""}
self._text = self.remaining_time_str + self.pomodoro["type"]
super(Module, self).__init__(engine, config, widgets)
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
cmd=self.timer_play_pause)
@ -38,21 +40,20 @@ class Module(bumblebee.engine.Module):
self.time = datetime.datetime.now()
if self.remaining_time.seconds <= 0:
if self.pomodoro["type"] == "WORK":
self.pomodoro["type"] = "PLAY"
self.remaining_time = datetime.timedelta(minutes=25)
elif self.pomodoro["type"] == "PLAY":
self.pomodoro["type"] = "WORK"
self.remaining_time = datetime.timedelta(minutes=5)
if self.pomodoro["type"] == "Work":
self.pomodoro["type"] = "Break"
self.remaining_time = datetime.timedelta(minutes=self._work_period)
elif self.pomodoro["type"] == "Break":
self.pomodoro["type"] = "Work"
self.remaining_time = datetime.timedelta(minutes=self._play_period)
self.remaining_time_str = "{}min{}s ".format(int((self.remaining_time.seconds / 60)),
round((self.remaining_time.seconds / 60) % 1 * 60))
self._text = self.remaining_time_str + self.pomodoro["type"] + " " + self.pomodoro["state"]
self.remaining_time_str = "{}m ".format(ceil((self.remaining_time.seconds / 60)))
self._text = self.remaining_time_str + self.pomodoro["type"]
def timer_play_pause(self, widget):
if self.pomodoro["state"] == "OFF":
self.pomodoro = {"state": "ON", "type": "WORK"}
self.remaining_time = datetime.timedelta(minutes=25)
self.pomodoro = {"state": "ON", "type": "Work"}
self.remaining_time = datetime.timedelta(minutes=self._work_period)
self.time = datetime.datetime.now()
elif self.pomodoro["state"] == "ON":
self.pomodoro["state"] = "PAUSED"
@ -64,5 +65,13 @@ class Module(bumblebee.engine.Module):
def timer_reset(self, widget):
if self.pomodoro["state"] == "ON" or self.pomodoro["state"] == "PAUSED":
self.pomodoro = {"state":"OFF", "type": "n/a" }
self.remaining_time = datetime.timedelta(minutes=25)
self.pomodoro = {"state":"OFF", "type": "" }
self.remaining_time = datetime.timedelta(minutes=self._work_period)
def state(self, widget):
state = [];
state.append(self.pomodoro["state"].lower())
if self.pomodoro["state"] == "ON" or self.pomodoro["state"] == "OFF":
state.append(self.pomodoro["type"].lower())
return state

View file

@ -26,5 +26,17 @@
"fg": "#002b36",
"bg": "#859900"
}
},
"pomodoro": {
"paused": {
"fg": "#002b36",
"bg": "#b58900"
},
"break": {
"fg": "#002b36",
"bg": "#859900"
}
}
}

View file

@ -42,5 +42,20 @@
"fg": "#002b36",
"bg": "#859900"
}
},
"pomodoro": {
"paused": {
"fg": "#002b36",
"bg": "#b58900"
},
"work": {
"fg": "#1d2021",
"bg": "#b8bb26"
},
"break": {
"fg": "#002b36",
"bg": "#859900"
}
}
}

View file

@ -54,5 +54,20 @@
"modified": { "bg": "#458588" },
"deleted": { "bg": "#9d0006" },
"new": { "bg": "#b16286" }
},
"pomodoro": {
"paused": {
"fg": "#1d2021",
"bg": "#d79921"
},
"work": {
"fg": "#1d2021",
"bg": "#b8bb26"
},
"break": {
"fg": "#002b36",
"bg": "#859900"
}
}
}

View file

@ -54,5 +54,19 @@
"modified": { "bg": "#458588" },
"deleted": { "bg": "#9d0006" },
"new": { "bg": "#b16286" }
},
"pomodoro": {
"paused": {
"fg": "#1d2021",
"bg": "#d79921"
},
"work": {
"fg": "#1d2021",
"bg": "#b8bb26"
},
"break": {
"fg": "#002b36",
"bg": "#859900"
}
}
}

View file

@ -54,5 +54,19 @@
"modified": { "bg": "#458588" },
"deleted": { "bg": "#9d0006" },
"new": { "bg": "#b16286" }
},
"pomodoro": {
"paused": {
"fg": "#1d2021",
"bg": "#d79921"
},
"work": {
"fg": "#1d2021",
"bg": "#b8bb26"
},
"break": {
"fg": "#002b36",
"bg": "#859900"
}
}
}

View file

@ -54,5 +54,20 @@
"modified": { "bg": "#458588" },
"deleted": { "bg": "#9d0006" },
"new": { "bg": "#b16286" }
},
"pomodoro": {
"paused": {
"fg": "#1d2021",
"bg": "#d79921"
},
"work": {
"fg": "#1d2021",
"bg": "#b8bb26"
},
"break": {
"fg": "#002b36",
"bg": "#859900"
}
}
}

View file

@ -47,5 +47,20 @@
"fg": "#0f1117",
"bg": "#84a0c6"
}
},
"pomodoro": {
"paused": {
"fg": "#0f1117",
"bg": "#e2a478"
},
"work": {
"fg": "#1d2021",
"bg": "#b8bb26"
},
"break": {
"fg": "#b4be82",
"bg": "#161821"
}
}
}

View file

@ -46,5 +46,19 @@
"fg": "#0f1117",
"bg": "#84a0c6"
}
},
"pomodoro": {
"paused": {
"fg": "#0f1117",
"bg": "#e2a478"
},
"work": {
"fg": "#1d2021",
"bg": "#b8bb26"
},
"break": {
"fg": "#89b8c2",
"bg": "#161821"
}
}
}

View file

@ -46,5 +46,20 @@
"fg": "#89b8c2",
"bg": "#161821"
}
},
"pomodoro": {
"paused": {
"fg": "#e2a478",
"bg": "#c6c8d1"
},
"work": {
"fg": "#89b8c2",
"bg": "#161821"
},
"break": {
"fg": "#b4be82",
"bg": "#161821"
}
}
}

View file

@ -40,5 +40,20 @@
"fg": "#89b8c2",
"bg": "#161821"
}
},
"pomodoro": {
"paused": {
"fg": "#0f1117",
"bg": "#e2a478"
},
"work": {
"fg": "#1d2021",
"bg": "#b8bb26"
},
"break": {
"fg": "#89b8c2",
"bg": "#161821"
}
}
}

View file

@ -302,6 +302,10 @@
},
"system": {
"prefix": "system"
},
"pomodoro": {
"off": { "prefix": "pom" },
"paused": { "prefix": "||" },
"on": { "prefix": " >" }
}
}

View file

@ -222,5 +222,10 @@
},
"rss": {
"prefix": ""
},
"pomodoro": {
"off": { "prefix": "🍅" },
"paused": { "prefix": "" },
"on": { "prefix": "" }
}
}

View file

@ -185,5 +185,11 @@
},
"rss": {
"prefix": "\uf1ea"
},
"pomodoro": {
"off": { "prefix": "\uf24f" },
"paused": { "prefix": "\uf210" },
"on": { "prefix": "\uf488" }
}
}

View file

@ -36,5 +36,20 @@
"fg": "#282C34",
"bg": "#98C379"
}
},
"pomodoro": {
"paused": {
"fg": "#282C34",
"bg": "#E5C07B"
},
"work": {
"fg": "#98C379",
"bg": "#282C34"
},
"break": {
"fg": "#282C34",
"bg": "#98C379"
}
}
}

View file

@ -43,5 +43,20 @@
"fg": "#494949",
"bg": "#41db00"
}
},
"pomodoro": {
"paused": {
"fg": "#d75f00",
"bg": "#ffd700"
},
"work": {
"fg": "#ffd700",
"bg": "#d75f00"
},
"break": {
"fg": "#494949",
"bg": "#41db00"
}
}
}

View file

@ -40,5 +40,20 @@
},
"cmus": {
"bg": "#C42021"
},
"pomodoro": {
"paused": {
"fg": "#FDFFFC",
"bg": "#B91372"
},
"work": {
"fg": "#FDFFFC",
"bg": "#41EAD4"
},
"break": {
"fg": "#FDFFFC",
"bg": "#011627"
}
}
}

View file

@ -45,5 +45,19 @@
"modified": { "bg": "#2aa198" },
"deleted": { "bg": "#d33682" },
"new": { "bg": "#859900" }
},
"pomodoro": {
"paused": {
"fg": "#002b36",
"bg": "#b58900"
},
"work": {
"fg": "#eee8d5",
"bg": "#586e75"
},
"break": {
"fg": "#002b36",
"bg": "#859900"
}
}
}

View file

@ -47,5 +47,19 @@
"modified": { "bg": "#2aa198" },
"deleted": { "bg": "#d33682" },
"new": { "bg": "#859900" }
},
"pomodoro": {
"paused": {
"fg": "#002b36",
"bg": "#b58900"
},
"work": {
"fg": "#eee8d5",
"bg": "#586e75"
},
"break": {
"fg": "#002b36",
"bg": "#859900"
}
}
}

View file

@ -49,5 +49,20 @@
"modified": { "bg": "#2aa198" },
"deleted": { "bg": "#d33682" },
"new": { "bg": "#859900" }
},
"pomodoro": {
"paused": {
"fg": "#002b36",
"bg": "#b58900"
},
"work": {
"fg": "#eee8d5",
"bg": "#586e75"
},
"break": {
"fg": "#002b36",
"bg": "#859900"
}
}
}

View file

@ -44,5 +44,20 @@
"fg": "background",
"bg": "color3"
}
},
"pomodoro": {
"paused": {
"fg": "cursor",
"bg": "color6"
},
"work": {
"fg": "background",
"bg": "foreground"
},
"break": {
"fg": "background",
"bg": "color3"
}
}
}