pomodorolm icon indicating copy to clipboard operation
pomodorolm copied to clipboard

Storing history of each pomodoro

Open defuneste opened this issue 6 months ago • 10 comments

We discussed it: https://mamot.fr/@vjousse/114733255480315440

Is it possible to store the history of each pomodoro with a description field?

I would like keep track of what I have done. Here is a use case:

pomo 25 "some string" will:

  • start pomodorolm,
  • store the time stamp from ~/.cache/pomodoro_session (where? ~/.my_pomodoro),
  • do a cycle including a "short break"
  • stop the process (for now I think we are doing a cycle of 4 rounds, do a CLI to specify it)

Then: pomo 25 "a new string" (repeat).

I do not have any specific idea on "how". I was going to do a quick personal shell script for it (and maybe that is better since everyone has their specific workflow). I was thinking that my_pomodoro would look like

starting_datetime ;  description; ending_dateteime
Mon Jun 23 11:09:45 AM EDT 2025; some, string;   Mon Jun 23 11:39:45 AM EDT 2025
Mon Jun 23 11:39:45 AM EDT 2025; a new string;   <empty when not finished>

defuneste avatar Jun 23 '25 15:06 defuneste

I wrote something that is "working" now. The use of trap in not pretty but I hope it can help understand a bit more the use of a potential CLI.

I changed the structure of the history to match a a simple append.

#! /bin/bash

set -e 

reminder() {
    echo "Nop: ./pomo.sh 25 'string'"
}

if [ "$#" -ne 2 ]; then
    reminder
    exit 1
fi

if [ -f ~/.cache/pomodoro_session ]; then
    echo "pomodorolm is running"
    exit
fi

# timer=$1 # right now do nothing: scaffolding to specify time 
# should be a default
description=$2 
HISTORY=~/.my_pomodoro

if [ -f $HISTORY ]; then
    cat $HISTORY # maybe change to wc since it will grow  
    else 
    echo "Init $HISTORY"
    echo "date; action; description" > $HISTORY
fi

echo "start pomodorolm"
echo "$(date); start; $description;"  >> $HISTORY

my_exit() {
    echo "$(date); end; $description;" >> $HISTORY
} 

trap 'my_exit' EXIT 

pomodorolm 

defuneste avatar Jun 23 '25 18:06 defuneste

Thanks for the script! I’m currently working on it! https://github.com/vjousse/pomodorolm/pull/176

vjousse avatar Jun 26 '25 16:06 vjousse

Great! I am using this right now (https://codeberg.org/defuneste/scripts/src/branch/main/pomo) still a lot of scaffolding but it is working fine. I am excited to adapt it!

defuneste avatar Jun 26 '25 18:06 defuneste

Thanks for the script but I may be missing something as it looks like you’re running the gui and not pomodorolm cli, how is it supposed to work?

vjousse avatar Jun 27 '25 14:06 vjousse

Yup, I either use "quit" in the GUI or kill the GUI. I think I also like to have the little colored "wheel/clock" on my toolbar.

It is far from perfect, what I want is a file that store my past pomodoro. I will try to explain my workflow now.

I am using a windows manager (and I put that "workflow" in a specific window):

  1. I open a terminal
  2. Start the script (pomo 25 something). a. The script will append my file with $date, a type of action (just "start" and "end" now) and a $description (second argument) b. start pomodorolm c. I need to press "play", pain point d. I am using wither "quit" on the toolbar or ctrl+c on my shell e. trap "my_crappy_function" exit will record the $date the end of my cycle and keep the same description
  3. If i want to send an other cycle I just move to the windows, go in the shell (pomo 25 new stuff)

It is far from perfect! The "pain" point is that I need to start/stop manually pomodorolm while I would like to just have "one cycle" by default (and maybe use option to change that). Obv. my script is not linked to ~/.cache/pomodoro_session that I also could use. I just tough it was easier to use a very imperative simple script for now.

This is an example of the last line of my "history file":

Fri Jun 27 09:30:40 AM EDT 2025; start; leetcode;
Fri Jun 27 09:55:50 AM EDT 2025; end; leetcode;
Fri Jun 27 09:56:00 AM EDT 2025; start; job appliction;
Fri Jun 27 10:25:06 AM EDT 2025; end; job appliction; 

As you can see I should remove the last semi colon, could be good to have a unique ID for a pomodoro (not that hard, I was just not prioritizing that).

I am happy to get any hint on how to improve on that!

defuneste avatar Jun 27 '25 14:06 defuneste

Oh great! I hadn't really understood how you were using it 😊 I thought you were using the CLI but now I get it ^^

The ~/.cache/pomodoro_session file is only used by the CLI for now, the UI has a totally different way of managing the sessions, I’m planning to use ~/.cache/pomodoro_session for both later on.

If you want to use the GUI, I can implement some simple improvements :

  • Add a config value that will allow to automatically start a pomodoro on app startup
  • Add a config value that will automatically quit pomodorolm after a focus session (or after the break? not sure about that)

What do you think?

vjousse avatar Jun 27 '25 14:06 vjousse

I am still unclear on what is the best use for me. I would like the CLI since it seems easier for me to grab arguments from here (or provide arguments) but I kind of like the small GUI timer now that I have tried it.

I like the idea of starting automatically a pomodoro on app startup, I think most people are doing that but I could be wrong (the case against is people organizing a session).

I think it should be after break since it is part of the design: you work, you take a break (repeat).

How does the config get accessed? I.E. can I read/parse it from a shell and update it?

(I think it is a great idea to use the ~/.cache/pomodoro_session for both GUI/CLI)

defuneste avatar Jun 27 '25 15:06 defuneste

Sure the config file is a simple toml stored here: ~/.config/pomodorolm/config.toml

Ok I’ll have a look at implementing the auto start/stop function, should not be that hard, and it could already enhance your workflow a little bit!

vjousse avatar Jun 27 '25 15:06 vjousse

@defuneste the auto-start/auto-quit function was implemented in 0.6.0, don’t hesitate to give some feedback when you can!

vjousse avatar Aug 09 '25 09:08 vjousse

Great, a bit busy this week but I will try to save some pomodoro for it! Thanks a lot!

defuneste avatar Aug 11 '25 14:08 defuneste