You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

6.6 KiB

ComfyUI Launcher

A modern GTK4 launcher for ComfyUI with full conda environment support.

GTK4 Python License

Features

  • 🚀 Conda Environment Management: Easy selection of available conda environments
  • 🔧 Automatic Installation: Install ComfyUI and comfy-cli with one click
  • 📊 Real-time Monitoring: Continuously monitors if ComfyUI is running
  • 🎮 Intuitive Controls: Start and stop ComfyUI easily
  • 📝 Real-time Logs: View ComfyUI output directly in the launcher
  • 🎨 Modern Interface: Built with GTK4 and libadwaita

Prerequisites

  • Python 3.9 or higher
  • conda or miniconda installed
  • GTK4 and libadwaita
  • Development libraries (cairo-devel, gobject-introspection-devel, etc.)

System Dependencies Installation

Fedora/RHEL/CentOS/Rocky Linux

# Install system dependencies
sudo dnf install cairo-devel gobject-introspection-devel gtk4-devel pkg-config python3-devel

# Install conda if not already installed
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh

Debian/Ubuntu

# Update package list
sudo apt update

# Install system dependencies
sudo apt install libcairo2-dev libgirepository1.0-dev libgtk-4-dev pkg-config python3-dev python3-venv

# Install conda if not already installed
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh

Installation

  1. Clone the repository:
git clone <repository-url>
cd gtk-app
  1. Create and activate virtual environment:
python3 -m venv .venv
source .venv/bin/activate
  1. Install Python dependencies:
pip install -r requirements.txt

Usage

Quick Start

  1. Launch the application:
python main.py

or use the provided script:

./run.sh
  1. Select a conda environment from the dropdown list

  2. Install ComfyUI (if not already installed) by clicking "Install ComfyUI"

  3. Start ComfyUI by clicking "Start ComfyUI"

  4. The launcher will automatically monitor ComfyUI status

Detailed Workflow

  1. Environment Selection

    • The launcher automatically detects all available conda environments
    • Select your preferred environment from the dropdown
    • Click "Refresh Environment List" to reload environments
  2. ComfyUI Installation

    • If ComfyUI is not installed in the selected environment, click "Install ComfyUI"
    • This will install both comfy-cli and ComfyUI automatically
    • Installation progress is shown in the log window
  3. Running ComfyUI

    • Click "Start ComfyUI" to launch ComfyUI in the selected environment
    • Real-time output appears in the log window
    • The status indicator shows when ComfyUI is running
  4. Monitoring

    • The launcher checks every 3 seconds if ComfyUI is running
    • Status is indicated by both text and visual indicators
    • Automatic detection works even if ComfyUI was started outside the launcher

Features Detail

Environment Management

  • Automatic detection of all conda environments
  • Support for conda base environment
  • Refresh button to reload environment list
  • Clear indication of selected environment

Status Monitoring

  • Checks every 3 seconds if ComfyUI is running
  • Visual status indicator (icon and color)
  • Detection via port 8188 and active processes
  • Works even with externally started ComfyUI instances

Controls

  • Start ComfyUI: Launch ComfyUI in selected environment
  • Stop ComfyUI: Gracefully terminate ComfyUI process
  • Install ComfyUI: Install comfy-cli and ComfyUI in environment
  • Refresh Environments: Reload conda environment list

Logging

  • Real-time output from ComfyUI
  • Timestamp for each message
  • Monospace font for better readability
  • Automatic scrolling to latest messages

File Structure

gtk-app/
├── main.py                    # Main application
├── requirements.txt           # Python dependencies
├── style.css                  # Custom styles (optional)
├── comfyui-launcher.desktop   # Desktop integration file
├── run.sh                     # Launch script
├── README.md                  # This file
├── .gitignore                 # Git ignore rules
└── .venv/                     # Virtual environment (created after setup)

Troubleshooting

Conda not found

Make sure conda is in your PATH:

export PATH="$HOME/miniconda3/bin:$PATH"
# Add to ~/.bashrc or ~/.zshrc for persistence
echo 'export PATH="$HOME/miniconda3/bin:$PATH"' >> ~/.bashrc

Permission errors

Make the script executable:

chmod +x main.py
chmod +x run.sh

ComfyUI won't start

  • Verify the conda environment has Python 3.9+
  • Check that comfy-cli is properly installed
  • Review logs for specific error messages
  • Ensure sufficient disk space and memory

GTK/PyGObject errors

Make sure all system dependencies are installed:

# Fedora/RHEL
sudo dnf install gtk4-devel python3-gobject

# Debian/Ubuntu  
sudo apt install libgtk-4-dev python3-gi

Missing fonts

The launcher uses monospace fonts for logs. If fonts appear wrong:

# Install additional fonts (optional)
sudo dnf install jetbrains-mono-fonts  # Fedora
sudo apt install fonts-jetbrains-mono  # Ubuntu

Development

Setting up development environment

  1. Fork the repository
  2. Clone your fork
  3. Install development dependencies:
pip install -r requirements.txt
  1. Make your changes
  2. Test thoroughly
  3. Submit a pull request

Code Style

  • Follow PEP 8 for Python code
  • Use meaningful variable names
  • Add comments for complex logic
  • Keep functions focused and small

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Update documentation
  6. Submit a pull request

License

MIT License - see the LICENSE file for details.

Acknowledgments

  • ComfyUI - The amazing stable diffusion GUI
  • comfy-cli - Command line tool for ComfyUI
  • GTK - The GUI toolkit
  • PyGObject - Python bindings for GTK

Support

If you encounter issues:

  1. Check the troubleshooting section above
  2. Search existing GitHub issues
  3. Create a new issue with:
    • Your operating system and version
    • Python version
    • Complete error messages
    • Steps to reproduce the problem