From d6072d0eb718f727baaa7727256e34e6625fc9bf Mon Sep 17 00:00:00 2001 From: Karthik Chikmagalur Date: Sat, 28 Sep 2019 16:27:26 -0700 Subject: [PATCH] Spruced up the pomodoro module. Added icons/colors to the pomodoro module and shortened the display text. --- bumblebee/modules/pomodoro.py | 45 +++++++++------- themes/firefox-dark-powerline.json | 14 ++++- themes/greyish-powerline.json | 17 +++++- themes/gruvbox-light.json | 17 +++++- themes/gruvbox-powerline-light.json | 82 +++++++++++++++++------------ themes/gruvbox-powerline.json | 16 +++++- themes/gruvbox.json | 17 +++++- themes/iceberg-dark-powerline.json | 15 ++++++ themes/iceberg-powerline.json | 14 +++++ themes/iceberg-rainbow.json | 15 ++++++ themes/iceberg.json | 15 ++++++ themes/icons/ascii.json | 8 ++- themes/icons/awesome-fonts.json | 5 ++ themes/icons/ionicons.json | 6 +++ themes/onedark-powerline.json | 17 +++++- themes/powerline.json | 17 +++++- themes/sac_red.json | 17 +++++- themes/solarized-dark-awesome.json | 64 +++++++++++++--------- themes/solarized-powerline.json | 16 +++++- themes/solarized.json | 17 +++++- themes/wal-powerline.json | 17 +++++- 21 files changed, 361 insertions(+), 90 deletions(-) diff --git a/bumblebee/modules/pomodoro.py b/bumblebee/modules/pomodoro.py index 249ad2e..0eacc63 100644 --- a/bumblebee/modules/pomodoro.py +++ b/bumblebee/modules/pomodoro.py @@ -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 diff --git a/themes/firefox-dark-powerline.json b/themes/firefox-dark-powerline.json index 4def35a..00e7d95 100644 --- a/themes/firefox-dark-powerline.json +++ b/themes/firefox-dark-powerline.json @@ -26,5 +26,17 @@ "fg": "#002b36", "bg": "#859900" } - } + }, + "pomodoro": { + "paused": { + "fg": "#002b36", + "bg": "#b58900" + }, + "break": { + "fg": "#002b36", + "bg": "#859900" + } + } + + } diff --git a/themes/greyish-powerline.json b/themes/greyish-powerline.json index 1cbaaf6..2e9d9b8 100644 --- a/themes/greyish-powerline.json +++ b/themes/greyish-powerline.json @@ -42,5 +42,20 @@ "fg": "#002b36", "bg": "#859900" } - } + }, + "pomodoro": { + "paused": { + "fg": "#002b36", + "bg": "#b58900" + }, + "work": { + "fg": "#1d2021", + "bg": "#b8bb26" + }, + "break": { + "fg": "#002b36", + "bg": "#859900" + } + } + } diff --git a/themes/gruvbox-light.json b/themes/gruvbox-light.json index ebb7983..ee4d69e 100644 --- a/themes/gruvbox-light.json +++ b/themes/gruvbox-light.json @@ -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" + } + } + } diff --git a/themes/gruvbox-powerline-light.json b/themes/gruvbox-powerline-light.json index ba4b441..d515df0 100644 --- a/themes/gruvbox-powerline-light.json +++ b/themes/gruvbox-powerline-light.json @@ -21,38 +21,52 @@ "fg": "#282828", "bg": "#fbf1c7" } - ], - "dnf": { - "good": { - "fg": "#002b36", - "bg": "#859900" - } - }, - "apt": { - "good": { - "fg": "#002b36", - "bg": "#859900" - } - }, - "battery": { - "charged": { - "fg": "#1d2021", - "bg": "#b8bb26" - }, - "AC": { - "fg": "#1d2021", - "bg": "#b8bb26" - } - }, - "bluetooth": { - "ON": { - "fg": "#1d2021", - "bg": "#b8bb26" - } - }, - "git": { - "modified": { "bg": "#458588" }, - "deleted": { "bg": "#9d0006" }, - "new": { "bg": "#b16286" } - } + ], + "dnf": { + "good": { + "fg": "#002b36", + "bg": "#859900" + } + }, + "apt": { + "good": { + "fg": "#002b36", + "bg": "#859900" + } + }, + "battery": { + "charged": { + "fg": "#1d2021", + "bg": "#b8bb26" + }, + "AC": { + "fg": "#1d2021", + "bg": "#b8bb26" + } + }, + "bluetooth": { + "ON": { + "fg": "#1d2021", + "bg": "#b8bb26" + } + }, + "git": { + "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" + } + } } diff --git a/themes/gruvbox-powerline.json b/themes/gruvbox-powerline.json index 1e0f588..3481dbc 100644 --- a/themes/gruvbox-powerline.json +++ b/themes/gruvbox-powerline.json @@ -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" + } + } } diff --git a/themes/gruvbox.json b/themes/gruvbox.json index 8ef2813..ab71814 100644 --- a/themes/gruvbox.json +++ b/themes/gruvbox.json @@ -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" + } + } + } diff --git a/themes/iceberg-dark-powerline.json b/themes/iceberg-dark-powerline.json index 81af90e..1b13b84 100644 --- a/themes/iceberg-dark-powerline.json +++ b/themes/iceberg-dark-powerline.json @@ -47,5 +47,20 @@ "fg": "#0f1117", "bg": "#84a0c6" } + }, + "pomodoro": { + "paused": { + "fg": "#0f1117", + "bg": "#e2a478" + }, + "work": { + "fg": "#1d2021", + "bg": "#b8bb26" + }, + "break": { + "fg": "#b4be82", + "bg": "#161821" + } } + } diff --git a/themes/iceberg-powerline.json b/themes/iceberg-powerline.json index f6af51b..c7dca23 100644 --- a/themes/iceberg-powerline.json +++ b/themes/iceberg-powerline.json @@ -46,5 +46,19 @@ "fg": "#0f1117", "bg": "#84a0c6" } + }, + "pomodoro": { + "paused": { + "fg": "#0f1117", + "bg": "#e2a478" + }, + "work": { + "fg": "#1d2021", + "bg": "#b8bb26" + }, + "break": { + "fg": "#89b8c2", + "bg": "#161821" + } } } diff --git a/themes/iceberg-rainbow.json b/themes/iceberg-rainbow.json index e8cef97..9c56af6 100644 --- a/themes/iceberg-rainbow.json +++ b/themes/iceberg-rainbow.json @@ -46,5 +46,20 @@ "fg": "#89b8c2", "bg": "#161821" } + }, + "pomodoro": { + "paused": { + "fg": "#e2a478", + "bg": "#c6c8d1" + }, + "work": { + "fg": "#89b8c2", + "bg": "#161821" + }, + "break": { + "fg": "#b4be82", + "bg": "#161821" + } } + } diff --git a/themes/iceberg.json b/themes/iceberg.json index 5739b83..9943eb4 100644 --- a/themes/iceberg.json +++ b/themes/iceberg.json @@ -40,5 +40,20 @@ "fg": "#89b8c2", "bg": "#161821" } + }, + "pomodoro": { + "paused": { + "fg": "#0f1117", + "bg": "#e2a478" + }, + "work": { + "fg": "#1d2021", + "bg": "#b8bb26" + }, + "break": { + "fg": "#89b8c2", + "bg": "#161821" + } } + } diff --git a/themes/icons/ascii.json b/themes/icons/ascii.json index 2084ca1..3b24f47 100644 --- a/themes/icons/ascii.json +++ b/themes/icons/ascii.json @@ -302,6 +302,10 @@ }, "system": { "prefix": "system" - } - + }, + "pomodoro": { + "off": { "prefix": "pom" }, + "paused": { "prefix": "||" }, + "on": { "prefix": " >" } + } } diff --git a/themes/icons/awesome-fonts.json b/themes/icons/awesome-fonts.json index eb805d4..c2c6c11 100644 --- a/themes/icons/awesome-fonts.json +++ b/themes/icons/awesome-fonts.json @@ -222,5 +222,10 @@ }, "rss": { "prefix": "" + }, + "pomodoro": { + "off": { "prefix": "🍅" }, + "paused": { "prefix": "" }, + "on": { "prefix": "" } } } diff --git a/themes/icons/ionicons.json b/themes/icons/ionicons.json index 08f9927..9f7a116 100644 --- a/themes/icons/ionicons.json +++ b/themes/icons/ionicons.json @@ -185,5 +185,11 @@ }, "rss": { "prefix": "\uf1ea" + }, + "pomodoro": { + "off": { "prefix": "\uf24f" }, + "paused": { "prefix": "\uf210" }, + "on": { "prefix": "\uf488" } } + } diff --git a/themes/onedark-powerline.json b/themes/onedark-powerline.json index 03867c6..d0ca586 100644 --- a/themes/onedark-powerline.json +++ b/themes/onedark-powerline.json @@ -36,5 +36,20 @@ "fg": "#282C34", "bg": "#98C379" } - } + }, + "pomodoro": { + "paused": { + "fg": "#282C34", + "bg": "#E5C07B" + }, + "work": { + "fg": "#98C379", + "bg": "#282C34" + }, + "break": { + "fg": "#282C34", + "bg": "#98C379" + } + } + } diff --git a/themes/powerline.json b/themes/powerline.json index 02f21f6..b2b603d 100644 --- a/themes/powerline.json +++ b/themes/powerline.json @@ -43,5 +43,20 @@ "fg": "#494949", "bg": "#41db00" } - } + }, + "pomodoro": { + "paused": { + "fg": "#d75f00", + "bg": "#ffd700" + }, + "work": { + "fg": "#ffd700", + "bg": "#d75f00" + }, + "break": { + "fg": "#494949", + "bg": "#41db00" + } + } + } diff --git a/themes/sac_red.json b/themes/sac_red.json index fade76e..7f6be68 100644 --- a/themes/sac_red.json +++ b/themes/sac_red.json @@ -40,5 +40,20 @@ }, "cmus": { "bg": "#C42021" - } + }, + "pomodoro": { + "paused": { + "fg": "#FDFFFC", + "bg": "#B91372" + }, + "work": { + "fg": "#FDFFFC", + "bg": "#41EAD4" + }, + "break": { + "fg": "#FDFFFC", + "bg": "#011627" + } + } + } diff --git a/themes/solarized-dark-awesome.json b/themes/solarized-dark-awesome.json index 9ec45e2..7274dc7 100644 --- a/themes/solarized-dark-awesome.json +++ b/themes/solarized-dark-awesome.json @@ -21,29 +21,43 @@ }, "apt": { "good": { - "fg": "#002b36", - "bg": "#859900" - } - }, - "pacman": { - "good": { - "fg": "#002b36", - "bg": "#859900" - } - }, - "battery": { - "charged": { - "fg": "#002b36", - "bg": "#859900" - }, - "AC": { - "fg": "#002b36", - "bg": "#859900" - } - }, - "git": { - "modified": { "bg": "#2aa198" }, - "deleted": { "bg": "#d33682" }, - "new": { "bg": "#859900" } - } + "fg": "#002b36", + "bg": "#859900" + } + }, + "pacman": { + "good": { + "fg": "#002b36", + "bg": "#859900" + } + }, + "battery": { + "charged": { + "fg": "#002b36", + "bg": "#859900" + }, + "AC": { + "fg": "#002b36", + "bg": "#859900" + } + }, + "git": { + "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" + } + } } diff --git a/themes/solarized-powerline.json b/themes/solarized-powerline.json index 3e52f7f..25854f5 100644 --- a/themes/solarized-powerline.json +++ b/themes/solarized-powerline.json @@ -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" + } + } } diff --git a/themes/solarized.json b/themes/solarized.json index 4486634..e6f0082 100644 --- a/themes/solarized.json +++ b/themes/solarized.json @@ -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" + } + } + } diff --git a/themes/wal-powerline.json b/themes/wal-powerline.json index dcb4fa9..8b28d3a 100644 --- a/themes/wal-powerline.json +++ b/themes/wal-powerline.json @@ -44,5 +44,20 @@ "fg": "background", "bg": "color3" } - } + }, + "pomodoro": { + "paused": { + "fg": "cursor", + "bg": "color6" + }, + "work": { + "fg": "background", + "bg": "foreground" + }, + "break": { + "fg": "background", + "bg": "color3" + } + } + }