feat: add Alacritty light and dark themes + synchronization scripts ✨
This commit is contained in:
parent
d35b908001
commit
bd9cd434d4
9 changed files with 504 additions and 1 deletions
109
assets/alacritty/README.md
Normal file
109
assets/alacritty/README.md
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
# Alacritty Theme Synchronization
|
||||
|
||||
This directory contains the theme synchronization system for Alacritty that automatically switches between Catppuccin light and dark themes based on your macOS system theme.
|
||||
|
||||
## Files
|
||||
|
||||
- `catppuccin-light.yml` - Catppuccin Latte (light) theme colors
|
||||
- `catppuccin-dark.yml` - Catppuccin Mocha (dark) theme colors
|
||||
- `README.md` - This documentation
|
||||
|
||||
## Scripts
|
||||
|
||||
The theme synchronization scripts are located in `/scripts/`:
|
||||
|
||||
- `detect-system-theme.sh` - Detects current macOS system theme (light/dark)
|
||||
- `sync-alacritty-theme.sh` - Syncs Alacritty config with current system theme
|
||||
- `monitor-theme-changes.sh` - Continuously monitors for theme changes
|
||||
- `setup-alacritty-theme-sync.sh` - Setup script for initial configuration
|
||||
|
||||
## Setup
|
||||
|
||||
1. Run the setup script:
|
||||
```bash
|
||||
./scripts/setup-alacritty-theme-sync.sh
|
||||
```
|
||||
|
||||
2. Choose your preferred method for automatic theme switching:
|
||||
|
||||
### Option 1: Manual Sync
|
||||
Run the sync script whenever you want to update the theme:
|
||||
```bash
|
||||
./scripts/sync-alacritty-theme.sh
|
||||
```
|
||||
|
||||
### Option 2: Background Monitoring
|
||||
Run the monitor script in the background:
|
||||
```bash
|
||||
./scripts/monitor-theme-changes.sh &
|
||||
```
|
||||
|
||||
### Option 3: LaunchAgent (Recommended)
|
||||
Install as a system service that runs automatically:
|
||||
```bash
|
||||
cp assets/launchd/com.user.alacritty-theme-sync.plist ~/Library/LaunchAgents/
|
||||
launchctl load ~/Library/LaunchAgents/com.user.alacritty-theme-sync.plist
|
||||
```
|
||||
|
||||
### Option 4: Shell Integration
|
||||
Add to your Fish shell configuration:
|
||||
```bash
|
||||
echo 'source /Users/danny/dotfiles/scripts/sync-alacritty-theme.sh' >> ~/.config/fish/config.fish
|
||||
```
|
||||
|
||||
## How It Works
|
||||
|
||||
1. The system detects your current macOS theme using `defaults read -g AppleInterfaceStyle`
|
||||
2. Based on the theme, it applies the appropriate Catppuccin color scheme:
|
||||
- **Light theme** → Catppuccin Latte
|
||||
- **Dark theme** → Catppuccin Mocha
|
||||
3. The Alacritty configuration is updated with the new colors
|
||||
4. Running Alacritty instances are restarted to apply the new theme
|
||||
|
||||
## Theme Colors
|
||||
|
||||
### Catppuccin Latte (Light)
|
||||
- Background: `#eff1f5` (base)
|
||||
- Foreground: `#4c4f69` (text)
|
||||
- Accent colors optimized for light backgrounds
|
||||
|
||||
### Catppuccin Mocha (Dark)
|
||||
- Background: `#1e1e2e` (base)
|
||||
- Foreground: `#cdd6f4` (text)
|
||||
- Accent colors optimized for dark backgrounds
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Theme not updating
|
||||
- Check if Alacritty config file exists and is writable
|
||||
- Verify the theme detection script works: `./scripts/detect-system-theme.sh`
|
||||
- Check logs in `/tmp/alacritty-theme-sync.log`
|
||||
|
||||
### LaunchAgent not working
|
||||
- Check if the plist file is in the correct location
|
||||
- Verify permissions: `ls -la ~/Library/LaunchAgents/`
|
||||
- Check launchctl status: `launchctl list | grep alacritty`
|
||||
|
||||
### Manual theme override
|
||||
If you want to manually set a theme regardless of system setting:
|
||||
```bash
|
||||
# Force light theme
|
||||
ALACRITTY_THEME=light ./scripts/sync-alacritty-theme.sh
|
||||
|
||||
# Force dark theme
|
||||
ALACRITTY_THEME=dark ./scripts/sync-alacritty-theme.sh
|
||||
```
|
||||
|
||||
## Integration with NixOS
|
||||
|
||||
The NixOS configuration in `nixos/home/danny/home.nix` provides the base Alacritty configuration. The theme sync scripts work on top of this configuration, dynamically updating the colors section while preserving all other settings.
|
||||
|
||||
## Customization
|
||||
|
||||
To customize the themes:
|
||||
|
||||
1. Edit the color values in `catppuccin-light.yml` or `catppuccin-dark.yml`
|
||||
2. Run the sync script to apply changes
|
||||
3. The changes will persist until the next theme switch
|
||||
|
||||
For more advanced customization, you can modify the sync script to use different theme files or add additional theme variants.
|
||||
30
assets/alacritty/catppuccin-dark.yml
Normal file
30
assets/alacritty/catppuccin-dark.yml
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# Catppuccin Mocha (Dark) theme for Alacritty
|
||||
colors:
|
||||
# Catppuccin Mocha palette
|
||||
primary:
|
||||
background: '0x1e1e2e' # base
|
||||
foreground: '0xcdd6f4' # text
|
||||
|
||||
cursor:
|
||||
text: '0x1e1e2e' # base
|
||||
cursor: '0xf5e0dc' # rosewater
|
||||
|
||||
normal:
|
||||
black: '0x45475a' # surface1
|
||||
red: '0xf38ba8' # red
|
||||
green: '0xa6e3a1' # green
|
||||
yellow: '0xf9e2af' # yellow
|
||||
blue: '0x89b4fa' # blue
|
||||
magenta: '0xf5c2e7' # pink
|
||||
cyan: '0x94e2d5' # teal
|
||||
white: '0xbac2de' # subtext1
|
||||
|
||||
bright:
|
||||
black: '0x585b70' # surface2
|
||||
red: '0xf38ba8' # red
|
||||
green: '0xa6e3a1' # green
|
||||
yellow: '0xf9e2af' # yellow
|
||||
blue: '0x89b4fa' # blue
|
||||
magenta: '0xf5c2e7' # pink
|
||||
cyan: '0x94e2d5' # teal
|
||||
white: '0xa6adc8' # subtext0
|
||||
30
assets/alacritty/catppuccin-light.yml
Normal file
30
assets/alacritty/catppuccin-light.yml
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# Catppuccin Latte (Light) theme for Alacritty
|
||||
colors:
|
||||
# Catppuccin Latte palette
|
||||
primary:
|
||||
background: '0xeff1f5' # base
|
||||
foreground: '0x4c4f69' # text
|
||||
|
||||
cursor:
|
||||
text: '0xeff1f5' # base
|
||||
cursor: '0xdc8a78' # rosewater
|
||||
|
||||
normal:
|
||||
black: '0x5c5f77' # surface1
|
||||
red: '0xd20f39' # red
|
||||
green: '0x40a02b' # green
|
||||
yellow: '0xdf8e1d' # yellow
|
||||
blue: '0x1e40af' # blue
|
||||
magenta: '0xea76cb' # pink
|
||||
cyan: '0x179299' # teal
|
||||
white: '0xacb0be' # subtext1
|
||||
|
||||
bright:
|
||||
black: '0x6c6f85' # surface2
|
||||
red: '0xd20f39' # red
|
||||
green: '0x40a02b' # green
|
||||
yellow: '0xdf8e1d' # yellow
|
||||
blue: '0x1e40af' # blue
|
||||
magenta: '0xea76cb' # pink
|
||||
cyan: '0x179299' # teal
|
||||
white: '0xbcc0cc' # subtext0
|
||||
31
assets/launchd/com.user.alacritty-theme-sync.plist
Normal file
31
assets/launchd/com.user.alacritty-theme-sync.plist
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>com.user.alacritty-theme-sync</string>
|
||||
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/Users/danny/dotfiles/scripts/sync-alacritty-theme.sh</string>
|
||||
</array>
|
||||
|
||||
<key>StartInterval</key>
|
||||
<integer>30</integer>
|
||||
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
|
||||
<key>StandardOutPath</key>
|
||||
<string>/tmp/alacritty-theme-sync.log</string>
|
||||
|
||||
<key>StandardErrorPath</key>
|
||||
<string>/tmp/alacritty-theme-sync-error.log</string>
|
||||
|
||||
<key>EnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>PATH</key>
|
||||
<string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
Loading…
Add table
Add a link
Reference in a new issue