Using Gogh in Non-Interactive Mode
For power users, system administrators, and those looking to automate their setup, Gogh provides a powerful non-interactive mode. This allows you to apply themes from shell scripts, dotfile managers, or configuration management tools without any user prompts.
Setup
To use this mode, you must first have the Gogh scripts available locally. The recommended way is to clone the repository:
git clone https://github.com/Gogh-Co/Gogh.git
cd Gogh
Alternatively, you can download the apply-colors.sh
script and the specific theme installer scripts from the installs/
directory.
Key Environment Variables
The behavior of the installer scripts is controlled through several environment variables:
-
TERMINAL
: (Required) Specifies the target terminal emulator. The script will not run without this variable. See the Supported Terminals list for valid values.- Example:
export TERMINAL=kitty
- Example:
-
GOGH_NONINTERACTIVE
: When set to any value (e.g.,true
), this variable enables non-interactive mode. It silences all standard output and answers all prompts with the default value.- Example:
export GOGH_NONINTERACTIVE=true
- Example:
-
GOGH_USE_NEW_THEME
: If set, Gogh will attempt to make the newly applied theme the current or default profile for the terminal. The exact effect may vary between terminals. Currently supported byxfce4-terminal
andtilix
.- Example:
export GOGH_USE_NEW_THEME=true
- Example:
-
GOGH_APPLY_SCRIPT
: Specifies the path to theapply-colors.sh
script if it's not in the same directory as the theme installer.- Example:
export GOGH_APPLY_SCRIPT=/path/to/apply-colors.sh
- Example:
-
GOGH_ALACRITTY_SCRIPT
/GOGH_TERMINATOR_SCRIPT
: Specifies the path to the Python helper scripts for Alacritty and Terminator, respectively. This is only needed if the scripts are not in the same directory asapply-colors.sh
.- Example:
export GOGH_ALACRITTY_SCRIPT=/path/to/apply-alacritty.py
- Example:
Example Script
Here is an example of a shell script that silently installs the Dracula theme for GNOME Terminal and sets it as the default.
#!/usr/bin/env bash
# Define the Gogh directory
GOGH_DIR="$HOME/src/gogh"
# Set environment variables for non-interactive use
export TERMINAL=gnome-terminal
export GOGH_NONINTERACTIVE=true
# Optional: Set the new theme as the default for supported terminals
# export GOGH_USE_NEW_THEME=true
# Check if the theme installer exists
THEME_INSTALLER="$GOGH_DIR/installs/dracula.sh"
if [ -f "$THEME_INSTALLER" ]; then
echo "Applying Dracula theme..."
bash "$THEME_INSTALLER"
echo "Theme applied."
else
echo "Error: Theme installer not found at $THEME_INSTALLER" >&2
exit 1
fi