FelixKratz / SketchyBar

A highly customizable macOS status bar replacement
https://felixkratz.github.io/SketchyBar/
GNU General Public License v3.0
6.67k stars 97 forks source link

Allow images to have more properties #428

Closed Pe8er closed 1 year ago

Pe8er commented 1 year ago

It would be fantastic if background.image could have more properties, for example:

As an example -- I'd like to be able for the album artwork in this bar item and popup to have rounded edges, so that it blends in better with the bar item / popup:

Untitled

FelixKratz commented 1 year ago

I have added all of the domains you suggested to all image properties here: https://github.com/FelixKratz/SketchyBar/commit/f60b9d6d5c1434bb71c41d3d3726b7bfa6cbfa11

If you want you can test it by installing the head version in brew:

brew uninstall sketchybar
brew install sketchybar --head
brew services restart sketchybar

and then go back to the stable version via:

brew uninstall sketchybar
brew install sketchybar
brew services restart sketchybar
Pe8er commented 1 year ago

Wow, thank you so much!! I just tested it and all new properties work! A couple small issues:

image
  1. Image in the bar (with green border, I made it too big on purpose) is behind the bar. It should be on top, probably. Also, what's interesting, bar's blur doesn't apply to it.
  2. In the popup, image's bottom is cut off (you can tell because rounded corners are missing), because I applied y_offset to add padding from the top.

There is a chance I screwed something up in the code. Feel free to take a look yourself!

Music item: https://github.com/Pe8er/dotfiles/blob/master/config.symlink/sketchybar/items/music.sh

Music plugin: https://github.com/Pe8er/dotfiles/blob/master/config.symlink/sketchybar/plugins/music.sh

While I have your attention 😀 there is one more thing I noticed: I use the media_change event to get current song info (from Music app) since it's so elegant and simple. It seems like information is generated only when media_change happens, which means when music is already playing and I restart sketchybar, my widget is empty until I toggle pause or skip a song. It feels like media_change works as intended, but I'm wondering if there is a way to obtain current song info on forced event too?

Thanks a ton!

FelixKratz commented 1 year ago

I have made some changes to fix some quirks with the images, both of your problems should be fixed now. You can update the dev version by running:

brew upgrade sketchybar --fetch-HEAD
brew services restart sketchybar

As for the media_change event: For most events, e.g. front_app_switched, volume_change, etc., I fire the event on startup such that all information can be processed at launch. Internally I do this via "forced" events, which are not emitted by the operating system, but rather retrieved on demand and then send as a regular event to the script. In a sense, these are synthectical events I need to manually assemble. This is probably possible for the media_change event too. I will have a look if I can manage to craft a "forced" media_change event, which would be emitted on startup.

EDIT: media_change event on startup implemented here: https://github.com/FelixKratz/SketchyBar/commit/32f05a93a987eb771a3376d91a4d2719ec9f53ce

Pe8er commented 1 year ago

Hi Felix! Sorry for the late reply. Thank you for implementing my requests. This issue seems to persist:

In the popup, image's bottom is cut off (you can tell because rounded corners are missing), because I applied y_offset to add padding from the top.