Skip to content

lavrottweiler/Service-tray

Repository files navigation

Service Tray

Version: 1.2.0

Service Tray is a lightweight tray application for Linux that allows you to monitor and control systemd services directly from your desktop. It shows a status icon (green/red) depending on whether services are active and provides a menu to toggle, refresh, or quit services.


Features

  • Tray Icon:
    • Green if at least one service is running.
    • Red if all services are stopped.
  • Dynamic Menu:
    • Lists services from a configuration file with port information.
    • Shows service status, name, and port number.
    • Hover over any service to reveal submenu with additional options.
  • Service Management:
    • Left-click on service: Toggle start/stop
    • Hover on service: Shows submenu with Start/Stop and Enable/Disable options
  • Automatic Updates:
    • Icon and service status update every 5 seconds.
  • Easy Autostart:
    • Installs itself to start at user login.
  • System-wide Access:
    • Available as service-tray command from anywhere in terminal
  • Sudo Security:
    • User types password only once per session when toggling services.

Installation

1. Clone the Repository

git clone https://github.com/lavrottweiler/Service-tray.git
cd Service-tray

2. Run the Installer

./install.sh

This will:

  • Install all necessary dependencies for Debian/Ubuntu, Arch/Manjaro, or Fedora.
  • Make service-tray.py executable.
  • Copy default icons to the icons directory.
  • Create a system-wide command service-tray.
  • Create an autostart entry so Service Tray launches at login.
  • Launch Service Tray immediately.

Configuration

The list of services is defined in services.conf in the project directory.

Format:

Display Name = systemd-service-name

Example:

ComfyUI = comfyui.service
Whisper = whisper.service
Forge = forgeui.service
Ollama = ollama.service

Service ports are defined in the application and displayed alongside each service.

  • Lines starting with # are ignored.
  • To add or remove services, edit this file and then click Refresh Services in the menu.

Creating a forgeui.service File

If you need to create a systemd service file for ForgeUI, follow these detailed steps:

  1. Create the service file:

    sudo nano /etc/systemd/system/forgeui.service
  2. Add the following content (adapt paths and user as needed):

    [Unit]
    Description=ForgeUI Service
    After=network.target
    
    [Service]
    Type=simple
    User=your-username
    WorkingDirectory=/path/to/forgeui
    ExecStart=/path/to/forgeui/venv/bin/python /path/to/forgeui/launch.py --listen --port 1234
    Restart=always
    RestartSec=10
    
    [Install]
    WantedBy=multi-user.target
    

    Important fields to customize:

    • User: Replace with your actual username
    • WorkingDirectory: Path to your ForgeUI installation directory
    • ExecStart: Full path to the Python executable and the command to start ForgeUI
    • Description: A description of your service
  3. Save the file (Ctrl+X, then Y, then Enter in nano).

  4. Reload systemd to recognize the new service:

    sudo systemctl daemon-reload
  5. Enable the service to start at boot:

    sudo systemctl enable forgeui.service
  6. Start the service:

    sudo systemctl start forgeui.service
  7. Verify the service is running:

    sudo systemctl status forgeui.service
  8. Check service logs (if needed):

    sudo journalctl -u forgeui.service -f
  9. Test that your service works with Service Tray:

    • Add Forge = forgeui.service to your services.conf file
    • Click Refresh Services in the Service Tray menu
    • You should now be able to manage the ForgeUI service from the tray

Creating a comfyui.service File (for comfy-cli installations)

If you installed ComfyUI using comfy-cli, you need to create a systemd service file that works with the global comfy command. Follow these detailed steps:

  1. Find the comfy command location:

    First, determine where the comfy command is installed:

    which comfy

    This will typically return something like /home/your-username/.local/bin/comfy or /usr/local/bin/comfy

  2. Create the service file:

    sudo nano /etc/systemd/system/comfyui.service
  3. Add the following content (adapt paths and user as needed):

    [Unit]
    Description=ComfyUI Application
    After=network.target
    
    [Service]
    Type=simple
    User=your-username
    Group=your-username
    WorkingDirectory=/path/to/your/ComfyUI/directory
    Environment="PATH=/usr/local/bin:/usr/bin:/bin:/home/your-username/.local/bin"
    ExecStart=/home/your-username/.local/bin/comfy launch -- --listen --port 8188
    Restart=always
    RestartSec=10
    StandardOutput=journal
    StandardError=journal
    
    [Install]
    WantedBy=default.target
    

    Important fields to customize:

    • User and Group: Replace with your actual username
    • WorkingDirectory: Path to your ComfyUI installation directory (where comfy-cli installed it)
    • Environment: Set the PATH to include where the comfy command is located (use the path from step 1)
    • ExecStart: Full path to the comfy command with the launch subcommand
    • Description: A description of your service
    • Add any specific arguments after the -- in the ExecStart line (like --port, --listen, --cuda-device, etc.)
  4. Alternative approach using a shell script:

    If the direct command doesn't work properly, create a shell script first:

    nano /home/your-username/start_comfyui.sh

    Add this content:

    #!/bin/bash
    export PATH="$PATH:/home/your-username/.local/bin:/usr/local/bin:/usr/bin:/bin"
    cd /path/to/your/ComfyUI/directory
    /home/your-username/.local/bin/comfy launch -- --listen --port 8188

    Make it executable:

    chmod +x /home/your-username/start_comfyui.sh

    Then use this service file instead:

    [Unit]
    Description=ComfyUI Application
    After=network.target
    
    [Service]
    Type=simple
    User=your-username
    Group=your-username
    WorkingDirectory=/path/to/your/ComfyUI/directory
    ExecStart=/home/your-username/start_comfyui.sh
    Restart=always
    RestartSec=10
    StandardOutput=journal
    StandardError=journal
    
    [Install]
    WantedBy=default.target
    
  5. Save the file (Ctrl+X, then Y, then Enter in nano).

  6. Reload systemd to recognize the new service:

    sudo systemctl daemon-reload
  7. Enable the service to start at boot:

    sudo systemctl enable comfyui.service
  8. Start the service:

    sudo systemctl start comfyui.service
  9. Verify the service is running:

    sudo systemctl status comfyui.service
  10. Check service logs if there are issues:

    sudo journalctl -u comfyui.service -f
  11. Troubleshooting common issues:

    If you get an exit code 203 (EXEC), this usually means systemd can't find the executable. Make sure:

    • The path to the comfy command is correct
    • The PATH environment variable in the service includes the directory where comfy is installed
    • The user specified has permission to access the executable
  12. Test that your service works with Service Tray:

    • Add ComfyUI = comfyui.service to your services.conf file
    • Click Refresh Services in the Service Tray menu
    • You should now be able to manage the ComfyUI service from the tray

Usage

  • Toggle Service: Left-click a service in the menu to start/stop it.
  • Service Submenu: Hover over any service to reveal additional options:
    • Start/Stop - Toggle service state
    • Enable/Disable - Toggle automatic startup on boot
  • Refresh Services: Click Refresh Services to reload services.conf.
  • Quit: Click Quit to exit the application.
  • System Command: Run service-tray from anywhere in terminal to launch the application.

Icons

  • Default icons are located in default_icons.
  • Custom icons can be placed in icons directory:
    • green.png – icon when at least one service is running
    • red.png – icon when all services are stopped

Requirements

  • Python 3.x
  • Linux with systemd
  • GTK3 and AppIndicator support

Dependencies are automatically installed via install.sh:

  • Debian/Ubuntu: python3-gi, gir1.2-appindicator3-0.1, libcairo2-dev, libgirepository-1.0-dev, gobject-introspection, pkg-config, python3-dev, python3-pip
  • Arch/Manjaro: python-gobject, libappindicator-gtk3, python-pip
  • Fedora: python3-gobject, libappindicator-gtk3, python3-pip

Security

  • Service Tray uses sudo to start/stop/restart/enable/disable services.
  • The first time a service is toggled, you will be prompted for your password.
  • After that, sudo rules are cached until the session ends.

Development

  1. Install development dependencies:
sudo apt install python3-gi gir1.2-appindicator3-0.1 python3-dev
  1. Edit service-tray.py or services.conf.
  2. Test changes by running:
./service-tray.py

Version

Current Version: 1.2.0

See CHANGELOG.md for detailed version history and changes.


License

This project is licensed under the MIT License.


Contributing

  1. Fork the repository.
  2. Make your changes.
  3. Submit a pull request.
  4. Ensure install.sh and README instructions are updated if needed.

Author

LavRottweiler – GitHub Profile


Last Updated: October 12, 2025

About

**Service Tray** is a lightweight tray application for Linux that allows you to monitor and control systemd services directly from your desktop. It shows a status icon (green/red) depending on whether services are active and provides a right-click menu to toggle, refresh, or quit services.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors