pomatez icon indicating copy to clipboard operation
pomatez copied to clipboard

Provide hooks in bashrc to directly deal with session data

Open nirmalhk7 opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. Awesome application first off. Really well made, blows other similar applications out of the water. I particularly love the full-screen break timer, it forces me to get off my laptop.

What I wanted was a record of how many sessions and how many breaks (long or short) I've taken.

Describe the solution you'd like Instead of building the logging functionality within the app, why not we ask users to make a bash function with a particular name, and call that from Pomatez? While calling it, we can also pass additional information of any sorts too.

So every time a session is complete, we will call a bash function (call it pomatez.hook).

if(event completed){
  exec("pomatez.hook <Identifier for work session, short break or long break> <duration of session> <Session start time> <Session end time> ", (error, stdout, stderr) => {
      if (error) {
          // Handle error
          return;
      }
      if (stderr) {
          // Handle error
          return;
      }
  });
}

Meanwhile, the bash function in .bashrc can be:

pomatez.meet(){
  echo "Hey!"
  # This would loop through all arguments to pomatez.meet
  for d in $@
  do
  echo "Arg=$d"
  done
}

Within this function we can leave it to the user to write the logic for whatever they want to do with the arguments: they can log it to a file of their choice, or they can save it into a database (Saving into a database is also something in this project's roadmap).

Its not exactly convenient, yes, but it offers much more flexibility than writing the logic to update in a database, or writing the logic to log in a particular file in a given location. I know visualizing session information is also something Pomatez has in its roadmap, but this can also allow users to visualize their sessions in their own apps, if they have any. Also, since Pomatez supports Linux distributions only for now, the support won't be an issue either. I'm not so sure if snap packages can run bash commands, but surely Electron must have some means to allow this.

Describe alternatives you've considered The alternatives would be to support whatever database users want to record their sessions in, or support logging session information to a particular file. I find the method suggested above to be more simpler and flexible in comparison.

nirmalhk7 avatar Nov 16 '21 16:11 nirmalhk7