diff --git a/troubleshooting.md b/troubleshooting.md index 68d51f3..9a746f1 100644 --- a/troubleshooting.md +++ b/troubleshooting.md @@ -73,7 +73,60 @@ Synaptics scroll direction options: # Theme switching issues -## Tmux and terminal not updating after theme switch +## Cross-application theme synchronization + +**Issue:** Need to synchronize theme (light/dark) across tmux, nvim, and other terminal applications. + +**Solution:** File-based theme management system using `~/.vim_theme`: + +### Setup: + +1. **Create theme switcher script** (`~/.config/tmux/themeswitch.sh`): +```bash +#!/bin/bash +if [ -f ~/.vim_theme ] && [ "$(cat ~/.vim_theme)" = "light" ]; then + tmux set -g @catppuccin_flavor "latte" +else + tmux set -g @catppuccin_flavor "mocha" +fi +``` + +2. **Add to tmux config** (`~/.config/tmux/tmux.conf`): +```bash +# Dynamic theme switching based on ~/.vim_theme file +run 'bash ~/.config/tmux/themeswitch.sh' +``` + +3. **Add to shell config** (`~/.zshrc`): +```bash +# Export THEME environment variable for nvim and other apps +if [ -f ~/.vim_theme ]; then + export THEME=$(cat ~/.vim_theme) +else + export THEME="dark" # default +fi +``` + +### Usage: +```bash +# Switch to light theme +echo "light" > ~/.vim_theme + +# Switch to dark theme +echo "dark" > ~/.vim_theme +``` + +### Benefits: +- ✅ **Single source of truth:** `~/.vim_theme` file controls all applications +- ✅ **Automatic propagation:** New terminals inherit theme via shell config +- ✅ **No environment variable issues:** File-based approach avoids tmux env var propagation problems +- ✅ **Cross-application support:** nvim reads `$THEME`, tmux uses catppuccin flavors + +### Limitations: +- **Tmux live reload:** Changes require tmux config reload or session restart +- **Workaround:** Use tmux-resurrect to quickly restore sessions after restart + +## Legacy: Tmux and terminal not updating after theme switch **Issue:** After running the theme switcher script, tmux sessions and existing terminals don't reflect the new theme until restarted. @@ -81,10 +134,7 @@ Synaptics scroll direction options: - Restart tmux sessions: `tmux kill-server && tmux` - Open new terminal windows -**TODO:** -- Investigate tmux theme reload without killing sessions -- Check if terminal emulator supports theme change signals -- Improve theme script to handle live theme updates +**Status:** ✅ **Solved** - Use file-based theme management system above ## Tmux window names showing hostname instead of command @@ -201,3 +251,20 @@ sudo setkeycodes 3a 14 # Map caps lock scancode to backspace keycode ``` **Permanent fix:** Systemd service created at `/etc/systemd/system/caps-backspace.service` + +## Laptop sleeps when lid is closed + +Solution: + +sudo nvim /etc/systemd/logind.conf + +Uncomment and change these lines: + +``` +HandleLidSwitch=ignore +HandleLidSwitchExternalPower=ignore +HandleLidSwitchDocked=ignore +``` + +Then restart service: +`sudo systemctl restart systemd-logind`