ThemeSwitcher is a tool that automatically sets the themes for Kitty terminal, Neovim, Tmux, and Fzf based on the system’s dark mode setting. It supports both Bash and Fish shells.
• Automatically switches themes based on macOS dark mode.
• Supports Kitty terminal, Neovim, Tmux, and Fzf.
• Works with both Bash and Fish shells.
• Allows specifying a custom launch path for executing scripts.
• macOS
• Swift
• Kitty terminal
• Neovim
• Fzf
• nvr (Neovim remote plugin)
Neovim
nvim-remote (aka nvr) is used for controlling the Neovim instances.
Kitty
For Kitty to receive remote commands, you’ll need to update your config to have:
allow_remote_control trueKitty / Tmux
If you’re using Kitty with Tmux, you’ll need to explicitly set the socket that Kitty listens on, since if you run the command from within Tmux, Kitty won’t pick up on it.
How you do this depends on how you start Kitty.
If you’re starting it from the application icon, you need to set the launch arguments in your Kitty config folder. For example, in ~/.config/kitty/macos-launch-services-cmdline I have:
--listen-on unix:/tmp/kitty
Note: If you don’t open Kitty directly from the application (for example, if you’re using Raycast), then it won’t pick up these launch arguments.
Note: I haven’t tested this with more than one Kitty window.
- Clone the repository:
- Build the Swift program:
make instalOnce the program is running, it will automatically adjust your themes based on the system’s dark mode setting.
You can also specify a custom launch path using the --launch-path parameter.
Without --launch-path (defaults to /usr/bin/env):
theme-switcher <script_path>With --launch-path:
theme-switcher <script_path> --launch-path /bin/bashMove the plist file to the appropriate location:
mv com.example.theme-switcher.plist ~/Library/LaunchAgents/Load the plist file:
launchctl load ~/Library/LaunchAgents/com.example.theme-switcher.plistRemove program
launchctl unload ~/Library/LaunchAgents/com.example.theme-switcher.plistThe initial Swift code for detecting dark mode changes was inspired by bouk’s dark-mode-notify.