FelixKratz / SketchyBar

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

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

Closed realhackcraft closed 5 months ago

realhackcraft commented 5 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 5 months ago

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