Alexays / Waybar

Highly customizable Wayland bar for Sway and Wlroots based compositors. :v: :tada:
MIT License
6.7k stars 710 forks source link

cannot switch from manual to automatic argument indexing #3623

Open Sk7Str1pe opened 2 months ago

Sk7Str1pe commented 2 months ago

appeared at 0.10 and seem not being fixed in latest 0.11.0.

i have an custom AUR updates checker (aur package - waybar-updates) which returns json string, this style was working flawlessly untul i updated. i logs i found this: [2024-09-17 22:35:57.284] [error] custom/upd: cannot switch from manual to automatic argument indexing i already told about this issue but Alexays said he fixed this in 0.11 but he didnt.

waybar-updates output: {"text":"2","alt":"pending-updates","tooltip":"\t\t \t  2\n\nayugram-desktop-bin 5.4.1-1 -> 5.4.1-2\nyay 12.3.5-1 -> 12.4.1-1","class":"pending-updates"} module declaration: "custom/upd": { "format": "{icon}{}", "return-type": "json", "format-icons": { "updated": "" }, "exec-if": "which waybar-updates", "exec": "waybar-updates", "on-click": "kitty -e ~/.config/scripts/upd.sh" },

uwiwiow commented 2 months ago

I had this error with custom/media, i had to change the format from

"custom/media": {
        "format": "{icon} {}",

to

"custom/media": {
        "format": "{0} {1}",
thyeun commented 2 months ago

Same here i have that issue also on my custom/notifications

And the error message as below

[error] custom/notifications: cannot switch from manual to automatic argument indexing

ecorini commented 1 month ago

For me putting {icon} at the end of format string seems to be a workaround

  "custom/updates": {
    "format": "<span foreground=\"orange\">{}</span>{icon}",
    "return-type": "json",
    "format-icons": {
      "updated": "Up to date",
      "pending-updates": "updates",
    },
    "exec-if": "which waybar-updates",
    "exec": "waybar-updates",
    "on-click": "alacritty -T yay -e yay -Syu &"
  },
thyeun commented 1 month ago

if your expectation is icon number than you can use {icon} {0}, and if your expectation is number icon than you should use {} {icon} for it.

Last time before the latest update, it can be use icon number as {icon} {}.

esm7 commented 1 month ago

Experiencing the same on Manjaro after the latest update. My affected setting was:

    "sway/language": {
        "format": "{flag} {}"
    },

Switching the format order to {} {flag} works.

BBaoVanC commented 1 month ago

if your expectation is icon number than you can use {icon} {0}, and if your expectation is number icon than you should use {} {icon} for it.

Last time before the latest update, it can be use icon number as {icon} {}.

Is this a bug, or a documentation issue? The manpage waybar-custom doesn't mention anything about being able to put a number inside the {}, and what it actually does.

thyeun commented 1 month ago

@BBaoVanC I'm not sure what happen to the latest version, but some how, {} with inside number 0 and 1 give different outcome, as per mentioned on my previous post.

If you are main contributor, pls kindly double check, what going on with the code in latest version.