Wiki / concepts / wiki

SketchyBar event scripts

How a sketchybar item stays current: its script runs on a timer, on a subscribed event, or both, and updates only that item.

  • update_freq=N runs the script every N seconds (calendar 30, CPU 2, battery 120 in josean-martinez's setup).
  • Subscribing with --subscribe <item> <event> makes it run on events such as volume_change, power_source_change, system_woke, front_app_switched, space_windows_change and media_change.
  • Inside the script, $NAME is the calling item, $SENDER the event, and $INFO the event's data, sometimes JSON that jq parses. Space items also get $SELECTED.
  • Josean keeps item definitions in items/ (sourced from sketchybarrc) and the scripts in plugins/. $PLUGIN_DIR isn't visible inside plugin scripts, so they use $CONFIG_DIR/plugins.

Source: report

Linked from

Josean MartinezSketchyBar