Plugins Overview

In SketchyBar, a "plugin" is simply an executable script that the bar calls to get information. These scripts are the primary mechanism for populating your bar with dynamic data.

The repository includes a set of default plugins to get you started. They demonstrate best practices for interacting with SketchyBar from a script.

Location

The default plugins are located in ~/.config/sketchybar/plugins/. It's a good practice to keep all your custom scripts in this directory as well.

Core Concepts

  1. Execution: A plugin is run by SketchyBar when its associated item is triggered by a timer (update_freq) or an event (--subscribe).
  2. Updating Items: The main purpose of a plugin is to call sketchybar --set to update the properties (like label or icon) of its associated item.
  3. Environment Variables: Plugins rely on environment variables provided by SketchyBar to know which item to update ($NAME) and to receive data from events ($SENDER, $INFO).

Default Plugins

Here are the default plugins included with SketchyBar. Click on each one to see its source code and a detailed explanation.

  • Battery: Displays the current battery percentage and charging status.
  • Clock: Shows the current date and time.
  • Front App: Displays the name of the currently focused application.
  • Space: A special script for space components to highlight the active space.
  • Volume: Shows the current system volume level.