This tmux tpm plugin automatically changes the tmux theme when the system switches between light/dark mode on macOS and Linux (GNOME, KDE Plasma, COSMIC). Configure light and dark themes, and the plugin handles the rest!
- Features
- Requirements
- Installation
- Configuration
- Usage
- Troubleshooting
- Advanced Usage
- Tips & Related Tools
- More tmux plugins
- 🌙 Automatic theme switching - Responds to system appearance changes on macOS and Linux
- 🔒 Robust process management - Per-server PID tracking prevents duplicate instances
- 🎯 Modular design - Platform-specific backends with shared core
- 🐧 Linux support - GNOME, KDE Plasma, and COSMIC via freedesktop portal with DE-specific fallbacks
- 🛠️ Manual control - Switch themes manually when needed
- 📁 State management - Maintains theme symlinks for tmux config integration
- 🔧 Error handling - Comprehensive validation and helpful error messages
- Bash - For script execution
- Homebrew - Package manager for dependencies
- dark-notify - Install with
brew install cormacrelf/tap/dark-notify - tmux - Terminal multiplexer
- tpm - Tmux Plugin Manager (optional but recommended)
- Bash - For script execution
- tmux - Terminal multiplexer
- tpm - Tmux Plugin Manager (optional but recommended)
- One of the following desktop environments:
- GNOME - Uses
gsettingsor freedesktop portal (both typically pre-installed) - KDE Plasma - Uses freedesktop portal via
dbus-sendanddbus-monitor - COSMIC (Pop!_OS) - Reads config files directly; optionally install
inotify-toolsfor instant detection
- GNOME - Uses
-
Install dependencies:
macOS:
brew install cormacrelf/tap/dark-notify
Linux (GNOME): No additional dependencies —
gsettingsis typically pre-installed.Linux (KDE Plasma): No additional dependencies —
dbus-sendanddbus-monitorare typically pre-installed.Linux (COSMIC): Optionally install
inotify-toolsfor instant theme detection:# Debian/Ubuntu/Pop!_OS sudo apt install inotify-tools # Fedora sudo dnf install inotify-tools # Arch sudo pacman -S inotify-tools
-
Add plugin to tmux.conf:
set -g @plugin 'ivuorinen/tmux-dark-notify' -
Install with tpm: Press
<prefix>I(default:Ctrl-b I) to install the plugin.
Add these options to your tmux.conf before the tpm initialization:
set -g @dark-notify-theme-path-light '/path/to/your/light-theme.conf'
set -g @dark-notify-theme-path-dark '/path/to/your/dark-theme.conf'
Example with Solarized themes:
set -g @dark-notify-theme-path-light '$HOME/.config/tmux/plugins/tmux-colors-solarized/tmuxcolors-light.conf'
set -g @dark-notify-theme-path-dark '$HOME/.config/tmux/plugins/tmux-colors-solarized/tmuxcolors-dark.conf'
Add this after tpm initialization to ensure themes load even if the plugin hasn't run yet:
# Initialize tpm (this line should already exist)
run '~/.config/tmux/plugins/tpm/tpm'
# Fallback theme loading
if-shell "test -e ~/.local/state/tmux/tmux-dark-notify-theme.conf" \
"source-file ~/.local/state/tmux/tmux-dark-notify-theme.conf"
# Theme plugins (install these first)
set -g @plugin 'seebi/tmux-colors-solarized'
set -g @plugin 'ivuorinen/tmux-dark-notify'
# Configure theme paths
set -g @dark-notify-theme-path-light '$HOME/.config/tmux/plugins/tmux-colors-solarized/tmuxcolors-light.conf'
set -g @dark-notify-theme-path-dark '$HOME/.config/tmux/plugins/tmux-colors-solarized/tmuxcolors-dark.conf'
# Initialize tpm
run '~/.config/tmux/plugins/tpm/tpm'
# Fallback theme loading
if-shell "test -e ~/.local/state/tmux/tmux-dark-notify-theme.conf" \
"source-file ~/.local/state/tmux/tmux-dark-notify-theme.conf"
- Reload tmux config:
<prefix>ror restart tmux - Check the theme symlink:
ls -l ~/.local/state/tmux/tmux-dark-notify-theme.conf - Toggle your system appearance mode and watch tmux theme change!
The plugin runs automatically once installed, but you can also use it manually:
The plugin launches automatically with tmux and runs in the background, monitoring for system appearance changes.
# Switch to dark theme
~/.config/tmux/plugins/tmux-dark-notify/main.tmux --theme dark
# Switch to light theme
~/.config/tmux/plugins/tmux-dark-notify/main.tmux --theme light# Start daemon manually
~/.config/tmux/plugins/tmux-dark-notify/main.tmux --daemon
# Show help
~/.config/tmux/plugins/tmux-dark-notify/main.tmux --help-
Check dark-notify installation:
which dark-notify # Should output: /opt/homebrew/bin/dark-notify (or similar) -
Verify theme paths exist:
# Check if your theme files are readable test -r "$HOME/.config/tmux/plugins/tmux-colors-solarized/tmuxcolors-light.conf" && echo "Light theme OK" test -r "$HOME/.config/tmux/plugins/tmux-colors-solarized/tmuxcolors-dark.conf" && echo "Dark theme OK"
-
Check plugin status:
# Look for running daemon ps aux | grep tmux-dark-notify # Check PID files ls -la ~/.local/state/tmux/tmux-dark-notify-*.pid
- Verify tmux options are set:
tmux show-options -g | grep dark-notify - Test manual switching:
~/.config/tmux/plugins/tmux-dark-notify/main.tmux --theme dark - Check theme symlink:
ls -l ~/.local/state/tmux/tmux-dark-notify-theme.conf
The plugin auto-detects your desktop environment. If it can't find a supported method:
-
Check freedesktop portal:
dbus-send --session --print-reply \ --dest=org.freedesktop.portal.Desktop \ /org/freedesktop/portal/desktop \ org.freedesktop.portal.Settings.Read \ string:'org.freedesktop.appearance' string:'color-scheme'
-
Check GNOME gsettings:
gsettings get org.gnome.desktop.interface color-scheme
-
Check COSMIC config:
cat ~/.config/cosmic/com.system76.CosmicTheme.Mode/v1/is_dark
The plugin uses per-server PID files to prevent duplicate instances. If you see issues:
-
Remove stale PID files:
rm ~/.local/state/tmux/tmux-dark-notify-*.pid
-
Restart the plugin:
~/.config/tmux/plugins/tmux-dark-notify/main.tmux
Set a custom state directory using the XDG specification:
export XDG_STATE_HOME="$HOME/.local/state"Enable trace mode for debugging:
TRACE=1 ~/.config/tmux/plugins/tmux-dark-notify/main.tmux --daemonYou can call the theme switcher from your own scripts:
#!/bin/bash
# Switch to dark theme for late-night coding
~/.config/tmux/plugins/tmux-dark-notify/main.tmux --theme darkSet up dark-notify to change your Neovim theme as well!
Use iTerm2 version ≥3.5 for automatic terminal theme switching:
- Go to iTerm2 Preferences → Profiles → [your profile] → Colors
- Check "Use different colors for light and dark mode"
- Configure your light and dark color schemes
Create a macOS keyboard shortcut to toggle system appearance:
- Create Quick Action in Automator:
- Open Automator.app
- Create a new Quick Action
- Add "Change System Appearance" action
- Set to "Toggle Light/Dark"
- Save as
appearance_toggle
- Add Keyboard Shortcut:
- Open System Settings → Keyboard → Keyboard Shortcuts → Services
- Find your
appearance_toggleservice under General - Assign a shortcut (e.g., ⌃⌥⌘T)
Built on top of the excellent dark-notify by Cormac Relf and original tmux-dark-notify by Erik Westrup!*
