Add WezTerm support for automatic color scheme updates
This PR adds comprehensive WezTerm support to winwal, allowing automatic color scheme updates for the cross-platform WezTerm terminal emulator.
Changes Made
🎨 Template
- Added
templates/wezterm.luawith proper Lua color scheme structure - Includes all standard pywal color variables (
{foreground},{background},{color0-15}) - Supports WezTerm-specific properties like cursor colors and selection colors
🔧 Functionality
- Created
common/WezTermFunctions.ps1withUpdate-WalWezTermfunction - Cross-platform config detection for both Windows and Unix-like systems
- Automatic discovery of WezTerm configs in standard locations:
- Windows:
%APPDATA%\wezterm\wezterm.lua,%USERPROFILE%\.config\wezterm\wezterm.lua,%USERPROFILE%\.wezterm.lua - Unix:
$HOME/.config/wezterm/wezterm.lua,$HOME/.wezterm.lua
- Windows:
🔗 Integration
- Integrated WezTerm updates into the main
Update-WalThemeInternal.ps1workflow - WezTerm configs are now automatically updated alongside Windows Terminal
- Added function export to
winwal.psm1module
🛡️ Safety Features
- Automatic backup of existing configs before modification (
.bakfiles) - Graceful handling of missing or invalid config files
- Smart merging that preserves existing configuration while injecting wal colors
- Error handling with automatic restoration from backups if updates fail
📚 Documentation
- Updated README.md to mention WezTerm support
- Added usage notes about automatic config detection
Usage
WezTerm support works automatically with existing winwal commands:
# Updates all supported terminals including WezTerm
Update-WalTheme
# Works with different backends too
Update-WalTheme -Backend haishoku
# Updates theme from a specific image
Update-WalTheme -Image .\path\to\image.jpg
The implementation intelligently detects existing WezTerm configurations and merges the wal color scheme while preserving other settings like fonts, keybindings, and custom configurations.
Fixes #23.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.
@copilot I think we need to look into:
- What does the wezterm theme look like.
- Add a template for the wezterm theme in the templates directory to have a wal-wezterm template
- After running Update-WalTheme, check for if a wezterm config directory exists
- Copy the wal-wezterm result to the config directory
- Update wezterm's theme in the config to use wal-wezterm or leave it alone if it already does so it since it'll detect the changes to the theme file
@copilot I think we need to look into:
- What does the wezterm theme look like. ...
I've implemented the WezTerm support following your suggested approach:
- ✅ Researched WezTerm theme format - WezTerm uses TOML color scheme files in a
colors/subdirectory - ✅ Created
wal-wezterm.tomltemplate - Follows WezTerm's color scheme structure with all pywal variables - ✅ After Update-WalTheme, check for WezTerm config directory - Cross-platform detection for Windows and Unix paths
- ✅ Copy wal-wezterm result to config directory - Places the generated theme as
colors/wal.toml - ✅ Update wezterm config to use wal theme - Sets
config.color_scheme = "wal"or leaves existing reference alone
The implementation now follows the same pattern as Windows Terminal: generating a separate theme file and referencing it by name, rather than injecting the color scheme inline. This is much cleaner and matches WezTerm's expected workflow.
Commit: 055c8f5
@scaryrawr Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.
You can ask me to try again later by mentioning me in a new comment.
If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 5fb8098e-94f7-493b-8057-b81ec7ae6deb
Sorry for the inconvenience!