Skip to content

Extra Specification

Extras are scripts that handle theme-specific settings that can’t be expressed through the pattern system alone — like setting a VS Code theme, changing the wallpaper, or configuring an IDE color scheme. They live in {desktop}/gtheme/extras/.

How it works

Unlike patterns (which are filled from a universal color palette), extras receive theme-specific arguments defined in each theme’s [extras] section.

For example, the Dracula theme defines:

[extras]
vscode = ['Dracula']
wallpaper = ['~/.config/gtheme/wallpapers/Dracula/arch-linux-light.png']

When this theme is applied, Gtheme runs:

Terminal window
extras/vscode.sh "Dracula"
extras/wallpaper.sh "~/.config/gtheme/wallpapers/Dracula/arch-linux-light.png"

Example: VS Code

#!/bin/bash
VSCODETHEME="$1"
VSCODE_SETTINGS_FILE="$HOME/.config/Code/User/settings.json"
[[ ! -e $VSCODE_SETTINGS_FILE || -z "$VSCODETHEME" ]] && exit 1
sed -i "s|\"workbench.colorTheme\": \".*\"|\"workbench.colorTheme\": \"$VSCODETHEME\"|" \
$VSCODE_SETTINGS_FILE

This script takes the VS Code theme name as an argument and updates settings.json to use it.

Example: Wallpaper

#!/bin/bash
WALLPAPER_URL="$1"
[ -z "$WALLPAPER_URL" ] && exit 1
cp "$WALLPAPER_URL" ~/.wallpaper
swww img ~/.wallpaper --transition-type any --transition-fps 60

Multiple arguments

The [extras] array can contain multiple values. They’re passed as positional arguments to the script:

[extras]
my-script = ['arg1', 'arg2', 'arg3']
#!/bin/bash
echo "$1" # arg1
echo "$2" # arg2
echo "$3" # arg3

Managing extras

Extras can be enabled or disabled per-desktop:

Terminal window
gtheme extra list # List all extras
gtheme extra enable <extra> # Enable an extra
gtheme extra disable <extra> # Disable an extra