A plugin for SwiftBar designed to give an at-a-glance monitor for the status of a Pi-hole server. Built for the most recent v6 edition of Pi-hole.
NOTE: the API has changed dramatically between v5 and v6 so this plugin will not work if your Pi-hole server running v5 or below.
To install the extension, download the latest release and place everything from inside the plugin
folder directly in your SwiftBar plugins folder.
Before enabling the plugin, be sure to set the HOST
and PASSWORD
variables in the root script (pi_hole_status.5s.sh
) to your Pi-hole host address and api password – this is usually the same password you would use to log in to the admin console.
As of writing, SwiftBar does not provide a UI for configuring these values so you'll need to manually edit the script to set them.
The plugin provides an overview of the current blocking status of your configured Pi-hole server:
Icon | Status |
---|---|
![]() |
Blocking is enabled |
![]() |
Blocking is disabled temporarily |
![]() |
Blocking is disabled indefinitely |
The plugin also provides options to enable/disable blocking via the menu bar. When blocking is enabled, you can choose to disable blocking from the menu:
and when blocking is disabled you can choose to enable blocking from the menu:
The menu will also show the current status of blocking and when/if blocking will be automatically re-enabled by the server:
The default update frequency of the plugin is 5 seconds, but this value can be configured either by editing the name of the script directly (see SwiftBar plugin naming conventions) or by adding the swiftbar.schedule
tag to the beginning of the root script (see SwiftBar refresh schedule docs).
You can configure the available durations for disabling blocking in the root script. Default values are:
- 30 seconds
- 5 minutes
- Indefinite (always shown, not a configurable value)
To change the durations, edit the DISABLE_OPTIONS
variable in the SwiftBar environment. The plugin accepts a pipe (|
) separated list of disable-durations in seconds, for example:
DISABLE_OPTIONS=15|30|300
gives menu options:- 15 seconds
- 30 seconds
- 5 minutes
DISABLE_OPTIONS=1800|750|60
gives menu options:- 30 minutes
- 12.5 minutes
- 1 minute
The option in SwiftBar to run a command without showing a terminal window seems to not work on the current version of SwiftBar (v2.0.0). This means the enable/disable scripts will run in a new terminal window every time they are invoked despite being configured to run in the background.
If you find this is not the case on a later version of SwiftBar please feel free to open an issue to update this section.
Likewise, if you find SwiftBar has added a UI for configuring evironment variables, please open an issue for that as well.