Waybar: mpd not updating status after toggle

Created on 21 Jul 2020  ·  4Comments  ·  Source: Alexays/Waybar

Hi,

I'm having a strange problem with mpd. When I issue an mpc stop or mpc toggle command using one of the defined shortcuts from sway (e.g. with bindsym - see the config snippet at the bottom) then waybar does not correctly update the info in the output.

The mpc next and mpc prev seem to work fine however.

When I issue mpc stop or toggle then the update stays on that status regardless if I toggle it back (note the bindsym for mpc in sway itself works correctly and it's really just waybar that stops updating its own status).

The only workaround (which isn't an option but for completeness sake) is to force a re-reading of the config anytime mpc toggle or mpc stop were issued. (then the output matches again the actual state of mpc).

What it looks like fresh after start-up:

1595317784_grim_rootwin

What it looks like after I issue mpc toggle once. And it stays after that like this regardless how many times I try to mpc toggle or mpc stop:

toggle_1595317836_grim_rootwin

Here is what it looks like after I force a reload of the sway config using mod+Shift+c: It says (correctly stopped). I can only get the correct status using such a forced reload.

stop_1595317924_grim_rootwin

    "mpd": {
        "server": "127.0.0.1",
        "port": 6600,
        "tooltip": false,
        //"format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ",
        "format": "{stateIcon} {consumeIcon}{randomIcon}{artist} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ",
        "format-disconnected": "Disconnected ",
        "format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ",
        "unknown-tag": "N/A",
        "interval": 2,
        "max-length": 60,
        "consume-icons": {
            "on": " "
        },
        "random-icons": {
            "off": "<span color=\"#f53c3c\"></span> ",
            "on": " "
        },
        "repeat-icons": {
            "on": " "
        },
        "single-icons": {
            "on": "1 "
        },
        "state-icons": {
            "paused": "",
            "playing": ""
        }
    },
    "idle_inhibitor": {
        "format": "{icon}",
        "format-icons": {
            "activated": "",
            "deactivated": ""
        }
    },

my .config/sway/config uses mpc commands. These work correctly in sway itself but waybar fails to update the status whenever I use them:

# Media player controls
bindsym --locked $mod+t exec mpc toggle
bindsym --locked $mod+n exec mpc next
bindsym --locked $mod+p exec mpc prev
bindsym --locked $mod+x exec mpc stop

mpd itself runs as a regular user and is configured to listen on:

bind_to_address     "any"
bind_to_address     "/home/da/.mpd/socket"
port                "6600"

(note that setting the mpd server in waybar/config to socket does not seem to work - though I suspect this has nothing to do with waybar since restricting all connections to the socket won't produce any music on my setup whether in i3 or sway).

Most helpful comment

I don't use the mpd module, but can confirm I get the same behavior. Seems to have been broken by 6e7f22ac3ada6e27facee84fcbe2b3973eadbe1d. After that commit, the event listener thread no longer loops so it only processes the first event and then exits. Seems to work as expected if I add the while loop back in, but I don't really understand why it was removed in the first place. Maybe @Alexays has a better idea of how to fix it

All 4 comments

any ideas? this is a showstopper for me as the module is totally useless if it doesn't show change of state unless the whole waybar gets restarted. I can make my own script but considering that mpd should work I'd really rather use the one that comes with waybar. or maybe I'm doing something wrong in which case would highly appreciate any pointers. cheers

I don't use the mpd module, but can confirm I get the same behavior. Seems to have been broken by 6e7f22ac3ada6e27facee84fcbe2b3973eadbe1d. After that commit, the event listener thread no longer loops so it only processes the first event and then exits. Seems to work as expected if I add the while loop back in, but I don't really understand why it was removed in the first place. Maybe @Alexays has a better idea of how to fix it

Came here to report this bug. I'm glad to see it already exists.

Arch Linux just updated this package to the latest version today:

→ pacman -Q | grep waybar
waybar 0.9.3-1

So now MPD gets stuck everytime I toggle. This is quite annoying.

Should be good with a446cd692d19acc215aa1fe42a2e24f7507ea2d5
My bad, oops :)
edit: i through it was a sleeper thread not a native thread

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ForTheReallys picture ForTheReallys  ·  5Comments

spk picture spk  ·  6Comments

GeoDerp picture GeoDerp  ·  5Comments

ilpianista picture ilpianista  ·  4Comments

Sqvid picture Sqvid  ·  5Comments