kevinschoon-pomo/README.md

177 lines
4.4 KiB
Markdown
Raw Normal View History

2018-01-30 04:18:27 +01:00
<p align="center"><img src="https://raw.githubusercontent.com/kevinschoon/pomo/master/www/static/demo.gif" alt="demo"/></p>
2018-01-21 16:15:33 +01:00
# 🍅 pomo
2018-01-16 10:50:08 +01:00
2020-09-06 18:03:51 +02:00
![pomo](https://github.com/kevinschoon/pomo/workflows/pomo/badge.svg)
2019-01-08 23:11:11 +01:00
`pomo` is a simple CLI for using the [Pomodoro Technique](https://en.wikipedia.org/wiki/Pomodoro_Technique). There are [some](https://taskwarrior.org/) [amazing](https://todoist.com/) task management systems but `pomo` is more of a task *execution* or [timeboxing](https://en.wikipedia.org/wiki/Timeboxing) system. `pomo` helps you track what you did, how long it took you to do it, and how much effort you expect it to take.
2018-01-21 16:15:33 +01:00
## Background
2018-01-22 17:28:13 +01:00
The Pomodoro Technique is simple and effective:
2018-01-21 16:15:33 +01:00
* Decide on a task you want to accomplish
* Break the task into timed intervals (pomodoros), [approx. 25 min]
* After each pomodoro take a short break [approx. 3 - 5 min]
* Once all pomodoros are completed take a longer break [approx 15 - 20 min]
* Repeat
## Installation
2018-01-30 04:18:27 +01:00
### Source
2018-01-21 16:15:33 +01:00
2019-02-10 21:39:45 +01:00
```bash
git clone git@github.com:kevinschoon/pomo.git
cd pomo
make
2021-10-10 17:34:21 +02:00
# copy pomo somewhere on your $PATH
cp bin/pomo ~/bin/
2018-01-21 16:15:33 +01:00
```
2021-11-02 13:53:08 +01:00
### Package Managers
On Arch Pomo is available on the [aur](https://aur.archlinux.org/packages/pomo).
2021-11-14 20:31:50 +01:00
On macOS, `pomo` can be installed via [MacPorts](https://ports.macports.org/port/pomo/).
2018-01-21 16:15:33 +01:00
## Usage
2018-01-30 04:18:27 +01:00
Once `pomo` is installed you need to initialize it's database.
2019-02-10 21:39:45 +01:00
``` bash
2018-01-21 16:15:33 +01:00
pomo init
2018-01-30 04:18:27 +01:00
```
Start a 4 pomodoro session at 25 minute intervals:
2019-02-10 21:39:45 +01:00
```bash
2018-01-30 04:18:27 +01:00
pomo start -t my-project "write some codes"
2018-01-21 16:15:33 +01:00
```
2018-02-03 19:50:03 +01:00
## Configuration
2022-05-30 22:34:55 +02:00
Pomo has a few configuration options which can be read from a JSON file in Pomo's config directory `~/.config/pomo/config.json`.
2018-02-03 19:50:03 +01:00
### colors
You can map colors to specific tags in the `colors` field.
Example:
2019-02-10 21:39:45 +01:00
```json
2018-02-03 19:50:03 +01:00
{
"colors": {
"my-project": "hiyellow",
"another-project": "green"
}
}
```
2022-05-31 08:20:58 +02:00
### Execute command on state change
2022-05-31 08:36:33 +02:00
Pomo will execute an arbitrary command specified in the array argument `onEvent`
when the state changes. The first element of this array should be the
executable to run while the remaining elements are space delimited arguments.
The new state will be exported as an environment variable `POMO_STATE` for this
command. Possible state values are `RUNNING`, `PAUSED`, `BREAKING`, or
`COMPLETE`.
For example, to trigger a terminal bell when a session completes, add the
following to `config.json`:
```json
2022-05-31 08:20:58 +02:00
...
2022-05-31 08:36:33 +02:00
"onEvent": ["/bin/sh", "/path/to/script/my_script.sh"],
2022-05-31 08:20:58 +02:00
...
```
where the contents of `my_script.sh` are
2022-05-31 08:36:33 +02:00
```bash
2022-05-31 08:20:58 +02:00
#!/bin/sh
if [ "$POMO_STATE" == "COMPLETE" ] ; then
echo -e '\a'
fi
```
2018-02-04 04:30:57 +01:00
## Integrations
By default pomo will setup a Unix socket and serve it's status there.
```bash
echo | socat stdio UNIX-CONNECT:$HOME/.pomo/pomo.sock | jq .
{
"state": 1,
"remaining": 1492000000000,
"count": 0,
"n_pomodoros": 4
}
```
Alternately by setting the `publish` flag to `true` it will publish it's status
to an existing socket.
2018-02-04 04:30:57 +01:00
### Status Bars
The Pomo CLI can output the current state of a running task session via the `pomo status`
making it easy to script and embed it's output in various Linux status bars.
#### [Polybar](https://github.com/jaagr/polybar)
You can create a module with the `custom/script` type and
embed Pomo's status output in your Polybar:
2019-02-10 21:39:45 +01:00
```ini
2018-02-04 04:30:57 +01:00
[module/pomo]
type = custom/script
interval = 1
exec = pomo status
```
#### [luastatus](https://github.com/shdown/luastatus)
Configured this bar by setting `publish` to `true`.
```lua
widget = {
plugin = "unixsock",
opts = {
path = "pomo.sock",
timeout = 2,
},
cb = function(t)
local full_text
local foreground = ""
local background = ""
if t.what == "line" then
if string.match(t.line, "R") then
-- green
foreground = "#ffffff"
background = "#307335"
end
if string.match(t.line, "B") or string.match(t.line, "P") or string.match(t.line, "C") then
-- red
foreground = "#ffffff"
background = "ff8080"
end
return { full_text = t.line, background = background, foreground = foreground }
elseif t.what == "timeout" then
return { full_text = "-" }
elseif t.what == "hello" then
return { full_text = "-" }
end
end,
}
```
2018-02-03 19:50:03 +01:00
2018-01-21 16:15:33 +01:00
## Roadmap
2018-01-31 14:12:09 +01:00
* Generate charts/burn down
2018-01-21 16:15:33 +01:00
* ??
2018-01-22 17:34:18 +01:00
## Credits
* [pomodoro technique](https://cirillocompany.de/pages/pomodoro-technique/book/)
* [logo by rones](https://openclipart.org/detail/262421/tomato-by-rones)
* [website generate by hugo](http://gohugo.io/)
* [theme by calintat](https://github.com/calintat/minimal)