amnweb / yasb

A highly configurable cross-platform (Windows) status bar written in Python.
Other
132 stars 16 forks source link

Add Media Widget #5

Closed thomasroodnl closed 1 month ago

thomasroodnl commented 1 month ago

Adds a media widget that shows the currently playing media as pulled from the Windows API. In addition, it features media buttons (previous/next track and play/pause). Provides some options for shortening fields with ellipsis to prevent the bar from blowing up from the occasional large title/artist field. Media thumbnail is used as a semi-transparent background.

For those who want it to take up little space in the bar, you can also disable the text/thumbnail field in the config and just have the media control buttons instead.

Still needs some work on the styling. Depending on the thumbnail, text might not be as legible. You can mitigate this with the background transparency, but I'd rather have something like text shadow to help improve legibility across thumbnails.

Known issue: Border highlight on hover is rectangular instead of circular, despite having border-radius set for the hover state in CSS.

Also good to note is that this introduces a new dependency, qasync, which is needed to make async calls work properly with PyQt6. These async calls are needed for the media retrieval. I also had to change the main loop code a bit to make this work. I tested many of the bar functions and they seem unaffected by the change, but it is good to keep it into account.