Skip to content

Repository files navigation

xfce-night-switch

Latest release Downloads MIT License XFCE 4.16+ Bash 5+ i18n


xfce-night-switch is a day/night GTK theme switcher for XFCE with a panel launcher, graphical settings dialog, Terminator terminal profile sync, location-aware scheduling, and full i18n.

The problem: XFCE has no built-in dark mode schedule. Terminator has no way to auto-switch terminal profiles when the system switches between dark and light modes. Existing solutions are either genmon plugins requiring manual polling, Python packages with heavy dependencies, or simple scripts with no GUI.

The solution: A self-contained bash toolset — a panel launcher with an arrow menu, a graphical settings dialog (yad) for theme and icon selection, and sunrise/sunset scheduling with zero runtime dependencies beyond what ships with a standard XFCE desktop.


Features

Feature xfce-night-switch xfce4-night-mode AutomaThemely xfce4-theme-switcher
Panel launcher with icon GenMon text
Live icon changes day↔night
Graphical icon picker (96+ icons)
GTK theme selector (scans)
Terminator profile sync
Monitor brightness dimming
Icons scaled to panel size
Time-based schedule
Sunrise/sunset by location
City search (OpenStreetMap)
GUI settings dialog
Panel selection (multi-panel)
Multi-language UI ✅ en/ru/custom
No Python/pip dependencies
.deb package
One-command install

Quick install

Option A — one-liner (Ubuntu / Debian / Mint)

bash <(curl -fsSL https://github.com/prostopasta/xfce-night-switch/releases/latest/download/install.sh)

Checks for missing prerequisites, downloads the latest .deb, installs with sudo dpkg -i.

Option B — git clone (any distro / development)

git clone https://github.com/prostopasta/xfce-night-switch.git
cd xfce-night-switch
bash install.sh

Update to latest version

xfce-night-switch-setup    # or: bash ~/.local/bin/auto-update.sh

Uninstall

sudo dpkg -r xfce-night-switch      # remove (keeps config)
sudo dpkg -P xfce-night-switch      # purge (removes config too)

Prerequisites

Installed automatically by the install script. For manual installs:

sudo apt install yad curl wget python3 python3-dbus cron
# Optional (for SVG/PNG icon rendering in settings):
sudo apt install imagemagick
# Optional (for monitor brightness dimming):
sudo apt install ddcutil i2c-tools

How it works

                      ┌─────────────────────────────────────────┐
                      │         XFCE Panel (dynamic ID)         │
                      │  ┌──────────┐  ┌──────────────────────┐ │
                      │  │  ☀️/🌙   │  │  ⚙️ Theme Settings   │ │
                      │  │ (toggle) │  │  (arrow menu item)   │ │
                      │  └────┬─────┘  └──────────┬───────────┘ │
                      └───────┼───────────────────┼─────────────┘
                              │                   │
              toggle-theme.sh │ theme-settings.sh │
                              │                   │
            ┌─────────────────▼───────────────────▼────────────────┐
            │                  GTK Theme switch                    │
            │   xfconf-query + gsettings + xfwm4 theme             │
            └──────────┬───────────────────────────────────────────┘
                       │
         ┌─────────────┼───────────────────┬─────────────────────┐
         │             │                   │                     │
         ▼             ▼                   ▼                     ▼
  Terminator     Panel icon update   Monitor Dimming        auto-theme.sh
  profile switch  (launcher-N/*.desktop) (eDP / ddcutil/xrandr) (cron, every min)
  (DBus)          day ☀️ / night 🌙                              time or location

Panel launcher

The launcher is installed at ~/.config/xfce4/panel/launcher-N/ where N is a free plugin ID ≥ 100, detected automatically and saved to ~/.config/xfce-night-switch/config. Two entries:

  • Left item — toggle between day/night theme instantly
  • Arrow — opens settings dialog

The panel icon updates on every toggle and every cron run (every minute). If you have multiple panels, the installer detects the one with the clock and places the launcher there. You can move it via Settings → Panel launcher.

Settings dialog

theme-settings.sh is a yad-based GUI with these sections:

┌────────────────────────────────────────────────┐
│  Theme Switcher Settings                       │
├──────────────────────┬─────────────────────────┤
│  🌙 Night icon       │  Tango • weather..      │
│  ☀️ Day icon         │  Humanity • clear       │
│  🎨 Themes           │  [opens theme dialog]   │
│  🖥️ Panel launcher   │  panel-0 (plugin-100)   │
│  ⏱️ Auto-switcher    │  ✓ By location          │
│  🔆 Monitor Dimming  │  ✓ Enabled (ddcutil)    │
│  🌐 App language     │  English                │
│  🔄 Restart panel    │                         │
└──────────────────────┴─────────────────────────┘

Theme dialog (🎨 Themes) scans /usr/share/themes/ and ~/.themes/ for installed GTK themes. Pick separate themes for day and night mode. Same for Terminator profiles — reads ~/.config/terminator/config and lists available profiles.


Terminator profile sync

XFCE has no built-in way to switch Terminator terminal profiles when the system dark/light mode changes. This is a common pain point — Terminator's profiles are static and there is no hook for system theme changes.

xfce-night-switch solves this by:

  1. Switching the active profile for all open Terminator windows via DBus on every toggle or schedule event
  2. Updating the profile = setting in layout blocks of ~/.config/terminator/config so new terminal windows open with the correct profile

Setup:

  1. Create two profiles in Terminator: Preferences → Profiles (e.g. light-theme and dark-theme)
  2. Open theme-settings → 🎨 Themes — pick the profiles in the day/night dropdowns
  3. Done — Terminator will switch automatically

If you don't use Terminator, set both profiles to default — no effect.


Requirements

Core Requirements

Package Used for Standard on XFCE
bash 4+ All scripts
yad Settings GUI dialogs Usually yes
xfconf-query Panel & XFCE configuration ✅ XFCE
gsettings GTK theme & color-scheme switching ✅ GLib
curl, wget Geolocation, releases & updates
python3 NOAA sunrise/sunset solar calculation
python3-dbus Terminator profile switching via DBus apt install python3-dbus

Optional Enhancements

Package Used for Installation
imagemagick / librsvg2-bin High-res SVG & PNG icon rendering sudo apt install imagemagick
x11-xserver-utils (xrandr) Multi-monitor software brightness dimming Pre-installed or sudo apt install x11-xserver-utils
ddcutil / i2c-tools Hardware DDC/CI monitor brightness control sudo apt install ddcutil i2c-tools

No pip install, no virtualenvs, no Node.js.


Configuration

Config lives at ~/.config/xfce-night-switch/config:

# GTK themes — use 'theme-settings' GUI to pick from installed themes
LIGHT_THEME="Adwaita"
DARK_THEME="Adwaita-dark"

# Terminator profiles (must match [[ProfileName]] in ~/.config/terminator/config)
TERM_PROFILE_LIGHT="default"
TERM_PROFILE_DARK="default"

# Icons
ICON_DAY="weather-clear"
ICON_NIGHT="$HOME/.local/share/icons/hicolor/scalable/apps/theme-moon.svg"

# Scheduling
AUTO_SWITCHER="enabled"          # enabled | disabled
AUTO_MODE="time"                 # time | location
DAY_START="07:00"
DAY_END="18:00"
LATITUDE=""                      # used in location mode
LONGITUDE=""
APP_LANG="en"                    # en | ru | custom code

# Monitor brightness dimming (optional)
MONITOR_DIMMING="disabled"       # enabled | disabled
DIMMING_EXT_METHOD="xrandr"      # xrandr | ddcutil
DIMMING_EDPI_DARK="70"
DIMMING_EDPI_LIGHT="100"
DIMMING_EXT_DARK="50"
DIMMING_EXT_LIGHT="100"

Edit via theme-settings GUI or directly. The file is never overwritten on reinstall.


Adding a custom language

cp ~/.config/xfce-night-switch/locales/en.sh ~/.config/xfce-night-switch/locales/de.sh
nano ~/.config/xfce-night-switch/locales/de.sh
# Select in settings: App language → de

Sunrise/sunset accuracy

sunrise-sunset.py uses the NOAA Solar Calculator algorithm implemented in pure Python stdlib. Accuracy: ±1 minute for most latitudes. Calculated times are cached in ~/.cache/xfce-night-switch/sun_times for offline resilience. Polar regions (above 66°N / below 66°S) with midnight sun or polar night fall back to time-based mode.


Similar projects

Project Stars Approach XFCE panel GUI Location
bimlas/xfce4-night-mode 109⭐ GenMon plugin, shell Text only
C2N14/AutomaThemely 202⭐ Python, multi-DE
UdeshyaDhungana/xfce4-theme-switcher 10⭐ Shell
xfce-night-switch (this) Shell + yad ✅ icon+menu

Contributing

We welcome contributions of all kinds! Please see CONTRIBUTING.md for detailed instructions on local development, running tests, conventional commit conventions, and the automated PR test gate.


License

MIT — see LICENSE.

About

Automatic dark/light theme switcher for XFCE — panel launcher, icon picker, solar scheduling, i18n

Topics

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages