Alexays / Waybar

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

Howto focus on playing mpris stream? #1173

Open tmpm697 opened 3 years ago

tmpm697 commented 3 years ago

I'm using this config:

  "custom/media": {
    "format": "{icon}{}",
    "return-type": "json",
    "format-icons": {
      "Playing": " ",
      "Paused": " ",
    },
    "max-length":70,
    "exec": "playerctl metadata --format '{\"text\": \"{{title}}\", \"tooltip\": \"{{playerName}} : {{title}}\", \"alt\": \"{{status}}\", \"class\": \"{{status}}\"}' -F",
    "on-click": "playerctl play-pause",
  },

It has problem with multiple streams that I'm piping to mpris: mpd and firefox. When I click to pause or play, it always priority paused firefox stream over mpd (mpDris2)

I want smth like:

  1. If pause one of stream, other will take priority and appears in bar/module
  2. If two streams playing, I can set priority of a stream over other.

Current state: firefox mpris always takes high priority, play in firefox will have it appear in bar, and click on module will actions on firefox mpris even mpd is appearing in bar.

tmpm697 commented 3 years ago

It weird that playerctl metadata only show firefox, no mpd shows up. So I guess mpDris2 doesn't insert its stream in here.

Diegovsky commented 2 years ago

Thanks for the module btw. playerctl will use the first avaibable player when you call it, so if you start watching a video on firefox it will be the first, at least on my system.

You can force playerctl to only control a player that matches a string with --player|-p or ignore player with --ignore-players|-i. Hope that helps !