Waybar icon indicating copy to clipboard operation
Waybar copied to clipboard

Clock module format string regression: doesn't support some common date formats

Open spencer-maaaaan opened this issue 2 years ago • 4 comments

After upgrading from 0.9.9-1 -> 0.9.9-2 from the Arch Linux repository, waybar omits my clock#time module but still draws my clock#date module with no trouble. The only error message I get when running the bar from a shell is [error] : invalid format, which makes it sound like the config has a JSON syntax error, but it worked fine in the previous version.

I prefer to have the time alone in the modules-center, and my date off to the side in modules-right. The only fix I've found to keep the format I want is to downgrade to 0.9.9-1.

This is one of my first GitHub issues, so if any more information would be helpful just let me know and I can include it. Attached are my config stylesheet.

config.txt style.txt .

spencer-maaaaan avatar Feb 28 '22 16:02 spencer-maaaaan

appears to be similar to #1439. I had to change the time format to use %R to get it to work.

randre03 avatar Mar 01 '22 02:03 randre03

I filed this as https://bugs.archlinux.org/task/73982, looks like here’s the right place now, as it affects anyone building from source with up-to-date dependencies.

So %l (space-padded hour, 1–12; as an aside, I’ve always found it quite baffling that there’s mostly no unpadded hour figure in strftime—though glibc has %-I for the purpose) and %P (am/pm, lowercase unlike %p) have become broken in some dependency of this.

Actually, referring to a disgruntled comment I put in my ~/.config/waybar/config: %l and %P were already broken in clock’s tooltip-format, but worked in format. These sorts of inconsistencies (this, pango markup working in some places but not others, that kind of thing) are rather frustrating.

I suggest retitling this issue to mention that it’s a clock format string regression.

For now, I’ll stick with Arch’s 0.9.9-1 package.

chris-morgan avatar Mar 01 '22 23:03 chris-morgan

According to https://github.com/fmtlib/fmt/issues/2811, the std::tm formatter intentionally no longer supports system-defined specifiers like %-I.

euclio avatar Mar 15 '22 23:03 euclio

I was able to achieve this without using the Clock module as follows. Please refer to the following if there is no problem. image

~/.config/waybar/config

    "custom/clock"
    "custom/clock": {
        "format": "{}",
        "interval": 5,
        "exec": "date +%-m/%d\\(%a\\)%-H:%M",
    },

~/.config/waybar/style.css

#custom-clock,
#custom-clock {
    font-weight: bold;
    background-color: @theme_bg_color;
}

tkna91 avatar Jul 28 '22 05:07 tkna91

Hi @spencer-maaaaan, @chris-morgan, @randre03, @euclio, @tkna91 , please see https://github.com/Alexays/Waybar/issues/1469#issuecomment-1441870125

LukashonakV avatar Feb 23 '23 14:02 LukashonakV

Hi @spencer-maaaaan , can you close the issue as a duplicate pf #1469 please?

LukashonakV avatar Mar 01 '23 09:03 LukashonakV

It should be the other way round: this covers the entire range of regressions (%0I, %-I, %P, and anything else, frankly), whereas #1469 only covers %0I (… and it even misspells it as %OI in its title!).

(In light of the successful landing of glibc padding stuff, I’ve submitted a patch for %P in https://github.com/fmtlib/fmt/pull/3314.)

chris-morgan avatar Mar 01 '23 12:03 chris-morgan