Skip to main content

How to Auto-Launch the Indigo Agent

If you need the Indigo agent to be launched automatically every time you restart your device, follow the operating system-specific instructions below.

Important: Display Requirement

The Indigo agent requires a display to operate. If your system does not have a physical display, you will need to use a virtual display. For example, you can use xvfb-run:

xvfb-run indigo

Windows

The following Python script can be used to auto-launch the Indigo agent on Windows. You'll need to ensure this script is executed on startup, for example, by placing it in the Windows Startup folder or creating a Scheduled Task.

Path Configuration

The script attempts to dynamically determine your username for the agent's path. However, you must verify the exe_path variable in the script matches the actual installation location of agent.exe for Indigo on your system. The default path structure has been assumed.

import os
import subprocess

def connect_agent():
username = os.getlogin()
# IMPORTANT: Verify this path is correct for your Indigo installation.
# The username is dynamically filled, but the base path 'AppData\\Local\\indigo\\agent.exe' might differ.
exe_path = f'C:\\Users\\{username}\\AppData\\Local\\indigo\\agent.exe'

print(f"Attempting to launch Indigo agent from: {exe_path}")

try:
# subprocess.run will wait for the command to complete.
# If agent.exe is a launcher that exits quickly with code 0, this is fine.
# If agent.exe is the main long-running process, .run() will block until the agent is closed.
# For a background launch, subprocess.Popen might be more suitable.
# The original script implied checking a return code, so .run() is used here.
agent_process = subprocess.run([exe_path], capture_output=True, text=True, check=False)

if agent_process.returncode == 0:
print("Indigo agent launched successfully.")
# You can optionally print stdout if the agent provides useful info upon launch:
# if agent_process.stdout:
# print(f"Agent output: {agent_process.stdout.strip()}")
else:
print(f"Failed to launch Indigo agent. Return code: {agent_process.returncode}")
if agent_process.stderr:
print(f"Error details: {agent_process.stderr.strip()}")
if agent_process.stdout: # Also log stdout in case of error, might contain info
print(f"Output (stdout): {agent_process.stdout.strip()}")

except FileNotFoundError:
print(f"Error: The Indigo agent executable was not found at '{exe_path}'. Please verify the path.")
except Exception as e:
print(f"An unexpected error occurred: {e}")

if __name__ == "__main__":
connect_agent()

macOS

Use the following Python script to auto-launch the Indigo agent on macOS. To run this script automatically on startup, you can create a LaunchAgent for it.

Application Path

The script assumes Indigo is installed in the standard /Applications/ directory as Indigo X.app. If your installation path is different, please update the app_path variable in the script.

import subprocess

def connect_agent():
# Ensure this is the correct name and path for your Indigo application
app_path = '/Applications/Indigo X.app'

print(f"Attempting to open Indigo agent: {app_path}")

try:
# The 'open' command is used to launch applications on macOS.
# It typically returns quickly.
process = subprocess.run(['open', app_path], capture_output=True, text=True, check=False)

if process.returncode == 0:
print("Command to launch Indigo agent was successful.")
# Note: 'open' returning 0 means the command to open was successful.
# It doesn't guarantee the app itself started without internal errors.
# For more detailed checks, AppleScript or other app-specific queries might be needed.
else:
print(f"Failed to issue command to launch Indigo agent. Return code: {process.returncode}")
if process.stderr:
print(f"Error details: {process.stderr.strip()}")
if process.stdout:
print(f"Output (stdout): {process.stdout.strip()}")

except FileNotFoundError:
# This error would typically mean the 'open' command itself isn't found (highly unlikely on macOS)
# or there's an issue with how the command is constructed (not the case here).
# More likely, if the app_path is incorrect, 'open' might still run but report an error via its stderr or return code.
print(f"Error: Could not execute the 'open' command. Ensure '{app_path}' is the correct path to the application.")
except Exception as e:
print(f"An unexpected error occurred: {e}")

if __name__ == "__main__":
connect_agent()

Linux

To auto-launch the Indigo agent on Linux, you can call its binary directly. You will need to add the chosen command to your system's startup scripts. The method for this varies depending on your Linux distribution and desktop environment (e.g., adding to .bashrc or .profile for shell login, .xinitrc for X session start, creating a systemd user service, using a cron @reboot job, or utilizing desktop environment-specific autostart utilities).

You can start the agent by calling its full path (assuming a default installation location):

/opt/indigo/agent.bin

Alternatively, if the directory containing agent.bin is in your system's PATH environment variable, or if indigo is a symlink placed in a directory within your PATH, you might be able to start it simply by using its command name:

indigo

Consult your distribution's documentation for the best way to add a command to startup.