Giter VIP home page Giter VIP logo

tomato.c's Introduction

tomatowelcome tomatocoffee tomatomachine tomatobeach


Tomato.C

A pomodoro timer written in pure C.

License Buy Me A Coffee Give me a Star

DependenciesHow to InstallHow to UseControlsPreferences

The Pomodoro MethodTo-doContributeLicense

🍅 The Pomodoro Method

tomatomethod

The technique basically consists of using a timer to break down work into intervals, follow the steps:

  1. Get a to-do list;

  2. Start Tomato.C and focus on a single task for 25 minutes straight until notification pops up;

  3. Then record what you completed and enjoy a 5 minutes break;

  4. After 4 pomodoros (steps 2 and 3), take a longer, 30 minutes break;

  5. Restart.

🚀 How to Use

Note: Never! Run the app with admin privileges. Just type it in the terminal:

tomato

Tip: For the best terminal resolution use setsid (the geometry depends on your font size):

setsid -f "$TERMINAL" -g 49x25 -c Tomato.C -e tomato

🕹️ Controls

noises

Use the following keys to control the application:

  • ?/CTRL+H: To toggle the help page;
  • Mouse: To select, toggle and increase or decrease;
  • Mouse Scroll Wheel: To increase or decrease noises volume;
  • Arrows or VIM Keys: To move and select;
  • ENTER: To select;
  • CTRL+X: To return to the main menu wherever you are;
  • P or CTRL+P: To toggle pause;
  • S or CTRL+S: To Skip a section;
  • ESC or Q: To quit;
  • N: To toggle notepad;
  • A/a: To add note/task;
  • SPACE: To toggle task;
  • ESC: To cancel adding a note/task;
  • D or CTRL+D: To delete note/task;
  • (R F W T) or (1 2 3 4): To toggle noise;
  • CTRL+(R F W T): To decrease noise volume;
  • SHIFT+(R F W T): To increase noise volume.

🔧 Preferences

You can configure the following settings at run time:

  • Pomodoros Amount;
  • Work Time;
  • Short Pause Time;
  • Long Pause Time;
  • Noises Volume.

And change the default configurations editing the config.h, then sudo make install to take effect. You can change those configs:

preferences

  • WSL: 0/1;
  • ICONS: iconsoff - iconson - nerdicons;
  • NOTIFY: 0/1;
  • SOUND: 0/1;
  • NOISE: 0/1;
  • NOTEPAD: 0/1;
  • AUTOSTARTWORK: 0/1;
  • AUTOSTARTPAUSE: 0/1;
  • RAINVOLUME: 10-100;
  • FIREVOLUME: 10-100;
  • WINDVOLUME: 10-100;
  • THUNDERVOLUME: 10-100;
  • BGTRANSPARENCY: 0/1;
  • POMODOROS: 1-8;
  • WORKTIME: 5-50;
  • SHORTPAUSE: 1-10;
  • LONGPAUSE: 5-60;
  • WORKLOG: 0/1;
  • TIMERLOG: 0/1;
  • NOTELOG: 0/1;

⏰ Time to system bar

polybar module

Using of the -t flag you can pretty much do anything you want with the output.

For example, if you're using polybar, you can use it to get the time of your current pomodoro cycle to the bar. Just include the module at your polybar config:

modules-right = <other-modules> tomato <other-modules>

[module/tomato]
type = custom/script

exec = tomato -t
interval = 0
tail = true

format = <label>
format-background = ${colors.bg}
format-foreground = ${colors.fg}
format-padding = 1

label = %output%

❄️ Try it with Nix

# Only available with flakes
$ nix run github:gabrielzschmitz/Tomato.C

⚓ Dependencies

It only needs gcc to compile, ncurses as the graphic library and pkg-config to proper library's linking.

But optionally you can install libnotify to show notifications, mpv for the notifications sounds and a Nerd Font for the icons:

ARCH LINUX
$ sudo pacman -S base-devel ncurses mpv pkgconf libnotify

UBUNTU
$ sudo apt install build-essential libncurses5-dev libncursesw5-dev libmpv-dev mpv pkg-config libnotify4

FEDORA
$ sudo dnf groupinstall 'Development Tools' && sudo dnf install ncurses-devel mpv-devel pkgconf libnotify

MACOS (MacPorts needed)
$ brew install gcc && sudo port install ncurses && sudo port install mpv +libmpv

Note: if you're using WSL, install wsl-notify-send to get the notifications and then toggle it in the config.h. Sadly mpv don't work at WSL, so there's not custom sounds.

💾 How to Install

Normal

Note: a good practice is to clone the repo at $HOME/.local/src/

Note: first install all the dependencies!

$ git clone https://github.com/gabrielzschmitz/Tomato.C.git
$ cd Tomato.C
$ sudo make install

Via NixOS flakes

# flake.nix
{
  inputs = {
    tomato-c.url = "github:gabrielzschmitz/Tomato.C";
  };

  outputs = {
    tomato-c,
    ...
  }: let
    system = "x86_64-linux";
  in {
    nixosConfigurations."${your_host_name}" = lib.nixosSystem {
      specialArgs = {
        tomato-c = tomato-c.defaultPackage.${system};
      };

      modules = [
        # Add 'tomato-c' to your environment.systemPackages
        ./configuration.nix
      ];
    }
  };
}

📝 To-do

  • Make a welcome screen
  • Rewrite using ncurses
  • Implement input controls
  • Implement user options
  • Make it auto center
  • Add notifications
  • Add notifications sound
  • Implement mouse support
  • Implement save current state
  • Current Time to file
  • Add white noise functionality
  • Implement simple note taking
  • Implement a simple work hours history (maybe like git commits)

🤝 Contribute

Feel free to contribute to the project, the only requirement is to follow the commit tittle pattern.

Commit example

🍅 Adding log file

📜 License

This software is licensed under the GPL-3 license.

tomato.c's People

Contributors

carloscraveiro avatar gabrielzschmitz avatar krishnakoumar27 avatar luftmensch-luftmensch avatar luisnquin 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

tomato.c's Issues

Compilation terminated

cc -std=c99 -Wall -Wextra -pedantic -Wunused-result -Wno-unused-variable -Os -D_ISOC99_SOURCE -DTOMATONOISE="/usr/local/bin/tomatonoise" -DLOGPREFIX=".local/share/tomato" -DLOGFILE=".local/share/tomato/tomato.log" -DTMPFILE=".local/share/tomato/tmp.log" -DTIMERFILE=".local/share/tomato/time.log" -DNOTEPADFILE=".local/share/tomato/notepad.log" -I/usr/local/include -L/usr/local/lib tomatonoise.c pkg-config --libs ncursesw mpv -o tomatonoise
Package mpv was not found in the pkg-config search path.
Perhaps you should add the directory containing `mpv.pc'
to the PKG_CONFIG_PATH environment variable
Package 'mpv', required by 'virtual:world', not found
tomatonoise.c:1:10: fatal error: mpv/client.h: No such file or directory
1 | #include <mpv/client.h>
| ^~~~~~~~~~~~~~
compilation terminated.
make: *** [: tomatonoise] Error 1
FAIL

I am using fedora 39
WM : Hyprland

Freezes on Start in i3wm on Arch Linux

Specs:

Running i3wm on Arch Linux.
i3 version: 4.23
kernel: 6.8.2-arch2-1

Problem:

Freezes when attempting to start from the menu. After approximately 30 seconds, it displays the error message: error calling startservicebyname for org.freedesktop.secrets timeout was reached.

I can't quit using C-c or q. It just freezes.

The app functions properly when executed with sudo privileges (which it shouldn't be). However, it still generates errors:

2024-04-06_13-40

Attempts:

sudo pacman -S gnome-keyring: Already installed
gnome-keyring-daemon --start --components=secrets
systemctl --user status dbus: active

It works in my KDE Plasma 6.0.3, but I don't want to use Plasma.

Tips for project organisation

Hey ! As discussed, here are a few pointers on how I think you can
improve your project.

These tips come after many years as both a C developper, and as
a packager for multiple distro.

Disclaimer: This is very very VERY opiniated. I've been doing that
for my own projects for years now, but your mileage may vary.
Take it all as advices from a fellow C programmer, and not as hard
rules to set in stone.
As always, do your own research, and seek differents points of views
to make your own opinion !

Makefile

The makefile is the entrypoint for both developpers and packagers.
As such, you should standardize its format to make their life easier
when using it to test the program, or package it.

Note that there are bunch of tips you already follow somehow, which
is good, keep it up! I'll put details behind them so you also know
why I think it's good to do it.

0. Avoid cmake and autotools

This is very opiniated! I prefer manually crafted Makefile that I can
easily fix when they break, to procedurally generated one that you cannot
understand or fix.

1. Use widespread rule names

A few key words are implicitely agreed on, and you should include them
in all your makefiles:

  • clean: remove all file generated by the makefile
  • install: install binaries and documentation
  • uninstall: undo any previous installation to clean the system

There are other similar rules like mrproper, distclean, release,
but they are much less common, and IMO make the file longer than it
should be. Make sure to include at least the 3 rules above.

2. Use widespread macros

Just like rule names, some macros can be used to alter how the program
should behave. Some of them are even built-in the make(1) program, so
you should definitely include them as well:

  • CC and LD: Programs to use to compile the project
  • CPPFLAGS: Arguments to pass to the preprocessor
  • CFLAGS: Arguments to pass to the compiler when compiling object files
  • LDFLAGS: Arguments to pass to the linker when linking files together
  • LDLIBS: Libraries to link the program against
  • DESTDIR: Where to install the program as a whole
  • PREFIX: Filepath prefix to use for binaries
  • MANPREFIX: Filepath prefix to use for manual pages

Ok, that's a lot of them. Lets first look at those that are not built into
make(1): DESTDIR, PREFIX, MANPREFIX.

These rules serve the same purpose: installing the program.

PREFIX and MANPREFIX define where to install the binaries and
documentation. Basically, /usr/local and /usr/local/man by default.

DESTDIR, however, serves a different purpose. You can see it more like a
"chroot" option. This is used by packagers mostly, so they can install
the program in a subdirectory, and generate a tarball of the installed
package for example.

Note that setting DESTDIR = /tmp/chroot and PREFIX = /usr/local
is different than only setting PREFIX = /tmp/chroot/usr/local.
Some program reuse the PREFIX macro to do other stuff (eg. generate
documentation or pkg-config files), and as such DESTDIR allow you to
change the target path of the binary without changing the final path.

from the others: CC, LD, CPPFLAGS, CFLAGS, LDFLAGS, LDLIBS,
this leads us to my next point:

3. Use implicit rules

Again, very opiniated. And to be honest, I'm leaning more toward the
"write down everything explicitely" now that I use mk more than make).
However it's important to know that they exist, and to use them when appropriate.

These are rules that are built into the program for common scenarios, like
compiling C source files into objects, and linking objects to binaries.
These rules also make use of predefined macros to let you change their
behavior without having to rewrite those rules.

Here is what they look like:

# Compiles any .c file into the corresponding .o
# Uses CC, CFLAGS and CPPFLAGS macros
.c.o:
        $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<

# Link a .o file into a binary
# Uses LD, LDFLAGS and LDLIBS macros
.o:
	$(LD) $(LDFLAGS) $(LDLIBS) -o $@ $<

This means that by writing your makefile carefully, you do not have to
write how to actually compile files, just how they depend on each others.

Specifying dependencies in a makefile is pretty simple:

target...: dependencies...

And you can add as much as you want, on either side of the ":", and
repeat them multiple time if needed.

Here is an example. This makefile as a whole is totally valid, and running
make would do exactly what you expect: produce the program binary,
all using implicit rules, and recompile what's needed when you update
source files:

program: file1.o file2.o
file1.o file2.o: util.h config.h
file1.o: file1.h
file2.o: file2.h

As an exercise, try to figure out why the following works:

% cat <<EOF > hello.c
> #include <stdio.h>
> int main() {
> 	return printf("Hello, World!\n") > 0;
> }
> EOF
% ls
hello.c
% make hello
cc     hello.c   -o hello
% ./hello
Hello, World!

4. Feature a config.mk file

This is a file where you put all your macros definitions (CFLAGS, LDLIBS, …).
Different systems require different configurations, and having these
macros in their own file makes overriding it easier, rather than using
sed -i to edit the Makefile directly, or to patch it.

Some people would disagree, but as a packager, it makes my life easier
when projects do this (especially when they provide multiple ones per OS,
eg. config.mk.OpenBSD, config.mk.Debian, …)

You can then include the file from your makefile:

include config.mk

Note: You can add a "-" at the beginning ("-include config.mk")
to prevent getting an error if the file doesn't exists.

TL;DR: My take on your Makefile

config.mk

PREFIX  = /usr/local
CPPFLAGS = -I/usr/local/include
CFLAGS  = -Wall -Wextra -pedantic
LDFLAGS = -L/usr/local/lib
LDLIBS  = -lncursesw

Makefile

-include config.mk

tomato: tomato.o util.o input.o update.o anim.o
tomato.o: util.h input.h update.h anim.h
util.o: util.h
anim.o: anim.h
input.o: input.h
update.o: update.h

clean:
	rm -f tomato *.o

install: tomato
	mkdir -p ${DESTDIR}${PREFIX}/bin
	cp tomato ${DESTDIR}${PREFIX}/bin/tomato

uninstall:
	rm -f ${DESTDIR}${PREFIX}/bin/tomato

Cannot launch tomato app because of fatal glibc error

I installed all the dependencies and the program itself, as indicated in the instructions. When I run the program through the "tomato" command, I get the following error:

Fatal glibc error: malloc assertion failure in sysmalloc: (old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old size) >=MINSIZE && prev_inuse (old_top) && ((unsigned long) old_env & (page size - 1)) = 0)

and then the core dumped

add newline to goodbye messages

in file input.c the Lines 195, 405, 432 contain the message "Goodbye!" without a newline. Maybe adding one would be better :)

related PR here: #18

Timer not run when opening notepad

Hi, I've been using tomato.c daily, thanks to you.

Lately, I notice we have new feature, it's notepad. So instead of open a vim buffer to write tasks, I use this instead.

I was doing tasks for hours until I realize I did not receive any break time reward because I was keeping the note open.

And when you pause, the note won't show anything.

Thank you again.

I'm not able to see the notebook or to add a note/task

I'm using NixOS, and I have built the application by running the following

git clone https://github.com/gabrielzschmitz/Tomato.C.git
cd Tomato.C
nix develop
nix build
nix run

When I try to add a note I don't see the "cute notebook", only getting what appears to be a white cursor...however, when I try to add a note, sometimes I can type something, sometimes I get a segmentation fault.

Screenshot-2024-03-23_17-34-03
Screenshot-2024-03-23_17-34-49

Tomato cannot be built due to undefined references

The latest commit that worked for me in my Nix machine is the 11a152fc6c4bdd49b0c212ddf8c1721441270152

Here you can see the full logs:

building '/nix/store/6qjvcwipq9j25l6zs1j0ywwjdpgbmd0s-tomato.drv'...
unpacking sources
unpacking source archive /nix/store/k29sjbfiakidzb5lvvbkjm02hqjz2fsv-Tomato.C
source root is Tomato.C
patching sources
configuring
no configure script, doing nothing
building
build flags: SHELL=/nix/store/4xw8n979xpivdc46a9ndcvyhwgif00hz-bash-5.1-p16/bin/bash
gcc -Wall -Wextra -pedantic -Os -I/usr/local/include  -c -o tomato.o tomato.c
gcc -Wall -Wextra -pedantic -Os -I/usr/local/include  -c -o util.o util.c
gcc -Wall -Wextra -pedantic -Os -I/usr/local/include  -c -o input.o input.c
input.c: In function 'mainMenuInput':
input.c:221:21: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
  221 |                     system("notify-send -t 5000 -c Tomato.C \'華 Work!\' \'You need to focus\'");
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
input.c:223:21: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
  223 |                     system("notify-send -t 5000 -c Tomato.C \'👷 Work!\' \'You need to focus\'");
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
input.c:225:21: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
  225 |                     system("notify-send -t 5000 -c Tomato.C \'Work! You need to focus\'");
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
input.c:229:17: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
  229 |                 system("mpv --no-vid --no-input-terminal --volume=50 /usr/local/share/tomato/sounds/dfltnotify.mp3 --really-quiet &");
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
input.c:261:21: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
  261 |                     system("notify-send -t 5000 -c Tomato.C \'華 Work!\' \'You need to focus\'");
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
input.c:263:21: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
  263 |                     system("notify-send -t 5000 -c Tomato.C \'👷 Work!\' \'You need to focus\'");
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
input.c:265:21: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
  265 |                     system("notify-send -t 5000 -c Tomato.C \'Work! You need to focus\'");
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
input.c:269:17: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
  269 |                 system("mpv --no-vid --no-input-terminal --volume=50 /usr/local/share/tomato/sounds/dfltnotify.mp3 --really-quiet &");
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -Wall -Wextra -pedantic -Os -I/usr/local/include  -c -o update.o update.c
update.c: In function 'doUpdate':
update.c:66:25: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
   66 |                         system("notify-send -t 5000 -c Tomato.C \' Pause Break\' \'You have some time chill\'");
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
update.c:68:25: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
   68 |                         system("notify-send -t 5000 -c Tomato.C \'🌴 Pause Break\' \'You have some time chill\'");
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
update.c:70:25: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
   70 |                         system("notify-send -t 5000 -c Tomato.C \'Long Pause Break. You have some time chill\'");
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
update.c:74:21: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
   74 |                     system("mpv --no-vid --no-input-terminal --volume=50 /usr/local/share/tomato/sounds/pausenotify.mp3 --really-quiet &");
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
update.c:91:25: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
   91 |                         system("notify-send -t 5000 -c Tomato.C \' Pause Break\' \'You have some time chill\'");
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
update.c:93:25: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
   93 |                         system("notify-send -t 5000 -c Tomato.C \'☕ Pause Break\' \'You have some time chill\'");
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
update.c:95:25: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
   95 |                         system("notify-send -t 5000 -c Tomato.C \'Pause Break. You have some time chill\'");
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
update.c:99:21: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
   99 |                     system("mpv --no-vid --no-input-terminal --volume=50 /usr/local/share/tomato/sounds/pausenotify.mp3 --really-quiet &");
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
update.c:132:21: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
  132 |                     system("notify-send -t 5000 -c Tomato.C \'華 Work!\' \'You need to focus\'");
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
update.c:134:21: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
  134 |                     system("notify-send -t 5000 -c Tomato.C \'👷 Work!\' \'You need to focus\'");
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
update.c:136:21: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
  136 |                     system("notify-send -t 5000 -c Tomato.C \'Work! You need to focus\'");
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
update.c:140:17: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
  140 |                 system("mpv --no-vid --no-input-terminal --volume=50 /usr/local/share/tomato/sounds/dfltnotify.mp3 --really-quiet &");
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -Wall -Wextra -pedantic -Os -I/usr/local/include  -c -o anim.o anim.c
gcc -L/usr/local/lib  tomato.o util.o input.o update.o anim.o  `pkg-config --libs ncursesw` -o tomato
/nix/store/4xw8n979xpivdc46a9ndcvyhwgif00hz-bash-5.1-p16/bin/bash: line 1: pkg-config: command not found
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: tomato.o: in function `drawScreen':
tomato.c:(.text+0x55): undefined reference to `stdscr'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: tomato.c:(.text+0x5d): undefined reference to `werase'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: tomato.c:(.text+0x12c): undefined reference to `wrefresh'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: tomato.o: in function `main':
tomato.c:(.text.startup+0x7d): undefined reference to `napms'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.o: in function `initScreen':
util.c:(.text+0x4): undefined reference to `initscr'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.c:(.text+0x9): undefined reference to `use_default_colors'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.c:(.text+0xe): undefined reference to `has_colors'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.c:(.text+0x17): undefined reference to `start_color'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.c:(.text+0x2d): undefined reference to `init_pair'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.c:(.text+0x3f): undefined reference to `noecho'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.c:(.text+0x4b): undefined reference to `mousemask'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.c:(.text+0x5e): undefined reference to `mouseinterval'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.c:(.text+0x63): undefined reference to `cbreak'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.c:(.text+0x6a): undefined reference to `curs_set'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.c:(.text+0x71): undefined reference to `stdscr'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.c:(.text+0x7e): undefined reference to `nodelay'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.o: in function `setColor':
util.c:(.text+0x9b): undefined reference to `stdscr'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.o: in function `getWindowSize':
util.c:(.text+0xb6): undefined reference to `stdscr'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.o: in function `printMainMenu':
util.c:(.text+0x2b1): undefined reference to `mvprintw'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.c:(.text+0x31b): undefined reference to `mvprintw'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.o: in function `printSettings':
util.c:(.text+0x3c2): undefined reference to `mvprintw'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.c:(.text+0x428): undefined reference to `mvprintw'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.c:(.text+0x4a0): undefined reference to `mvprintw'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.o:util.c:(.text+0x516): more undefined references to `mvprintw' follow
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.o: in function `initScreen':
util.c:(.text+0x8e): undefined reference to `keypad'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.o: in function `setColor':
util.c:(.text+0xaf): undefined reference to `wattrset'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.o: in function `printPomodoroCounter':
util.c:(.text+0x16e): undefined reference to `mvprintw'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.o: in function `printPauseIndicator':
util.c:(.text+0x23a): undefined reference to `mvprintw'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.o: in function `printMainMenu':
util.c:(.text+0x386): undefined reference to `mvprintw'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: util.o: in function `printSettings':
util.c:(.text+0x5fb): undefined reference to `mvprintw'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: input.o: in function `mainMenuInput':
input.c:(.text+0x5d): undefined reference to `endwin'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: input.o: in function `handleInputs':
input.c:(.text+0x4ec): undefined reference to `stdscr'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: input.c:(.text+0x509): undefined reference to `wgetch'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: input.c:(.text+0x5cb): undefined reference to `endwin'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: input.c:(.text+0x5e2): undefined reference to `wclear'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: input.c:(.text+0x5ea): undefined reference to `wrefresh'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: input.c:(.text+0x60c): undefined reference to `getmouse'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: input.c:(.text+0x73e): undefined reference to `endwin'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: input.c:(.text+0x74a): undefined reference to `flushinp'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: anim.o: in function `printLogo':
anim.c:(.text+0xce): undefined reference to `mvprintw'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: anim.c:(.text+0xee): undefined reference to `mvprintw'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: anim.c:(.text+0x16f): undefined reference to `mvprintw'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: anim.c:(.text+0x18f): undefined reference to `mvprintw'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: anim.c:(.text+0x1e8): undefined reference to `mvprintw'
/nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: anim.o:anim.c:(.text+0x208): more undefined references to `mvprintw' follow
collect2: error: ld returned 1 exit status
make: *** [<builtin>: tomato] Error 1
error: builder for '/nix/store/6qjvcwipq9j25l6zs1j0ywwjdpgbmd0s-tomato.drv' failed with exit code 2;
       last 10 log lines:
       > /nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: input.c:(.text+0x74a): undefined reference to `flushinp'
       > /nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: anim.o: in function `printLogo':
       > anim.c:(.text+0xce): undefined reference to `mvprintw'
       > /nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: anim.c:(.text+0xee): undefined reference to `mvprintw'
       > /nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: anim.c:(.text+0x16f): undefined reference to `mvprintw'
       > /nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: anim.c:(.text+0x18f): undefined reference to `mvprintw'
       > /nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: anim.c:(.text+0x1e8): undefined reference to `mvprintw'
       > /nix/store/frh9l9nrdysasdi2gs7i241s241ngjw2-binutils-2.39/bin/ld: anim.o:anim.c:(.text+0x208): more undefined references to `mvprintw' follow
       > collect2: error: ld returned 1 exit status
       > make: *** [<builtin>: tomato] Error 1
       For full logs, run 'nix log /nix/store/6qjvcwipq9j25l6zs1j0ywwjdpgbmd0s-tomato.drv'.

can't go 75+15 method

I regularly work in 75+15 method. but i can't go higher than 50 work time in this program. How do i bypass this?

Compilation issues with mpv and ncurses

I love the cool design with cute interfaces and animation. This would surely add some fun to my poor server board.

However, I ran into some problems compiling the project in my environment. It seems that the tomato.c file is hard-coded to <mpv/mpv.h>, which means it won't compile without having mpv installed. Even when I disabled the mpv-related variables in config.h, it still wouldn't work. I guess static variables aren't checked during compilation, so that makes sense.

The same thing happened for <ncurses.h>. My system does have ncurses installed, but it might be too old to include the BUTTON5_PRESSED macro that's needed at input.c:690.

I think it would be helpful if you could include a few system macros that allow disabling external libraries like mpv and ncurses. But anyway thanks and keep up with the great work!

Feature request - disable autostart

Hi! First of all, you did a really great job on this project, thank you!

I just wanted to suggest a feature which I could not find. Would it be possible to implement a setting to disable autostart of the focus/break period?

Thanks!

ALT+NUM = ESC

Sorry for the slow response, Time is definitely running when open notepad now, but fixing this seems to generated another problem.

Now when I switch focus from tomato to another application or back to tomato, it seems to receive a q, and quit out. Tested on dwm and Hyprland.

Originally posted by @tienbuigia in #30 (comment)

Unreadable text

Hi !
Firstly, congratulation for this project it is super fancy !
Just wanted to report a visual issue, I just installed it, but I can't read the help page because the actual keybinds are in black and my terminal is black as well haha
image
Maybe you should use another color for them, or detect the background color of the terminal and adapt if that is possible ?
Anyway hope that helps !

Is there able to use brew to install mpv and libmpv?

I use brew to install mpv and set the PKG_CONFIG_PATH in zshrc but it's still unable to complie.

cc -std=c99 -Wall -Wextra -pedantic -Wunused-result -Wno-unused-variable -Os -D_ISOC99_SOURCE -DTOMATONOISE=\"/opt/local/bin/tomatonoise\" -DLOGPREFIX=\".local/share/tomato\" -DLOGFILE=\".local/share/tomato/tomato.log\" -DTMPFILE=\".local/share/tomato/tmp.log\" -DTIMERFILE=\".local/share/tomato/time.log\" -DNOTEPADFILE=\".local/share/tomato/notepad.log\" -I/opt/local/include -L/opt/local/lib  tomatonoise.c  -lncurses -lmpv -o tomatonoise
tomatonoise.c:1:10: fatal error: 'mpv/client.h' file not found
#include <mpv/client.h>
         ^~~~~~~~~~~~~~
1 error generated.
make: *** [tomatonoise] Error 1

I try to use macports but the same problem still happens.
This is my system info

                    'c.          [email protected]
                 ,xNMM.          --------------------------
               .OMMMMo           OS: macOS 14.4 23E214 arm64
               OMMM0,            Host: Mac14,2
     .;loddo:' loolloddol;.      Kernel: 23.4.0
   cKMMMMMMMMMMNWMMMMMMMMMM0:    Uptime: 12 hours, 30 mins
 .KMMMMMMMMMMMMMMMMMMMMMMMWd.    Packages: 1 (port), 206 (brew)
 XMMMMMMMMMMMMMMMMMMMMMMMX.      Shell: zsh 5.9
;MMMMMMMMMMMMMMMMMMMMMMMM:       Resolution: 1920x1080, 1470x956
:MMMMMMMMMMMMMMMMMMMMMMMM:       DE: Aqua
.MMMMMMMMMMMMMMMMMMMMMMMMX.      WM: Amethyst
 kMMMMMMMMMMMMMMMMMMMMMMMMWd.    Terminal: iTerm2
 .XMMMMMMMMMMMMMMMMMMMMMMMMMMk   Terminal Font: MesloLGS-NF-Regular 14
  .XMMMMMMMMMMMMMMMMMMMMMMMMK.   CPU: Apple M2
    kMMMMMMMMMMMMMMMMMMMMMMd     GPU: Apple M2
     ;KMMMMMMMWXXWMMMMMMMk.      Memory: 2748MiB / 16384MiB
       .cooc,.    .,coo:.


Some icons doesn't show up

image

Hi, I really love this tomato timer.

How do you find the 'sprites'? Did you just design it yourself?

Oh and I have nerdfont, noto-color-emoji, fontawesome but still some icons doesn't do right.
I installed them all by pacman in official arch repo.

[Solved] Unable to compile on Debian 12; can't find <mpv/client.h>

Unable to compile Tomato.C on my machine running Debian 12.
I installed the dependencies listed for Ubuntu through
sudo apt install build-essential libncurses5-dev libncursesw5-dev mpv pkg-config libnotify4

and tried running sudo make install but was greeted with following error:

cc -std=c99 -Wall -Wextra -pedantic -Wunused-result -Wno-unused-variable -Os -D_POSIX_C_SOURCE -DTOMATONOISE=\"/usr/local/bin/tomatonoise\" -DLOGPREFIX=\".local/share/tomato\" -DLOGFILE=\".local/share/tomato/tomato.log\" -DTMPFILE=\".local/share/tomato/tmp.log\" -DTIMERFILE=\".local/share/tomato/time.log\" -DNOTEPADFILE=\".local/share/tomato/notepad.log\" -I/usr/local/include -L/usr/local/lib  tomatonoise.c  `pkg-config --libs ncursesw mpv` -o tomatonoise
Package mpv was not found in the pkg-config search path.
Perhaps you should add the directory containing `mpv.pc'
to the PKG_CONFIG_PATH environment variable
Package 'mpv', required by 'virtual:world', not found
tomatonoise.c:6:10: fatal error: mpv/client.h: No such file or directory
    6 | #include <mpv/client.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
make: *** [<builtin>: tomatonoise] Error 1

Give more details of the previous tomato session

Good day, I just wanted to suggest a feature for the resume prompt:)

image

As a user maybe I should also want to see the previous number of pomodoros done and the time remaining

Take it as something what could improve the experience when having to decide whether or not to resume

Noise icons not loading + issues with noise

The icons on the top left aren't loading and just render as rectangles, and only the rain sound effect works.
Nerd font (Mononoki) installed and up-to-date.
MacOS Big Sur
kitty terminal

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.