Skip to main content

Theme Switching

Config-Sway includes a powerful theme system that applies consistent colors, styles, and wallpapers across Sway, Waybar, Kitty, and Rofi. The theme switcher provides instant visual transformation of your entire desktop environment.

Quick Start

Press Super+A to open the theme switcher menu and select a theme.
Themes are displayed with preview icons in Rofi, making it easy to identify themes visually before applying them.

Available Themes

Config-Sway includes six pre-configured themes:

Theme Structure

Each theme is stored in ~/.config/themes/<theme-name>/ and contains the following components:
The rofi-style/ directory is optional. If a theme doesn’t include it, the theme switcher will automatically generate a Rofi palette from the Sway theme colors.

How Theme Switching Works

When you select a theme, the theme switcher (~/.config/rofi/scripts/theme-switcher.sh:62-183) performs these steps:

1. Save Theme Selection

The chosen theme name is saved to ~/.config/themes/.current so other scripts can reference the active theme.

2. Backup Existing Configuration

Before making changes, the script creates timestamped backups:

3. Apply Theme Components

The script copies theme files to their respective locations:
  • Kitty: Entire directory copied to ~/.config/kitty/
  • Waybar: Colors and styles copied, config adapted for Sway
  • Sway: Theme configuration copied to ~/.config/sway/theme.conf
  • Rofi: Palette copied or auto-generated to ~/.config/rofi/styles/_core/palette.rasi

4. Waybar Configuration Adaptation

The theme switcher automatically converts Hyprland-specific Waybar modules to Sway equivalents:
The adapted configuration is saved as ~/.config/waybar/config-sway.jsonc.

5. Apply Wallpaper

The theme’s wallpaper is set using swaybg:

6. Reload Services

The script automatically reloads affected services:
  • Waybar is restarted with the new configuration
  • Sway configuration is reloaded (swaymsg reload)
  • Notifications show the theme change status

Creating Custom Themes

You can create your own themes by following this structure:

1. Create Theme Directory

2. Configure Sway Theme

Create ~/.config/themes/MyTheme/sway/theme.conf:
The color variables $bg, $fg, $active, and $inactive are used by the theme switcher to auto-generate Rofi colors if you don’t provide a custom Rofi palette.

3. Add Waybar Styles

Create ~/.config/themes/MyTheme/waybar/colors.css:
Create ~/.config/themes/MyTheme/waybar/style.css with your custom Waybar styling.

4. Configure Kitty Colors

Create ~/.config/themes/MyTheme/kitty/kitty.conf with Kitty color scheme and settings.

5. Add Wallpaper

Place your wallpaper as:
  • ~/.config/themes/MyTheme/wallpaper.jpg
  • ~/.config/themes/MyTheme/wallpaper.png
  • ~/.config/themes/MyTheme/wallpaper.webp
The wallpaper file must be named exactly wallpaper.(jpg|png|webp) for the theme switcher to detect it. The script checks for these extensions in order: jpg, png, webp.

6. (Optional) Custom Rofi Palette

For full control over Rofi colors, create ~/.config/themes/MyTheme/rofi-style/_core/palette.rasi:

Command-Line Usage

You can apply themes from the command line:

Automatic Rofi Palette Generation

If your theme doesn’t include a custom Rofi palette, the theme switcher automatically generates one from your Sway theme colors:
Auto-generated Rofi palettes ensure visual consistency even if you don’t manually create Rofi styles for your theme.

Troubleshooting

Theme Not Appearing in Menu

Ensure your theme directory exists in ~/.config/themes/ and contains at minimum:
  • A sway/theme.conf file
  • A wallpaper file named wallpaper.(jpg|png|webp)

Waybar Not Updating

Manually restart Waybar:

Colors Not Applying

Reload Sway configuration:

Wallpaper Not Changing

Check the wallpaper file path:
Manually set wallpaper:

Theme Backups

The theme switcher creates automatic backups with timestamps. To restore a previous configuration:
Backups are created every time you switch themes, which can accumulate over time. Consider periodically cleaning old backups to save disk space.