Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mpris blacklist support #390

Merged
merged 15 commits into from
Jul 24, 2024
Merged

Conversation

abmantis
Copy link
Contributor

Continuation of PR #324.

@abmantis
Copy link
Contributor Author

abmantis commented Feb 25, 2024

When I run the formatter, there are quite a few changes to the mpris.vala file. I am assuming the style rule was updated meanwhile. Let me know if you want me to commit those changes too.

@MrPenguin07
Copy link
Contributor

Continuation of PR #324.

Great to see progress on this.... and to see where my code was convoluted :)
I'll pull this now and report back.

Regards

@MrPenguin07
Copy link
Contributor

Alright, so with config as so;

"mpris": {
    "image-size": 96,
    "image-radius": 6,
    "blacklist": [".*firefox.*"]
},

SwayNC reports at startup;

** Message: 13:13:39.774: mpris.vala:263: "org.mpris.MediaPlayer2.firefox.instance_1_5133" is blacklisted
** Message: 13:13:39.774: factory.vala:44: Loading widget: mpris

So regex is being respected, and the annoying firefox tabs each creating their own instance is no longer showing in SwayNC.

Thumbsup, I approve.

@ErikReider
Copy link
Owner

I'll get to this after the upcoming bug release :)

@MrPenguin07
Copy link
Contributor

I've noticed that firefox instances aren't always blacklisted from the mpris module;

Upon swaync startup, instances are identified and removed. Great.
However, sometimes an existing swaync session does not pickup new firefox tabs/mpris players.
When this happens, if I run $ swaync-client --reload-config the new firefox tabs are then removed from the mpris player.
I also noticed this happening with my original PR.

I've yet to produce a repeatable scenario for this, however have noticed it happening quite a few times.

@ErikReider
Copy link
Owner

I've noticed that firefox instances aren't always blacklisted from the mpris module;

Upon swaync startup, instances are identified and removed. Great. However, sometimes an existing swaync session does not pickup new firefox tabs/mpris players. When this happens, if I run $ swaync-client --reload-config the new firefox tabs are then removed from the mpris player. I also noticed this happening with my original PR.

I've yet to produce a repeatable scenario for this, however have noticed it happening quite a few times.

I'll wait until this is resolved then

@abmantis
Copy link
Contributor Author

I've noticed that firefox instances aren't always blacklisted from the mpris module;
Upon swaync startup, instances are identified and removed. Great. However, sometimes an existing swaync session does not pickup new firefox tabs/mpris players. When this happens, if I run $ swaync-client --reload-config the new firefox tabs are then removed from the mpris player. I also noticed this happening with my original PR.
I've yet to produce a repeatable scenario for this, however have noticed it happening quite a few times.

I'll wait until this is resolved then

May I suggest that we merge this still? It still improves the functionality since currently, FF will always be duplicated anyway. Also we avoid having stale PRs for things that are already done (even if there is some unknown issue).

If there is some quirk, it can be fixed later. It would also help having more people use this and reporting so we can pinpoint the issue.

Otherwise, we risk never finding the cause and this PR will just stay open forever.

@MrPenguin07
Copy link
Contributor

I've noticed that firefox instances aren't always blacklisted from the mpris module;
Upon swaync startup, instances are identified and removed. Great. However, sometimes an existing swaync session does not pickup new firefox tabs/mpris players. When this happens, if I run $ swaync-client --reload-config the new firefox tabs are then removed from the mpris player. I also noticed this happening with my original PR.
I've yet to produce a repeatable scenario for this, however have noticed it happening quite a few times.

I'll wait until this is resolved then

I believe, without reviewing the code but from the observed behavior, that this is simply caused by the mpris widget lacking a hook which checks if new players are in the blacklist prior to adding them first.
Thus starting/reloading Swaync will correctly identify and blacklist existing players on startup, however especially with firefox where new instances/players come and go, we lack the mechanism to cross reference the blacklist before adding it.

@abmantis makes some points, though can also accept it's best a feature is complete before merge.
Unless you beat me to it, i'll get onto this later this week regardless.

@ErikReider
Copy link
Owner

I'd rather not merge incomplete features

@abmantis
Copy link
Contributor Author

@MrPenguin07 any findings?

@abmantis
Copy link
Contributor Author

abmantis commented May 9, 2024

@ErikReider I was now able to reproduce the issue mentioned by @MrPenguin07 and just fixed it.
@MrPenguin07 can you try out my last commit?

@MrPenguin07
Copy link
Contributor

@ErikReider I was now able to reproduce the issue mentioned by @MrPenguin07 and just fixed it. @MrPenguin07 can you try out my last commit?

I appreciate your taking the time to hash this one out, glad to see my suspicion was correct.
Just haven't had time to code much of anything these days :/

I've pulled your latest commit, built swaync and ....
image

Am happy to be greeted by this when a new player is added, without needing to reload swaync.
Good stuff @abmantis

I consider this feature to now be complete @ErikReider

@abmantis
Copy link
Contributor Author

I initially misinterpreted your description of the issue, that is why I was not able to reproduce it.
Yesterday, after coming back to this and reading it again I noticed that it was in fact easy to reproduce :D

@ErikReider are you ok with moving this forward now?

@rtgiskard
Copy link

rtgiskard commented May 14, 2024

@abmantis I like this, but I think it's better to keep only necessary changes, flake.nix is not likely to be included in this project, and the message() can be removed, just to keep it simple. Except for the manual page, configSchema.json need to be synced too.

@rtgiskard
Copy link

rtgiskard commented May 14, 2024

Just fixed a typo-like bug for name_owner_changed signal handler skipped, which should resolve the issue above, and also this: #425.

It's now here in the main branch with another PR in process, If you're willing, I may create another PR including this feature with the fix.

@abmantis abmantis closed this May 17, 2024
@abmantis
Copy link
Contributor Author

Closed by mistake. I thought this was pushed to main, but I was checking a fork 🤦

@abmantis abmantis reopened this May 17, 2024
@abmantis
Copy link
Contributor Author

Removed the flake.nix file, which was committed by mistake.

@abmantis
Copy link
Contributor Author

Just fixed a typo-like bug for name_owner_changed signal handler skipped, which should resolve the issue above, and also this: #425.

It's now here in the main branch with another PR in process, If you're willing, I may create another PR including this feature with the fix.

I think it would be better to keep this PR and to have separate PRs.

@MrPenguin07
Copy link
Contributor

Reporting: 2 weeks of testing these commits and the mpris blacklist continues to work perfectly.

@abmantis
Copy link
Contributor Author

abmantis commented Jun 9, 2024

@ErikReider anything else required for this?

@denoobaprolinux
Copy link

@ErikReider anything else required for this?

Should be merged, it works flawlessly.

@ErikReider ErikReider added the enhancement New feature or request label Jul 10, 2024
Copy link
Owner

@ErikReider ErikReider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than that, LGTM! Thanks for your extreme patience xD

man/swaync.5.scd Show resolved Hide resolved
src/controlCenter/widgets/mpris/mpris.vala Outdated Show resolved Hide resolved
src/controlCenter/widgets/mpris/mpris.vala Outdated Show resolved Hide resolved
@abmantis abmantis requested a review from ErikReider July 13, 2024 23:33
@MrPenguin07
Copy link
Contributor

LGTM :)

Copy link
Owner

@ErikReider ErikReider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks! :D

@ErikReider ErikReider merged commit 723645e into ErikReider:main Jul 24, 2024
6 checks passed
@abmantis abmantis deleted the mpris_blacklist branch July 24, 2024 11:28
@denoobaprolinux
Copy link

Sorry for bumping this again, but I have to comment something:

I reinstalled Arch Linux and installed my dotfiles one more time a couple days ago, and installed Swaync from the main repo (not building it from source) and the problem persists.

My code in mpris:

"mpris": {
"image-size": 60,
"image-radius": 12,
"blacklist":["playerctld"]
},

Am I missing something? I saw it was merged already, so I was expecting this correction to be available in Arch repos already.

@MrPenguin07
Copy link
Contributor

Sorry for bumping this again, but I have to comment something:

Am I missing something? I saw it was merged already, so I was expecting this correction to be available in Arch repos already.

"mpris": {
"image-size": 60,
"image-radius": 12,
"blacklist":["playerctld"]
},

Presuming you've copy-pasted, try adding a space between "blacklist": and ["playerctld"]

@ErikReider
Copy link
Owner

Sorry for bumping this again, but I have to comment something:

I reinstalled Arch Linux and installed my dotfiles one more time a couple days ago, and installed Swaync from the main repo (not building it from source) and the problem persists.

My code in mpris:

"mpris": { "image-size": 60, "image-radius": 12, "blacklist":["playerctld"] },

Am I missing something? I saw it was merged already, so I was expecting this correction to be available in Arch repos already.

It's not in a current release yet, you'll need to install swaync-git from the AUR

@denoobaprolinux
Copy link

Sorry for bumping this again, but I have to comment something:

I reinstalled Arch Linux and installed my dotfiles one more time a couple days ago, and installed Swaync from the main repo (not building it from source) and the problem persists.

My code in mpris:

"mpris": { "image-size": 60, "image-radius": 12, "blacklist":["playerctld"] },

Am I missing something? I saw it was merged already, so I was expecting this correction to be available in Arch repos already.

It's not in a current release yet, you'll need to install swaync-git from the AUR

It totally worked on the -git version. I'll be there until the stable branch is ready. Thanks for the response!

mochaaP pushed a commit to traidento/SwayNotificationCenter that referenced this pull request Oct 23, 2024
* Initial mpris blacklist support

* Fix merge conflict

* Simplify blacklist type and parse

* Fix man

* Trim whitespaces

* Fix blacklisting when a new player appears

* Remove flake.nix

* Remove log

* Remove comment

* Address review suggestions

* Fixed linter errors

---------

Co-authored-by: 12thgenpenguin <cjgibb@protonmail.com>
Co-authored-by: MrPenguin07 <127086564+MrPenguin07@users.noreply.github.com>
Co-authored-by: Erik Reider <35975961+ErikReider@users.noreply.github.com>
(cherry picked from commit 723645e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants