This Python script creates a custom system tray indicator for Ubuntu that monitors the status of any systemd service. It displays different icons in the system tray based on whether the service is active or inactive. The indicator also provides a menu to start or stop the service directly from the system tray.
- Dynamic Icon Updates: Automatically updates the system tray icon based on the service status.
- Start/Stop Menu: Allows you to start or stop the service with a single click.
- Flexible Configuration: Configure the service name, icons, and messages using INI file.
- SVG Icon Support: Uses scalable vector graphics (SVG) for crisp and high-quality icons.
- Autostart Option: Can be configured to start automatically when you log in to your system.
- Ubuntu (or any GTK-based Linux distribution)
gir1.2-appindicator3-0.1python3-gipython3-gi-cairopython3-dbus
- Clone the repository.
- Install the required dependencies.
- Place your SVG icons in the same directory as the script.
- Edit the INI file to specify the service name, icons, and messages.
- Run the script:
./service-indicator.py
- Optionally, configure the script to start automatically at login.
INI file allows you to customize the script without modifying the code.
INI file's name must be equal to the name of the script. If the script is service-indicator.py, the INI file must be service-indicator.ini.
Here’s an example configuration:
[Service]
indicator_id = unique-id-of-my-custom-indicator
name = [email protected]
update_delay = 5
[Icons]
active = service-active-icon.svg
active_description = Service Active
inactive = service-inactive-icon.svg
inactive_description = Service Inactive
[Messages]
start = Start Service
stop = Stop Service
quit = Quit
quit_primary = Are you sure you want to quit?
quit_secondary = Exiting the program will not stop the service.service-active-icon.svg: Icon displayed when the service is active.service-inactive-icon.svg: Icon displayed when the service is inactive.
Monitor and control OpenVPN, Apache, MySQL, or any other systemd service.
This project is licensed under the MIT License. See the LICENSE file for details.