[GH-ISSUE #970] popup-music: seeking position doesn't use precise position but instead changes it in steps of 5 seconds #8729

Closed
opened 2026-05-23 03:54:01 +01:00 by JakeStanger · 8 comments
Owner

Originally created by @postsolar on GitHub (May 12, 2025).
Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/970

Describe the bug

When seeking position, it doesn't set the position to its absolute value but instead increments or decrements it in intervals of 5 seconds. So, if position at, say, 03:00, and I try to set it to 04:00, it would instead be set to 03:05. And vice versa, if it's at 03:00 and I try to set it to 02:00, it would be set to 02:55 instead.

To Reproduce
Steps to reproduce the behavior:

  1. Add module music
  2. Click popup
  3. Try to seek position

Expected behavior

Position seeking works

System information:

  • Distro: NixOS
  • Compositor: Hyprland
  • Ironbar version: 0.16.1

Configuration

Config
{
  "start": [
  ],
  "center": [
    {
      "truncate": {
        "max_length": 60,
        "mode": "start"
      },
      "type": "music"
    }
  ],
  "end": [
  ],
  "height": 30,
  "name": "hyprbar",
  "position": "top"
}

Additional context

playerctl v2.4.1, launched in daemon mode (playerctld)

Originally created by @postsolar on GitHub (May 12, 2025). Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/970 **Describe the bug** When seeking position, it doesn't set the position to its absolute value but instead increments or decrements it in intervals of 5 seconds. So, if position at, say, 03:00, and I try to set it to 04:00, it would instead be set to 03:05. And vice versa, if it's at 03:00 and I try to set it to 02:00, it would be set to 02:55 instead. **To Reproduce** Steps to reproduce the behavior: 1. Add module `music` 2. Click popup 3. Try to seek position **Expected behavior** Position seeking works **System information:** - Distro: NixOS - Compositor: Hyprland - Ironbar version: 0.16.1 **Configuration** <details><summary>Config</summary> ```json { "start": [ ], "center": [ { "truncate": { "max_length": 60, "mode": "start" }, "type": "music" } ], "end": [ ], "height": 30, "name": "hyprbar", "position": "top" } ``` </details> **Additional context** playerctl v2.4.1, launched in daemon mode (`playerctld`)
Author
Owner

@JakeStanger commented on GitHub (May 12, 2025):

How are you performing the seek? It can behave differently depending on whether it's keyboard/mouse/trackpad

<!-- gh-comment-id:2871521115 --> @JakeStanger commented on GitHub (May 12, 2025): How are you performing the seek? It can behave differently depending on whether it's keyboard/mouse/trackpad
Author
Owner

@postsolar commented on GitHub (May 12, 2025):

Touchpad. Either click anywhere within the duration bar, or click and hold the slider to drag it.

I meant to attach a video demo but something is currently broken in my Hyprland setup wrt screen recording.

<!-- gh-comment-id:2871557221 --> @postsolar commented on GitHub (May 12, 2025): Touchpad. Either click anywhere within the duration bar, or click and hold the slider to drag it. I meant to attach a video demo but something is currently broken in my Hyprland setup wrt screen recording.
Author
Owner
<!-- gh-comment-id:2871687601 --> @postsolar commented on GitHub (May 12, 2025): https://github.com/user-attachments/assets/0fa1b635-deb6-4f6e-83b0-ac2bdcb28b8f
Author
Owner

@JakeStanger commented on GitHub (May 12, 2025):

I believe the issue here is as simple as changing the last argument from 5.0
github.com/JakeStanger/ironbar@28136f62bf/src/modules/music/mod.rs (L336)

Ideally that should be configurable. Fingers crossed my PC is running again in a couple of days and I can resolve, otherwise happy for this to be picked up :)

<!-- gh-comment-id:2871729414 --> @JakeStanger commented on GitHub (May 12, 2025): I believe the issue here is as simple as changing the last argument from `5.0` https://github.com/JakeStanger/ironbar/blob/28136f62bf77e9d28fe3c9703a3130af9d3a8176/src/modules/music/mod.rs#L336 Ideally that should be configurable. Fingers crossed my PC is running again in a couple of days and I can resolve, otherwise happy for this to be picked up :)
Author
Owner

@postsolar commented on GitHub (May 12, 2025):

This one is volume and not progress though? I tried setting it to 10.0 just in case and it has no effect on the progress bar.

I suspect the UI part is correct, it's just that something happens between setting the position with mouse and mpris receiving the right command. To be clear, it's not that UI doesn't update correctly (there's a brief moment where it does), but that mpris only skips 5 seconds forward or backward instead of setting an absolute position (and then UI updates to reflect this).

I imagine it originates somewhere here:
github.com/JakeStanger/ironbar@28136f62bf/src/modules/music/mod.rs (L173)

But from what I understand communicating with mpris is all done by an upstream crate?

<!-- gh-comment-id:2871857360 --> @postsolar commented on GitHub (May 12, 2025): This one is volume and not progress though? I tried setting it to 10.0 just in case and it has no effect on the progress bar. I suspect the UI part is correct, it's just that something happens between setting the position with mouse and mpris receiving the right command. To be clear, it's not that UI doesn't update correctly (there's a brief moment where it does), but that mpris only skips 5 seconds forward or backward instead of setting an absolute position (and then UI updates to reflect this). I *imagine* it originates somewhere here: https://github.com/JakeStanger/ironbar/blob/28136f62bf77e9d28fe3c9703a3130af9d3a8176/src/modules/music/mod.rs#L173 But from what I understand communicating with mpris is all done by an upstream crate?
Author
Owner

@JakeStanger commented on GitHub (May 12, 2025):

This one is volume and not progress though?

🤦 oh yeah. Yeah it won't be that then. Sorry

But from what I understand communicating with mpris is all done by an upstream crate?

Yes, although I don't think that's doing anything other than passing the milliseconds to DBUS:
github.com/Mange/mpris-rs@9f55730b9d/src/player.rs (L635-L639)

I suspect the UI part is correct, it's just that something happens between setting the position with mouse and mpris receiving the right command.

Have you confirmed if the same behaviour occurs across multiple players? This could be something specific to the player implementation.

<!-- gh-comment-id:2871896795 --> @JakeStanger commented on GitHub (May 12, 2025): > This one is volume and not progress though? 🤦 oh yeah. Yeah it won't be that then. Sorry > But from what I understand communicating with mpris is all done by an upstream crate? Yes, although I don't think that's doing anything other than passing the milliseconds to DBUS: https://github.com/Mange/mpris-rs/blob/9f55730b9dff3a3a62ad98531ed7098e146fc03e/src/player.rs#L635-L639 > I suspect the UI part is correct, it's just that something happens between setting the position with mouse and mpris receiving the right command. Have you confirmed if the same behaviour occurs across multiple players? This could be something specific to the player implementation.
Author
Owner

@postsolar commented on GitHub (May 12, 2025):

Have you confirmed if the same behaviour occurs across multiple players?

Actually, no. But now that I did I think mpv and telegram-desktop handle this correctly whereas Chrome and Firefox do not. On the other hand, playerctl position <absolute position> also works correctly with Firefox.

I think what they do is use set_position instead of seek for an absolute position:
github.com/altdesktop/playerctl@b19a71cb9d/playerctl/playerctl-cli.c (L363-L379)

There's a set_position function in the Rust crate too, but I'm not sure how to get the track ID.

<!-- gh-comment-id:2872130437 --> @postsolar commented on GitHub (May 12, 2025): > Have you confirmed if the same behaviour occurs across multiple players? Actually, no. But now that I did I think mpv and telegram-desktop handle this correctly whereas Chrome and Firefox do not. On the other hand, `playerctl position <absolute position>` also works correctly with Firefox. I think what they do is use `set_position` instead of `seek` for an absolute position: https://github.com/altdesktop/playerctl/blob/b19a71cb9dba635df68d271bd2b3f6a99336a223/playerctl/playerctl-cli.c#L363-L379 There's a [`set_position`](https://github.com/Mange/mpris-rs/blob/9f55730b9dff3a3a62ad98531ed7098e146fc03e/src/player.rs#L257) function in the Rust crate too, but I'm not sure how to get the track ID.
Author
Owner

@JakeStanger commented on GitHub (May 12, 2025):

but I'm not sure how to get the track ID.

Player#get_metadata will return that
https://docs.rs/mpris/latest/mpris/struct.Player.html

<!-- gh-comment-id:2872323943 --> @JakeStanger commented on GitHub (May 12, 2025): > but I'm not sure how to get the track ID. `Player#get_metadata` will return that https://docs.rs/mpris/latest/mpris/struct.Player.html
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
JakeStanger/ironbar#8729
No description provided.