Coder Social home page Coder Social logo

Comments (3)

gabrielzschmitz avatar gabrielzschmitz commented on May 27, 2024 1

About just the rain working. It's my bad, just replace all the void toggleNoise(appData * app, int noise) function at util.c by this:

void toggleNoise(appData * app, int noise){
    if(noise == 1){
        if(app->playRainNoise == 0){
            app->playRainNoise = 1;
            if(app->runRainOnce == 0){
                char * rainnoisecmd[] = {
                    "/usr/local/share/tomato/sounds/ambience-rain.wav",
                    app->rainVolume, "tomato noise rain",
                    NULL};
                app->rainNoisePID = fork();
                app->runRainOnce = 1;
                if(app->rainNoisePID == 0)
                    execv(TOMATONOISE, rainnoisecmd);
            }
            else{
                FILE *tmpfile;
                tmpfile = fopen("/tmp/tomato_rain_state", "w");
                fprintf(tmpfile, "%s ON", app->rainVolume);
                fclose(tmpfile);
            }
        }
        else if(app->playRainNoise == 1){
            FILE *tmpfile;
            tmpfile = fopen("/tmp/tomato_rain_state", "w");
            fprintf(tmpfile, "%s ON", "0");
            fclose(tmpfile);
            app->playRainNoise = 0;
        }
    }
    else if(noise == 2){
        if(app->playFireNoise == 0){
            app->playFireNoise = 1;
            if(app->runFireOnce == 0){
                char * firenoisecmd[] = {
                    "/usr/local/share/tomato/sounds/ambience-fire.wav",
                    app->fireVolume, "tomato noise fire",
                    NULL};
                app->fireNoisePID = fork();
                app->runFireOnce = 1;
                if(app->fireNoisePID == 0)
                    execv(TOMATONOISE, firenoisecmd);
            }
            else{
                FILE *tmpfile;
                tmpfile = fopen("/tmp/tomato_fire_state", "w");
                fprintf(tmpfile, "%s ON", app->fireVolume);
                fclose(tmpfile);
            }
        }
        else if(app->playFireNoise == 1){
            FILE *tmpfile;
            tmpfile = fopen("/tmp/tomato_fire_state", "w");
            fprintf(tmpfile, "%s ON", "0");
            fclose(tmpfile);
            app->playFireNoise = 0;
        }
    }
    else if(noise == 3){
        if(app->playWindNoise == 0){
            app->playWindNoise = 1;
            if(app->runWindOnce == 0){
                char * windnoisecmd[] = {
                    "/usr/local/share/tomato/sounds/ambience-wind.wav",
                    app->windVolume, "tomato noise wind",
                    NULL};
                app->windNoisePID = fork();
                app->runWindOnce = 1;
                if(app->windNoisePID == 0)
                    execv(TOMATONOISE, windnoisecmd);
            }
            else{
                FILE *tmpfile;
                tmpfile = fopen("/tmp/tomato_wind_state", "w");
                fprintf(tmpfile, "%s ON", app->windVolume);
                fclose(tmpfile);
            }
        }
        else if(app->playWindNoise == 1){
            FILE *tmpfile;
            tmpfile = fopen("/tmp/tomato_wind_state", "w");
            fprintf(tmpfile, "%s ON", "0");
            fclose(tmpfile);
            app->playWindNoise = 0;
        }
    }
    else if(noise == 4){
        if(app->playThunderNoise == 0){
            app->playThunderNoise = 1;
            if(app->runThunderOnce == 0){
                char * thundernoisecmd[] = {
                    "/usr/local/share/tomato/sounds/ambience-thunder.wav",
                    app->thunderVolume, "tomato noise thunder",
                    NULL};
                app->thunderNoisePID = fork();
                app->runThunderOnce = 1;
                if(app->thunderNoisePID == 0)
                    execv(TOMATONOISE, thundernoisecmd);
            }
            else{
                FILE *tmpfile;
                tmpfile = fopen("/tmp/tomato_thunder_state", "w");
                fprintf(tmpfile, "%s ON", app->thunderVolume);
                fclose(tmpfile);
            }
        }
        else if(app->playThunderNoise == 1){
            FILE *tmpfile;
            tmpfile = fopen("/tmp/tomato_thunder_state", "w");
            fprintf(tmpfile, "%s ON", "0");
            fclose(tmpfile);
            app->playThunderNoise = 0;
        }
    }
}

and replace this part at tomatonoise.c:

    char line[25];
    int save;

    FILE *tmpfile;
-    tmpfile = fopen(tmppath, "r");
-    if(tmpfile){
-        tmpfile = fopen(tmppath, "w");
-        fprintf(tmpfile, "%s", volume);
-        fclose(tmpfile);
-    }
-    else{
-        tmpfile = fopen(tmppath, "w");
-        fprintf(tmpfile, "%s", volume);
-        fclose(tmpfile);
-    }
+    tmpfile = fopen(tmppath, "w");
+    fprintf(tmpfile, "%s ON", volume);
+    fclose(tmpfile);

    // Done setting up options.
    mpvCheckError(mpv_initialize(mpvCtx));

It's my bad, I pushed the paths to the files in debug mode :(

Now, about the icons, i don't really know why this happen. Try using just icons on and return me a screenshot, so I know if is just the nerdicons or just the text itself! Maybe the fix of the files path just fix the icons too, but give me feedback.

from tomato.c.

indigomarxist avatar indigomarxist commented on May 27, 2024

This did fix the noise issue! However, the icon issue still persists.
I'm not sure what you mean by this:

Now, about the icons, i don't really know why this happen. Try using just icons on and return me a screenshot, so I know if is just the nerdicons or just the text itself! Maybe the fix of the files path just fix the icons too, but give me feedback.

Thank you so much for the help! I truly love the project.

Edit: As for the icons I believe it may be on my end, I'm experimenting with what icons will display in my terminal.

from tomato.c.

gabrielzschmitz avatar gabrielzschmitz commented on May 27, 2024

You need to place the font at your terminal config or xresources and about that:

Now, about the icons, i don't really know why this happen. Try using just icons on and return me a screenshot, so I know if is just the nerdicons or just the text itself! Maybe the fix of the files path just fix the icons too, but give me feedback.

I was talking about editing the config.h and using "iconson" at ICONS, and send me a screenshot.
static const char * ICONS = "iconson";

from tomato.c.

Related Issues (20)

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.