Skip to content

Instantly share code, notes, and snippets.

@ejangi
Created February 2, 2026 21:26
Show Gist options
  • Select an option

  • Save ejangi/f20b4414599d6576b7e7e328a02dce93 to your computer and use it in GitHub Desktop.

Select an option

Save ejangi/f20b4414599d6576b7e7e328a02dce93 to your computer and use it in GitHub Desktop.
A launcher script to run OSCMIX with logging and alsarawio piped in correctly
#!/bin/bash
# Define the base directory where your oscmix installation resides.
# This assumes it's in your home directory under 'Sites/oscmix'.
OSCMIX_DIR="${HOME}/Sites/oscmix"
# Define a log file for the alsarawio background process.
# This will capture any output or errors from alsarawio.
LOG_FILE="${HOME}/.local/share/oscmix/alsarawio.log"
# Create the directory for the log file if it doesn't already exist.
# This ensures that alsarawio can write its logs.
mkdir -p "$(dirname "${LOG_FILE}")"
# Check if the 'alsarawio' process is already running.
# We use 'pgrep -f' to match the full command line, making the check more specific.
# This prevents starting multiple instances of alsarawio.
if ! pgrep -f "${OSCMIX_DIR}/alsarawio 3,0,1 ${OSCMIX_DIR}/oscmix"; then
echo "$(date): alsarawio not running, starting it now..." | tee -a "${LOG_FILE}"
# Start 'alsarawio' in the background using 'nohup'.
# 'nohup' ensures the process continues to run even if the launching terminal closes.
# The '2>&1' redirects standard error to standard output, and '>' directs
# all output to the specified LOG_FILE.
# The '&' at the end sends the command to the background.
nohup "${OSCMIX_DIR}/alsarawio" 3,0,1 "${OSCMIX_DIR}/oscmix" > "${LOG_FILE}" 2>&1 &
echo "$(date): alsarawio started." | tee -a "${LOG_FILE}"
# Give 'alsarawio' a moment to initialize before the GUI tries to connect.
sleep 2
else
echo "$(date): alsarawio is already running." | tee -a "${LOG_FILE}"
fi
# Launch the 'oscmix-gtk' graphical user interface.
# The 'GSETTINGS_SCHEMA_DIR' environment variable is required by oscmix-gtk
# to find its schema files.
echo "$(date): Launching oscmix-gtk UI..." | tee -a "${LOG_FILE}"
GSETTINGS_SCHEMA_DIR="${OSCMIX_DIR}/gtk" "${OSCMIX_DIR}/gtk/oscmix-gtk"
echo "$(date): oscmix-gtk UI launched." | tee -a "${LOG_FILE}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment