Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interval=persist stops working after a while #451

Open
tastytea opened this issue Aug 11, 2021 · 2 comments
Open

interval=persist stops working after a while #451

tastytea opened this issue Aug 11, 2021 · 2 comments

Comments

@tastytea
Copy link

The program prints the time every second. After a while (usually between 1 and 3 days), the block is not updated anymore. This always seems to happen right after a resume from suspend, but not after every resume. The program does not crash and if I run it in a terminal it works fine. I never see the error message (see below) in the block.

I use this configuration:

[time]
command=statustime
interval=persist
markup=pango

First with this shell-script:

#!/bin/sh

while sleep 1; do
    LC_TIME="de_DE.UTF-8"
    datetime="$(date +'<b><span color="orange">%A</span></b>, %Y-%m-%d <span color="lightcyan">%H:%M</span>')"

    echo "${datetime}"
done

echo -e "\n<span color='red'>Error: Time script crashed.</span>"
exit 33

and now with this C++-program:

#include <fmt/chrono.h>
#include <fmt/core.h>

#include <chrono>
#include <exception>
#include <iostream>
#include <locale>
#include <thread>

int main()
{
    using fmt::format;
    using std::cout;
    using namespace std::chrono_literals;

    // Set explicitly, because LC_TIME is en_DK.UTF-8.
    std::locale::global(std::locale("de_DE.UTF-8"));

    try
    {
        while (true)
        {
            cout << format(R"(<b><span color="orange">{0:%A}</span></b>, )"
                           R"({0:%Y-%m-%d} )"
                           R"(<span color="lightcyan">{0:%H:%M}</span>)",
                           std::chrono::system_clock::now())
                 << std::endl; // NOTE: Don't forget that we need to flush! 😊
            std::this_thread::sleep_for(1s);
        }
    }
    catch (const std::exception &e)
    {
        cout << "\n<span color='red'>Error: Time script crashed.</span>\n";
        std::cerr << e.what() << '\n';
        return 33;
    }
}

Might be related to #450.

@zsugabubus
Copy link

What you describe is basically like other xtitle issues… just with echo here. I bet #425 will solve your issues.

@tastytea
Copy link
Author

tastytea commented Aug 15, 2021

Thank you! I ran i3blocks with your patch for 6 days now and the problem did not appear so far.

dllud pushed a commit to dllud/i3blocks that referenced this issue Jan 12, 2024
rofi-wttr: Weather display with forecast popup

A minimal weather line with forecast pop up on click. Using rofi for the pop up and wttr.in as the weather interface.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants