FelixKratz / SketchyBar

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

background.image.string with app.bundle_name doesn't display the app's icon #569

Closed realhackcraft closed 3 months ago

realhackcraft commented 3 months ago

I stole some code from https://github.com/crissNb/Dynamic-Island-Sketchybar to display the front app's icon.

front_app_icon.sh

#! /bin/bash
if [ "$SENDER" = "front_app_switched" ]; then
  BUNDLENAME=$(osascript -e "id of app \"$INFO\"")
  sketchybar --set $NAME background.image.string="app.$BUNDLENAME" 
fi

code to add the item

#!/bin/bash

sketchybar --add item front_app_icon left \
           --set front_app_icon  background.image.scale=0.4 \
                                 script="$PLUGIN_DIR/front_app_icon.sh"            \
           --subscribe front_app_icon front_app_switched

I tried to see if the $BUNDLENAME var is wrong by displaying it as the label, but that seems to be correct.

realhackcraft commented 3 months ago

I fixed it by adding background.drawing=on when initializing the item.