Coder Social home page Coder Social logo

kevinschoon / pomo Goto Github PK

View Code? Open in Web Editor NEW
525.0 8.0 46.0 6.09 MB

Pomodoro CLI

Home Page: https://kevinschoon.github.io/pomo

License: MIT License

Go 91.64% Makefile 2.09% HTML 3.19% CSS 2.74% Shell 0.35%
task-management golang pomodoro pomodoro-technique

pomo's Introduction

demo

Migration Notice

This project has been migrated to codeberg, new contributions will only be accepted on that platform.

๐Ÿ… pomo

pomo

pomo is a simple CLI for using the Pomodoro Technique. There are some amazing task management systems but pomo is more of a task execution or 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.

Background

The Pomodoro Technique is simple and effective:

  • 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

Source

git clone [email protected]:kevinschoon/pomo.git
cd pomo
make
# copy pomo somewhere on your $PATH
cp bin/pomo ~/bin/

Package Managers

On Arch Pomo is available on the aur.

On macOS, pomo can be installed via MacPorts.

Usage

Once pomo is installed you need to initialize it's database.

pomo init

Start a 4 pomodoro session at 25 minute intervals:

pomo start -t my-project "write some codes"

Configuration

Pomo has a few configuration options which can be read from a JSON file in Pomo's config directory ~/.config/pomo/config.json.

colors

You can map colors to specific tags in the colors field.

Example:

{
    "colors": {
        "my-project": "hiyellow",
        "another-project": "green"
    }
}

Execute command on state change

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:

...
"onEvent": ["/bin/sh", "/path/to/script/my_script.sh"],
...

where the contents of my_script.sh are

#!/bin/sh

if [ "$POMO_STATE" == "COMPLETE" ] ; then
   echo -e '\a'
fi

See the contrib directory for user contributed scripts for use with onEvent.

Integrations

By default pomo will setup a Unix socket and serve it's status there.

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.

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.

You can create a module with the custom/script type and embed Pomo's status output in your Polybar:

[module/pomo]
type = custom/script
interval = 1
exec = pomo status

Configured this bar by setting publish to true.

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,
}

Roadmap

  • Generate charts/burn down
  • ??

Credits

pomo's People

Contributors

amiel avatar herbygillot avatar jackmordaunt avatar jgarte avatar kevinschoon avatar labno avatar lpmi-13 avatar paperbenni avatar sboysel avatar stephenwithav avatar strogiyotec avatar vinhowe avatar xakon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pomo's Issues

Having break end automatically without having to unpause manually

Great software!
Feature Request(?):
I think adding this option for pomo to act as a daemon would be great.

The Second Thing/Question:
Is there a way of sending the 'Enter' key to pomo.sock to automate these tasks of unpausing? Like sending ASCII value of Enter key?

Null ptr when pomo list is executed

@kevinschoon hey , during refactoring for more test friendly code you made a small bug. How to reproduce.
Run pomo list the output is

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x639f2c]

goroutine 1 [running]:
github.com/jawher/mow.cli/internal/flow.(*Step).Run(0xc0000751d0, 0x718ea0, 0xb09ed0)
        /home/strogiyotec/go/pkg/mod/github.com/jawher/[email protected]/internal/flow/flow.go:39 +0xd4
github.com/jawher/mow.cli/internal/flow.(*Step).Run(0xc0000752c0, 0x718ea0, 0xb09ed0)
        /home/strogiyotec/go/pkg/mod/github.com/jawher/[email protected]/internal/flow/flow.go:29 +0xb6
github.com/jawher/mow.cli/internal/flow.(*Step).Run(0xc0000753b0, 0x718ea0, 0xb09ed0)
        /home/strogiyotec/go/pkg/mod/github.com/jawher/[email protected]/internal/flow/flow.go:29 +0xb6
github.com/jawher/mow.cli/internal/flow.(*Step).callDo.func1(0xc0000753e0, 0x0, 0x0)
        /home/strogiyotec/go/pkg/mod/github.com/jawher/[email protected]/internal/flow/flow.go:52 +0x4e
panic(0x718ea0, 0xb09ed0)
        /usr/lib/go-1.15/src/runtime/panic.go:969 +0x175
github.com/kevinschoon/pomo/pkg/cmd.list.func1.1()
        /home/strogiyotec/IdeaProjects/GoLang/my_pomo/pomo/pkg/cmd/cmd.go:167 +0xac

The reason

func Run() { New(nil).Run(os.Args) }

You passes nil as a config option. I will fix it with my refactored version of delete multiple task branch

Terminal alarm

Would it be possible to implement the alarm for terminals?

Sometimes I don't see the notification in my secondary screen (I have it flipped for reading and other stuff) and I miss the notification.

For me it would be quite useful to implement this as an option as it would produce a color change in my terminal and I would see it even if I'm not in the same workspace.

I'm not sure how this would be in Go, but in bash it's just printing an escape sequence:

sleep 3; echo -e "\a"

It also works in C++, so I assume it's a standard thing.

If you're busy or not wanting to implement this I could try to do it, but I would need a bit of support with Go :).

Thanks!

Add Man Page

The aur pomo package has a man page committed to it's build repository, we should add a man page here in the source.

What to do with "leftover" pomodoros?

Let's say I start a task and I overestimate the time that task will take.

pomo start -p 10 "Do something for a long time"

But after 2 pomodoros have passed the task is complete. Can I mark the task as complete somehow so that pomo list does not show 8 red X-es ?

Pomo onEvent is not discovered in the config.json

I am trying to set onEvent action script but onEvent does not get discovered by the config and I cannot use this option.

Steps to reproduce:

  1. Add onEvent to config.json
  2. Run pomo config
  3. onEvent is not there
  4. When timer finishes no script from onEvent is running

Please let me know if something can be done about this or how can I solve this by myself.
I am using aur/pomo 0.8.1-1 (+4 1.12) (Installed)

[Bug] Address Already In Use

Hi @kevinschoon,

Most of the time, when I try to start or begin a pomodoros, I get this error:

Error:
listen unix /home/cyril/.pomo/pomo.sock: bind: address already in use

I think it happens when I don't/can't leave the pomo timer with the proper p command.

The quick fix I found is to remove the pomo.sock file: rm /home/cyril/.pomo/pomo.sock

Cordially,
Cyril

Update AUR package

Pomo has a user contributed AUR repo that is out of date, it needs to be updated and added to the documentation.

Upgrade Termui

Pomo is dependent on an old version of termui which has since had a full rewrite, we will need to do some refactoring to support this new version.

Homebrew formula

Hi,

The idea is great but installing this app should be easier/smoother. I don't like to move an executable stuff into some folders etc. :) So, it'd be really nice to create a formula for this app imho.

Nice work! Thanks for sharing it.

Best,
G.

Can't make pomo

After I cd pomo, I type and enter make but this is the output I get
go test ./... make: go: No such file or directory make: *** [Makefile:25: test] Error 127
What is it?

How to: Add to Path

install.sh states:

Pomo 0.7.1 installed, copy ./pomo to somewhere on your path.

I tried to add it, but didn't work. I even created ./pomo and put binary file in that directory, but no luck.

[Feature Request] pomo status --json

First off, I am finding pomo super useful. I especially like how scriptable it is, which allows me to set up a pomodoro and have its status show up in my tmux status line or in my prompt.

On that note, It would be super nice to get the pomo status in json format, just like pomo list --json. This would make the scripting even more flexible.

Display current task message while running

For those of us with attention issues, would it be possible to display the currently running task message while pomo is running? Especially when I get into a multi pomo cycle and come back to the computer I tend to loose track of the exact goal of the session. It would also be nice to output the task with pomo status, maybe with a -m flag.

[Feature Request] Show time when taking a break

It would be very great if we can see how much time we have rested by showing a stopwatch. pomo status could also show the time.

This may be helpful in avoiding spending too much time resting without knowing it.

An example is gnome-pomodoro, which counts down 5 mins for short breaks.

Bulid for Windows 10

I tried today to build pomo on Windows 10 and it's successfully done:

Requirements:

Steps

  1. Ensure Go, gcc, git in the PATH environment variable
  2. Open command prompt and exec: go get github.com/kevinschoon/pomo
    Got this message: package github.com/gizak/termui: no Go files in C:\Users\YOURUSERID\go\src\github.com\gizak\termui
  3. Go to this path C:\Users\YOURUSERID\go\src\github.com\kevinschoon\pomo and run: go build .. pomo.exe is created and ready

GLIBC_2.28 not found

OS=Ubuntu 16.04.5 LTS
Kernel=4.4.0-141-generic


Hello,

The dynamically linked binary release generates the following error on my system:

./pomo: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by ./pomo)

After googling around, I installed the following package

apt-get install libc6

With no changes. It I'm not sure how libc is managed by default on Ubuntu since that package did install, however I cannot remove it anymore (other binaries depend on it).

Here is the file command output against the binary:

pomo: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=49487bb8d010bb7dfa52de73c04974c1e50b820e, not stripped

pomo list doesn't work without colors

@kevinschoon Found one bug
Here is my config.json

{
}

So it's empty. When I run pomo list I got this error

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x62efaf]

goroutine 1 [running]:
github.com/jawher/mow.cli/internal/flow.(*Step).Run(0xc00009b230, 0x719c60, 0xb0aed0)
        /home/strogiyotec/go/pkg/mod/github.com/jawher/[email protected]/internal/flow/flow.go:39 +0xd4
github.com/jawher/mow.cli/internal/flow.(*Step).Run(0xc00009b320, 0x719c60, 0xb0aed0)
        /home/strogiyotec/go/pkg/mod/github.com/jawher/[email protected]/internal/flow/flow.go:29 +0xb6
github.com/jawher/mow.cli/internal/flow.(*Step).Run(0xc00009b410, 0x719c60, 0xb0aed0)
        /home/strogiyotec/go/pkg/mod/github.com/jawher/[email protected]/internal/flow/flow.go:29 +0xb6
github.com/jawher/mow.cli/internal/flow.(*Step).callDo.func1(0xc00009b440, 0x0, 0x0)
        /home/strogiyotec/go/pkg/mod/github.com/jawher/[email protected]/internal/flow/flow.go:52 +0x4e
panic(0x719c60, 0xb0aed0)
        /usr/lib/go-1.15/src/runtime/panic.go:969 +0x175

I checked, the problem is in util.go

if color := config.Colors.Get(tag); color != nil {

So if Colors are nil then it fails. Is it expected behavior or a bug ? If it's a bug then I make a PR, it shouldn't be hard just add additional condition

[Bug] Path option (-p and --path) are recognised as "incorrect usage."

System: Ubuntu 18.10 64-bit running in WSL2

Executable location: /usr/bin/

Input:

$ pomo -p

Expected output:

/home/user/.pomo

Actual output:

Error: incorrect usage

Usage: pomo [OPTIONS] COMMAND [arg...]

Pomodoro CLI

Options:
  -p, --path      path to the pomo config directory (default "/home/DZZR-STATION/.pomo")
  -v, --version   Show the version and exit

Commands:
  start, s        start a new task
  init            initialize the sqlite database
  create, c       create a new task without starting
  begin, b        begin requested pomodoro
  list, l         list historical tasks
  delete, d       delete a stored task
  status, st      output the current status

Run 'pomo COMMAND --help' for more information on a command.

Terminal cursor jumps every second

The terminal cursor jumps every second and that is distracting.

I've tried with both Alacritty and xterm and the issue persists.

I don't know if that can be fixed in pomo or it's a terminal configuration issue.

scrn-2022-01-03-10-55-37
scrn-2022-01-03-10-55-28

Pressing `p` from the break screen breaks things

Accidentally pressing p from the break screen seems to cause some sort of lock to occur. The UI accepts no input or interrupts and I've only been able to kill it by closing the tmux pane pomo is running in. I haven't dug in too deep, but I think this might be fixable by adding some checks to TaskRunner.Pause().

[Feature Request] Start pomodoro without ncurses UI

As mentioned in #20, I love how scriptable pomo is. It would be useful to be able to start a timer without having the ncurses UI. Instead, I would just be checking the status with pomo status.

I totally understand if this is not in line with what you think this should be. I figured I'd add the feature request in case it works for you :)

Thanks again for pomo CLI!!!

`pomo status` no longer works in "publish" mode

I love the idea behind "publish" mode, but enabling it causes pomo status to hang. I believe this is because pomo status relies on the socket that normal mode writes to.

My suggestion is to always listen on the normal socket, and have the "publish" mode use a different socket path to publish to, so it is no longer publish or listen, but publish and listen.

Also, I am happy to work on this, but wanted to get feedback on the strategy before I dive in...

Delete multiple tasks using one command

Hey, it would be nice to have an ability to delete multiple tasks using one command. So instead of

pomo delete 1
pomo delete 2

We can use pomo delete 1 2
I already implemented it in my fork , will be glad to create pull request as soon as my first one will be approved

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.