Initial commit
This commit is contained in:
503
skills/zellij-config/SKILL.md
Normal file
503
skills/zellij-config/SKILL.md
Normal file
@@ -0,0 +1,503 @@
|
||||
---
|
||||
name: zellij-config
|
||||
description: "Comprehensive skill for managing Zellij terminal multiplexer configurations including setup, layouts, themes, keybindings, plugins, and web server configuration. Use this skill when users need to configure Zellij, create custom layouts, set up themes, manage keybindings, or configure web server access."
|
||||
---
|
||||
|
||||
# Zellij Config
|
||||
|
||||
## Overview
|
||||
|
||||
This skill provides comprehensive Zellij terminal multiplexer configuration management. It enables users to set up Zellij from scratch, migrate configurations, create custom layouts and themes, manage keybindings, configure plugins, and set up web server access.
|
||||
|
||||
## Quick Start
|
||||
|
||||
Choose your configuration task:
|
||||
|
||||
1. **Setup Zellij** - Initialize configuration, create config directory, set basic settings
|
||||
2. **Manage Layouts** - Create custom pane layouts, tab templates, swap layouts
|
||||
3. **Configure Themes** - Set up custom themes, switch themes, convert theme formats
|
||||
4. **Setup Keybindings** - Configure custom keybindings for different modes
|
||||
5. **Plugin Management** - Load plugins, configure plugin aliases, set plugin options
|
||||
6. **Web Server Setup** - Enable web access, configure SSL, set ports and IPs
|
||||
|
||||
## Setup Zellij
|
||||
|
||||
### Initialize Configuration Directory
|
||||
|
||||
Create Zellij configuration directory and dump default config:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.config/zellij
|
||||
zellij setup --dump-config > ~/.config/zellij/config.kdl
|
||||
```
|
||||
|
||||
### Validate Configuration
|
||||
|
||||
Check existing configuration for errors:
|
||||
|
||||
```bash
|
||||
zellij setup --check
|
||||
```
|
||||
|
||||
### Clean Start
|
||||
|
||||
Start Zellij with clean configuration (ignores existing config):
|
||||
|
||||
```bash
|
||||
zellij --clean
|
||||
```
|
||||
|
||||
### Configuration File Location
|
||||
|
||||
Specify custom configuration file:
|
||||
|
||||
```bash
|
||||
zellij --config /path/to/custom/config.kdl
|
||||
# or via environment variable
|
||||
export ZELLIJ_CONFIG_FILE=/path/to/custom/config.kdl
|
||||
```
|
||||
|
||||
## Manage Layouts
|
||||
|
||||
### Create Default Layout
|
||||
|
||||
Generate a default layout template:
|
||||
|
||||
```bash
|
||||
zellij setup --dump-layout default > ~/.config/zellij/layouts/default.kdl
|
||||
```
|
||||
|
||||
### Create Custom Layout
|
||||
|
||||
Create a development layout with multiple panes:
|
||||
|
||||
```kdl
|
||||
layout {
|
||||
default_tab_template {
|
||||
pane size=1 borderless=true {
|
||||
plugin location="zellij:tab-bar"
|
||||
}
|
||||
children
|
||||
pane size=2 borderless=true {
|
||||
plugin location="zellij:status-bar"
|
||||
}
|
||||
}
|
||||
tab name="development" split_direction="vertical" {
|
||||
pane size="70%" {
|
||||
command "nvim"
|
||||
cwd "~/project"
|
||||
}
|
||||
pane split_direction="horizontal" {
|
||||
pane command="git" {
|
||||
args "status"
|
||||
cwd "~/project"
|
||||
}
|
||||
pane command="htop"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Floating Layout Example
|
||||
|
||||
Layout with floating panes for different pane counts:
|
||||
|
||||
```kdl
|
||||
layout {
|
||||
swap_floating_layout {
|
||||
floating_panes max_panes=1 {
|
||||
pane
|
||||
}
|
||||
floating_panes max_panes=2 {
|
||||
pane x=0
|
||||
pane x="50%"
|
||||
}
|
||||
floating_panes max_panes=3 {
|
||||
pane x=0 width="25%"
|
||||
pane x="25%" width="25%"
|
||||
pane x="50%"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Use Custom Layout
|
||||
|
||||
Load a specific layout:
|
||||
|
||||
```bash
|
||||
zellij --layout /path/to/custom-layout.kdl
|
||||
# or place in ~/.config/zellij/layouts/ and use default
|
||||
```
|
||||
|
||||
## Configure Themes
|
||||
|
||||
### Apply Built-in Theme
|
||||
|
||||
Set theme in configuration file:
|
||||
|
||||
```kdl
|
||||
theme "default"
|
||||
```
|
||||
|
||||
### Define Custom Theme (RGB)
|
||||
|
||||
Create a custom theme with RGB values:
|
||||
|
||||
```kdl
|
||||
themes {
|
||||
custom_theme {
|
||||
fg 248 248 242
|
||||
bg 40 42 54
|
||||
black 0 0 0
|
||||
red 255 85 85
|
||||
green 80 250 123
|
||||
yellow 241 250 140
|
||||
blue 98 114 164
|
||||
magenta 255 121 198
|
||||
cyan 139 233 253
|
||||
white 255 255 255
|
||||
orange 255 184 108
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Define Custom Theme (Hexadecimal)
|
||||
|
||||
Create a theme with hex color codes:
|
||||
|
||||
```kdl
|
||||
themes {
|
||||
nord {
|
||||
fg "#D8DEE9"
|
||||
bg "#2E3440"
|
||||
black "#3B4252"
|
||||
red "#BF616A"
|
||||
green "#A3BE8C"
|
||||
yellow "#EBCB8B"
|
||||
blue "#81A1C1"
|
||||
magenta "#B48EAD"
|
||||
cyan "#88C0D0"
|
||||
white "#E5E9F0"
|
||||
orange "#D08770"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Switch Theme from Command Line
|
||||
|
||||
Temporarily use a theme:
|
||||
|
||||
```bash
|
||||
zellij --theme custom_theme
|
||||
```
|
||||
|
||||
### Convert Legacy Theme
|
||||
|
||||
Convert YAML theme to KDL format:
|
||||
|
||||
```bash
|
||||
zellij convert-theme /path/to/old-theme.yaml > /path/to/new-theme.kdl
|
||||
```
|
||||
|
||||
## Setup Keybindings
|
||||
|
||||
### Basic Keybinding Configuration
|
||||
|
||||
Configure keybindings for different modes:
|
||||
|
||||
```kdl
|
||||
keybinds {
|
||||
normal {
|
||||
bind "Ctrl g" { SwitchToMode "locked"; }
|
||||
bind "Ctrl p" { SwitchToMode "pane"; }
|
||||
bind "Alt n" { NewPane; }
|
||||
bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; }
|
||||
bind "Ctrl Shift t" { NewTab; }
|
||||
}
|
||||
pane {
|
||||
bind "h" "Left" { MoveFocus "Left"; }
|
||||
bind "l" "Right" { MoveFocus "Right"; }
|
||||
bind "j" "Down" { MoveFocus "Down"; }
|
||||
bind "k" "Up" { MoveFocus "Up"; }
|
||||
bind "p" { SwitchFocus; }
|
||||
bind "Ctrl c" { CopySelection; }
|
||||
}
|
||||
locked {
|
||||
bind "Ctrl g" { SwitchToMode "normal"; }
|
||||
}
|
||||
shared {
|
||||
bind "Alt 1" { Run "git" "status"; }
|
||||
bind "Alt 2" { Run "git" "diff"; }
|
||||
bind "Alt 3" { Run "exa" "--color" "always"; }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Keybinding Syntax Examples
|
||||
|
||||
Different keybinding syntax patterns:
|
||||
|
||||
```kdl
|
||||
bind "a" // individual character
|
||||
bind "Ctrl a" // with ctrl modifier
|
||||
bind "Alt a" // with alt modifier
|
||||
bind "Ctrl Alt a" // multiple modifiers
|
||||
bind "F8" // function key
|
||||
bind "Left" // arrow key
|
||||
```
|
||||
|
||||
## Plugin Management
|
||||
|
||||
### Load Plugins on Startup
|
||||
|
||||
Configure plugins to load automatically:
|
||||
|
||||
```kdl
|
||||
load_plugins {
|
||||
https://example.com/my-plugin.wasm
|
||||
file:/path/to/my/plugin.kdl
|
||||
my-plugin-alias
|
||||
}
|
||||
```
|
||||
|
||||
### Configure Plugin Aliases
|
||||
|
||||
Set up common plugin aliases:
|
||||
|
||||
```kdl
|
||||
plugins {
|
||||
tab-bar location="zellij:tab-bar"
|
||||
status-bar location="zellij:status-bar"
|
||||
strider location="zellij:strider"
|
||||
compact-bar location="zellij:compact-bar"
|
||||
session-manager location="zellij:session-manager"
|
||||
welcome-screen location="zellij:session-manager" {
|
||||
welcome_screen true
|
||||
}
|
||||
filepicker location="zellij:strider" {
|
||||
cwd "/"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Configure Plugin Options
|
||||
|
||||
Pass configuration to plugins:
|
||||
|
||||
```kdl
|
||||
layout {
|
||||
pane {
|
||||
plugin location="file:/path/to/my/plugin.wasm" {
|
||||
some_key "some_value"
|
||||
another_key 1
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Launch Plugin with Configuration
|
||||
|
||||
Configure plugin via command line:
|
||||
|
||||
```bash
|
||||
zellij action launch-or-focus-plugin --configuration "some_key=some_value,another_key=1"
|
||||
```
|
||||
|
||||
## Web Server Setup
|
||||
|
||||
### Enable Web Server
|
||||
|
||||
Start web server automatically:
|
||||
|
||||
```kdl
|
||||
web_server true
|
||||
web_server_ip "0.0.0.0"
|
||||
web_server_port 8082
|
||||
```
|
||||
|
||||
### Configure SSL
|
||||
|
||||
Set up HTTPS with SSL certificates:
|
||||
|
||||
```kdl
|
||||
web_server true
|
||||
web_server_ip "0.0.0.0"
|
||||
web_server_port 443
|
||||
web_server_cert "/path/to/my/certs/localhost+3.pem"
|
||||
web_server_key "/path/to/my/certs/localhost+3-key.pem"
|
||||
enforce_https_on_localhost true
|
||||
```
|
||||
|
||||
### Web Client Configuration
|
||||
|
||||
Configure browser-based terminal appearance:
|
||||
|
||||
```kdl
|
||||
web_client {
|
||||
font "Iosevka Term"
|
||||
cursor_blink true
|
||||
cursor_style "block"
|
||||
cursor_inactive_style "outline"
|
||||
mac_option_is_meta false
|
||||
theme {
|
||||
background 10 20 30
|
||||
foreground 10 20 30
|
||||
black 10 20 30
|
||||
blue 10 20 30
|
||||
bright_black 10 20 30
|
||||
bright_blue 10 20 30
|
||||
bright_cyan 10 20 30
|
||||
bright_green 10 20 30
|
||||
bright_magenta 10 20 30
|
||||
bright_red 10 20 30
|
||||
bright_white 10 20 30
|
||||
bright_yellow 10 20 30
|
||||
cursor 10 20 30
|
||||
cursor_accent 10 20 30
|
||||
cyan 10 20 30
|
||||
green 10 20 30
|
||||
magenta 10 20 30
|
||||
red 10 20 30
|
||||
white 10 20 30
|
||||
yellow 10 20 30
|
||||
selection_background 10 20 30
|
||||
selection_foreground 10 20 30
|
||||
selection_inactive_background 10 20 30
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
### Set Environment for Panes
|
||||
|
||||
Configure environment variables for all panes:
|
||||
|
||||
```kdl
|
||||
env {
|
||||
RUST_BACKTRACE 1
|
||||
FOO "bar"
|
||||
EDITOR "nvim"
|
||||
}
|
||||
```
|
||||
|
||||
### Session Management
|
||||
|
||||
Configure session persistence and resurrection:
|
||||
|
||||
```kdl
|
||||
session_serialization true
|
||||
pane_viewport_serialization true
|
||||
scrollback_lines_to_serialize 0
|
||||
default_layout "compact"
|
||||
default_mode "locked"
|
||||
```
|
||||
|
||||
## Common Workflows
|
||||
|
||||
### Development Environment Setup
|
||||
|
||||
Create a comprehensive development layout:
|
||||
|
||||
```bash
|
||||
# Create development layout
|
||||
cat > ~/.config/zellij/layouts/dev.kdl << 'EOF'
|
||||
layout {
|
||||
default_tab_template {
|
||||
pane size=1 borderless=true {
|
||||
plugin location="zellij:tab-bar"
|
||||
}
|
||||
children
|
||||
pane size=2 borderless=true {
|
||||
plugin location="zellij:status-bar"
|
||||
}
|
||||
}
|
||||
tab name="editor" cwd="~/project" focus=true {
|
||||
pane command="nvim" size="80%"
|
||||
pane size="20%" split_direction="vertical" {
|
||||
pane command="git" {
|
||||
args "status"
|
||||
size="50%"
|
||||
}
|
||||
pane command="htop"
|
||||
}
|
||||
}
|
||||
tab name="terminal" {
|
||||
pane command="bash"
|
||||
}
|
||||
tab name="monitoring" split_direction="horizontal" {
|
||||
pane command="htop"
|
||||
pane command="btop"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# Use the layout
|
||||
zellij --layout dev
|
||||
```
|
||||
|
||||
### Multiplayer Session Setup
|
||||
|
||||
Configure colors for multiplayer sessions:
|
||||
|
||||
```kdl
|
||||
multiplayer_user_colors {
|
||||
player_1 255 0 255
|
||||
player_2 0 217 227
|
||||
player_3 0
|
||||
player_4 255 230 0
|
||||
player_5 0 229 229
|
||||
player_6 0
|
||||
player_7 255 53 94
|
||||
player_8 0
|
||||
player_9 0
|
||||
player_10 0
|
||||
}
|
||||
```
|
||||
|
||||
## Configuration Validation
|
||||
|
||||
### Check Configuration
|
||||
|
||||
Validate configuration file syntax:
|
||||
|
||||
```bash
|
||||
zellij setup --check
|
||||
```
|
||||
|
||||
### Test Configuration
|
||||
|
||||
Test new configuration without affecting existing session:
|
||||
|
||||
```bash
|
||||
zellij --config /path/to/test-config.kdl --session-name test-session
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
### scripts/
|
||||
Executable scripts for Zellij configuration management:
|
||||
|
||||
- `setup_zellij.py` - Automates initial Zellij setup
|
||||
- `create_layout.py` - Generates custom layouts from templates
|
||||
- `convert_themes.py` - Converts legacy theme formats to KDL
|
||||
- `validate_config.py` - Validates Zellij configuration syntax
|
||||
- `backup_config.py` - Creates configuration backups
|
||||
|
||||
### references/
|
||||
Comprehensive Zellij configuration documentation:
|
||||
|
||||
- `configuration_options.md` - Complete reference of all Zellij options
|
||||
- `layout_examples.md` - Collection of layout templates
|
||||
- `theme_examples.md` - Custom theme examples and guidelines
|
||||
- `keybinding_reference.md` - Complete keybinding syntax and actions
|
||||
- `plugin_api.md` - Plugin development and configuration guide
|
||||
|
||||
### assets/
|
||||
Configuration templates and example files:
|
||||
|
||||
- `config_templates/` - Starter configuration files for different use cases
|
||||
- `layout_templates/` - Common layout templates (development, monitoring, etc.)
|
||||
- `theme_templates/` - Custom theme files (nord, dracula, etc.)
|
||||
- `plugin_examples/` - Example plugin configurations
|
||||
49
skills/zellij-config/assets/config_templates/basic.kdl
Normal file
49
skills/zellij-config/assets/config_templates/basic.kdl
Normal file
@@ -0,0 +1,49 @@
|
||||
# Basic Zellij Configuration Template
|
||||
# Copy this to ~/.config/zellij/config.kdl and customize as needed
|
||||
|
||||
# UI Settings
|
||||
ui {
|
||||
pane_frames {
|
||||
rounded_corners true
|
||||
}
|
||||
}
|
||||
|
||||
# Mouse Settings
|
||||
mouse_mode true
|
||||
copy_on_select false
|
||||
|
||||
# Theme
|
||||
theme "default"
|
||||
|
||||
# Session Management
|
||||
session_serialization true
|
||||
pane_viewport_serialization false
|
||||
default_layout "default"
|
||||
default_mode "normal"
|
||||
|
||||
# Keybindings - Basic Setup
|
||||
keybinds {
|
||||
normal {
|
||||
bind "Ctrl g" { SwitchToMode "locked"; }
|
||||
bind "Ctrl p" { SwitchToMode "pane"; }
|
||||
bind "Alt n" { NewPane; }
|
||||
bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; }
|
||||
bind "Ctrl Shift t" { NewTab; }
|
||||
}
|
||||
pane {
|
||||
bind "h" "Left" { MoveFocus "Left"; }
|
||||
bind "l" "Right" { MoveFocus "Right"; }
|
||||
bind "j" "Down" { MoveFocus "Down"; }
|
||||
bind "k" "Up" { MoveFocus "Up"; }
|
||||
bind "p" { SwitchFocus; }
|
||||
bind "Ctrl c" { CopySelection; }
|
||||
}
|
||||
locked {
|
||||
bind "Ctrl g" { SwitchToMode "normal"; }
|
||||
}
|
||||
}
|
||||
|
||||
# Environment Variables
|
||||
env {
|
||||
EDITOR "nvim"
|
||||
}
|
||||
24
skills/zellij-config/assets/example_asset.txt
Normal file
24
skills/zellij-config/assets/example_asset.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
# Example Asset File
|
||||
|
||||
This placeholder represents where asset files would be stored.
|
||||
Replace with actual asset files (templates, images, fonts, etc.) or delete if not needed.
|
||||
|
||||
Asset files are NOT intended to be loaded into context, but rather used within
|
||||
the output Claude produces.
|
||||
|
||||
Example asset files from other skills:
|
||||
- Brand guidelines: logo.png, slides_template.pptx
|
||||
- Frontend builder: hello-world/ directory with HTML/React boilerplate
|
||||
- Typography: custom-font.ttf, font-family.woff2
|
||||
- Data: sample_data.csv, test_dataset.json
|
||||
|
||||
## Common Asset Types
|
||||
|
||||
- Templates: .pptx, .docx, boilerplate directories
|
||||
- Images: .png, .jpg, .svg, .gif
|
||||
- Fonts: .ttf, .otf, .woff, .woff2
|
||||
- Boilerplate code: Project directories, starter files
|
||||
- Icons: .ico, .svg
|
||||
- Data files: .csv, .json, .xml, .yaml
|
||||
|
||||
Note: This is a text placeholder. Actual assets can be any file type.
|
||||
34
skills/zellij-config/references/api_reference.md
Normal file
34
skills/zellij-config/references/api_reference.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# Reference Documentation for Zellij Config
|
||||
|
||||
This is a placeholder for detailed reference documentation.
|
||||
Replace with actual reference content or delete if not needed.
|
||||
|
||||
Example real reference docs from other skills:
|
||||
- product-management/references/communication.md - Comprehensive guide for status updates
|
||||
- product-management/references/context_building.md - Deep-dive on gathering context
|
||||
- bigquery/references/ - API references and query examples
|
||||
|
||||
## When Reference Docs Are Useful
|
||||
|
||||
Reference docs are ideal for:
|
||||
- Comprehensive API documentation
|
||||
- Detailed workflow guides
|
||||
- Complex multi-step processes
|
||||
- Information too lengthy for main SKILL.md
|
||||
- Content that's only needed for specific use cases
|
||||
|
||||
## Structure Suggestions
|
||||
|
||||
### API Reference Example
|
||||
- Overview
|
||||
- Authentication
|
||||
- Endpoints with examples
|
||||
- Error codes
|
||||
- Rate limits
|
||||
|
||||
### Workflow Guide Example
|
||||
- Prerequisites
|
||||
- Step-by-step instructions
|
||||
- Common patterns
|
||||
- Troubleshooting
|
||||
- Best practices
|
||||
421
skills/zellij-config/references/configuration_options.md
Normal file
421
skills/zellij-config/references/configuration_options.md
Normal file
@@ -0,0 +1,421 @@
|
||||
# Zellij Configuration Options Reference
|
||||
|
||||
Complete reference of all Zellij configuration options with examples.
|
||||
|
||||
## Core Configuration
|
||||
|
||||
### `theme`
|
||||
Sets the color theme to use. The theme must be defined in the configuration's 'themes' section or loaded from the themes folder.
|
||||
|
||||
**Type:** String
|
||||
**Default:** "default"
|
||||
|
||||
```kdl
|
||||
theme "nord"
|
||||
theme "dracula"
|
||||
theme "custom_theme"
|
||||
```
|
||||
|
||||
### `default_layout`
|
||||
Specifies the name of the layout file to load when Zellij starts. The layout must exist in the layouts folder.
|
||||
|
||||
**Type:** String
|
||||
**Default:** "default"
|
||||
|
||||
```kdl
|
||||
default_layout "compact"
|
||||
default_layout "development"
|
||||
```
|
||||
|
||||
### `default_mode`
|
||||
Determines the mode Zellij starts in.
|
||||
|
||||
**Type:** String
|
||||
**Values:** "normal", "locked"
|
||||
**Default:** "normal"
|
||||
|
||||
```kdl
|
||||
default_mode "locked"
|
||||
```
|
||||
|
||||
### `layout_dir`
|
||||
Sets the directory where Zellij searches for layout files.
|
||||
|
||||
**Type:** String
|
||||
**Default:** Subdirectory of config dir
|
||||
|
||||
```kdl
|
||||
layout_dir "/path/to/my/layout_dir"
|
||||
```
|
||||
|
||||
### `theme_dir`
|
||||
Sets the directory where Zellij searches for theme files.
|
||||
|
||||
**Type:** String
|
||||
**Default:** Subdirectory of config dir
|
||||
|
||||
```kdl
|
||||
theme_dir "/path/to/my/theme_dir"
|
||||
```
|
||||
|
||||
## Session Management
|
||||
|
||||
### `session_serialization`
|
||||
Enables or disables Zellij session serialization.
|
||||
|
||||
**Type:** Boolean
|
||||
**Default:** true
|
||||
|
||||
```kdl
|
||||
session_serialization true
|
||||
session_serialization false
|
||||
```
|
||||
|
||||
### `pane_viewport_serialization`
|
||||
When session serialization is enabled, allows serializing the pane viewport (visible terminal content).
|
||||
|
||||
**Type:** Boolean
|
||||
**Default:** false
|
||||
|
||||
```kdl
|
||||
pane_viewport_serialization true
|
||||
```
|
||||
|
||||
### `scrollback_lines_to_serialize`
|
||||
Number of scrollback lines to serialize when pane viewport serialization is enabled. Setting to 0 serializes all scrollback.
|
||||
|
||||
**Type:** Integer
|
||||
**Default:** 1000
|
||||
|
||||
```kdl
|
||||
scrollback_lines_to_serialize 0
|
||||
scrollback_lines_to_serialize 500
|
||||
```
|
||||
|
||||
## UI Configuration
|
||||
|
||||
### `ui` block
|
||||
Contains UI-related settings.
|
||||
|
||||
#### `pane_frames`
|
||||
Controls pane frame display settings.
|
||||
|
||||
##### `rounded_corners`
|
||||
Determines whether pane frames should have rounded corners.
|
||||
|
||||
**Type:** Boolean
|
||||
**Default:** true
|
||||
|
||||
```kdl
|
||||
ui {
|
||||
pane_frames {
|
||||
rounded_corners true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Mouse Configuration
|
||||
|
||||
### `mouse_mode`
|
||||
Sets handling of mouse events.
|
||||
|
||||
**Type:** Boolean
|
||||
**Default:** true
|
||||
|
||||
```kdl
|
||||
mouse_mode true
|
||||
mouse_mode false
|
||||
```
|
||||
|
||||
### `copy_on_select`
|
||||
Automatically copy text when selecting.
|
||||
|
||||
**Type:** Boolean
|
||||
**Default:** false
|
||||
|
||||
```kdl
|
||||
copy_on_select true
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
### `env` block
|
||||
Defines environment variables to be set for each terminal pane.
|
||||
|
||||
**Type:** Map of String to String/Integer
|
||||
|
||||
```kdl
|
||||
env {
|
||||
RUST_BACKTRACE 1
|
||||
EDITOR "nvim"
|
||||
FOO "bar"
|
||||
PATH "/usr/local/bin:/usr/bin"
|
||||
}
|
||||
```
|
||||
|
||||
## Plugin Configuration
|
||||
|
||||
### `load_plugins` block
|
||||
Plugins to load automatically when session starts.
|
||||
|
||||
**Type:** List of URLs or aliases
|
||||
|
||||
```kdl
|
||||
load_plugins {
|
||||
https://example.com/plugin.wasm
|
||||
file:/path/to/local/plugin.wasm
|
||||
plugin-alias
|
||||
}
|
||||
```
|
||||
|
||||
### `plugins` block
|
||||
Plugin aliases with optional configurations.
|
||||
|
||||
**Type:** Plugin configuration map
|
||||
|
||||
```kdl
|
||||
plugins {
|
||||
tab-bar location="zellij:tab-bar"
|
||||
status-bar location="zellij:status-bar"
|
||||
custom-plugin location="file:/path/to/plugin.wasm" {
|
||||
option1 "value1"
|
||||
option2 42
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Web Server Configuration
|
||||
|
||||
### `web_server`
|
||||
Enable/disable web server startup.
|
||||
|
||||
**Type:** Boolean
|
||||
**Default:** false
|
||||
|
||||
```kdl
|
||||
web_server true
|
||||
```
|
||||
|
||||
### `web_server_ip`
|
||||
IP address for web server to listen on.
|
||||
|
||||
**Type:** String
|
||||
**Default:** "127.0.0.1"
|
||||
|
||||
```kdl
|
||||
web_server_ip "0.0.0.0"
|
||||
```
|
||||
|
||||
### `web_server_port`
|
||||
Port for web server to listen on.
|
||||
|
||||
**Type:** Integer
|
||||
**Default:** 8082
|
||||
|
||||
```kdl
|
||||
web_server_port 443
|
||||
web_server_port 8083
|
||||
```
|
||||
|
||||
### `web_server_cert`
|
||||
Path to SSL certificate for HTTPS.
|
||||
|
||||
**Type:** String
|
||||
**Default:** None
|
||||
|
||||
```kdl
|
||||
web_server_cert "/path/to/cert.pem"
|
||||
```
|
||||
|
||||
### `web_server_key`
|
||||
Path to SSL private key for HTTPS.
|
||||
|
||||
**Type:** String
|
||||
**Default:** None
|
||||
|
||||
```kdl
|
||||
web_server_key "/path/to/key.pem"
|
||||
```
|
||||
|
||||
### `enforce_https_on_localhost`
|
||||
Enforce HTTPS certificate requirement even on localhost.
|
||||
|
||||
**Type:** Boolean
|
||||
**Default:** false
|
||||
|
||||
```kdl
|
||||
enforce_https_on_localhost true
|
||||
```
|
||||
|
||||
## Web Client Configuration
|
||||
|
||||
### `web_client` block
|
||||
Settings for browser-based terminal client.
|
||||
|
||||
#### `font`
|
||||
Font for web client terminal.
|
||||
|
||||
**Type:** String
|
||||
**Default:** "monospace"
|
||||
|
||||
```kdl
|
||||
web_client {
|
||||
font "Iosevka Term"
|
||||
}
|
||||
```
|
||||
|
||||
#### `cursor_blink`
|
||||
Enable cursor blinking.
|
||||
|
||||
**Type:** Boolean
|
||||
**Default:** false
|
||||
|
||||
```kdl
|
||||
web_client {
|
||||
cursor_blink true
|
||||
}
|
||||
```
|
||||
|
||||
#### `cursor_style`
|
||||
Cursor style.
|
||||
|
||||
**Type:** String
|
||||
**Values:** "block", "bar", "underline"
|
||||
**Default:** "block"
|
||||
|
||||
```kdl
|
||||
web_client {
|
||||
cursor_style "underline"
|
||||
}
|
||||
```
|
||||
|
||||
#### `cursor_inactive_style`
|
||||
Inactive cursor style.
|
||||
|
||||
**Type:** String
|
||||
**Values:** "outline", "block", "bar", "underline"
|
||||
**Default:** "block"
|
||||
|
||||
```kdl
|
||||
web_client {
|
||||
cursor_inactive_style "outline"
|
||||
}
|
||||
```
|
||||
|
||||
#### `mac_option_is_meta`
|
||||
Treat Option key as Meta on macOS.
|
||||
|
||||
**Type:** Boolean
|
||||
**Default:** true
|
||||
|
||||
```kdl
|
||||
web_client {
|
||||
mac_option_is_meta false
|
||||
}
|
||||
```
|
||||
|
||||
#### `theme` block
|
||||
Web client terminal theme (separate from Zellij theme).
|
||||
|
||||
**Type:** Color definitions in RGB format
|
||||
|
||||
```kdl
|
||||
web_client {
|
||||
theme {
|
||||
background 10 20 30
|
||||
foreground 248 248 242
|
||||
// ... more colors
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Multiplayer Configuration
|
||||
|
||||
### `multiplayer_user_colors`
|
||||
Colors for users in multiplayer sessions.
|
||||
|
||||
**Type:** Map of player numbers to RGB values
|
||||
|
||||
```kdl
|
||||
multiplayer_user_colors {
|
||||
player_1 255 0 255
|
||||
player_2 0 217 227
|
||||
// ... up to player_10
|
||||
}
|
||||
```
|
||||
|
||||
## Auto Layout Configuration
|
||||
|
||||
### `auto_layout`
|
||||
Controls automatic pane arrangement.
|
||||
|
||||
**Type:** Boolean
|
||||
**Default:** true
|
||||
|
||||
```kdl
|
||||
auto_layout true
|
||||
```
|
||||
|
||||
## Command Line Options
|
||||
|
||||
All configuration options can be overridden via command line:
|
||||
|
||||
```bash
|
||||
# Override theme
|
||||
zellij --theme nord
|
||||
|
||||
# Override layout
|
||||
zellij --layout development
|
||||
|
||||
# Override config file
|
||||
zellij --config /custom/path/config.kdl
|
||||
|
||||
# Override default mode
|
||||
zellij --default-mode locked
|
||||
|
||||
# Set session name
|
||||
zellij --session-name my-workspace
|
||||
|
||||
# Disable mouse
|
||||
zellij --disable-mouse-mode
|
||||
|
||||
# Set custom shell
|
||||
zellij --default-shell fish
|
||||
```
|
||||
|
||||
## Configuration Validation
|
||||
|
||||
Use built-in validation:
|
||||
|
||||
```bash
|
||||
# Check configuration syntax
|
||||
zellij setup --check
|
||||
|
||||
# Dump default configuration
|
||||
zellij setup --dump-config
|
||||
|
||||
# Dump default layout
|
||||
zellij setup --dump-layout default
|
||||
```
|
||||
|
||||
## File Locations
|
||||
|
||||
- **Config Directory:** `~/.config/zellij/`
|
||||
- **Layouts Directory:** `~/.config/zellij/layouts/`
|
||||
- **Themes Directory:** `~/.config/zellij/themes/`
|
||||
- **Default Config:** `~/.config/zellij/config.kdl`
|
||||
|
||||
## Migration from YAML
|
||||
|
||||
Convert legacy YAML configuration:
|
||||
|
||||
```bash
|
||||
# Convert config
|
||||
zellij convert-config /path/to/config.yaml > /path/to/config.kdl
|
||||
|
||||
# Convert theme
|
||||
zellij convert-theme /path/to/theme.yaml > /path/to/theme.kdl
|
||||
|
||||
# Convert layout
|
||||
zellij convert-layout /path/to/layout.yaml > /path/to/layout.kdl
|
||||
```
|
||||
411
skills/zellij-config/references/layout_examples.md
Normal file
411
skills/zellij-config/references/layout_examples.md
Normal file
@@ -0,0 +1,411 @@
|
||||
# Zellij Layout Examples
|
||||
|
||||
Collection of layout templates for different use cases and workflows.
|
||||
|
||||
## Basic Layouts
|
||||
|
||||
### Single Terminal
|
||||
Simple terminal with full screen:
|
||||
|
||||
```kdl
|
||||
layout {
|
||||
pane command="bash"
|
||||
}
|
||||
```
|
||||
|
||||
### Two Pane Horizontal
|
||||
Two panes side by side:
|
||||
|
||||
```kdl
|
||||
layout {
|
||||
pane split_direction="horizontal" {
|
||||
pane size="50%" command="bash"
|
||||
pane size="50%" command="bash"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Two Pane Vertical
|
||||
Two panes stacked vertically:
|
||||
|
||||
```kdl
|
||||
layout {
|
||||
pane split_direction="vertical" {
|
||||
pane size="50%" command="bash"
|
||||
pane size="50%" command="bash"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Development Layouts
|
||||
|
||||
### Development Workspace
|
||||
Editor with git and terminal panes:
|
||||
|
||||
```kdl
|
||||
layout {
|
||||
default_tab_template {
|
||||
pane size=1 borderless=true {
|
||||
plugin location="zellij:tab-bar"
|
||||
}
|
||||
children
|
||||
pane size=2 borderless=true {
|
||||
plugin location="zellij:status-bar"
|
||||
}
|
||||
}
|
||||
tab name="code" cwd="~/project" focus=true {
|
||||
pane command="nvim" size="80%"
|
||||
pane size="20%" split_direction="vertical" {
|
||||
pane command="git" {
|
||||
args "status"
|
||||
size="50%"
|
||||
}
|
||||
pane command="htop"
|
||||
}
|
||||
}
|
||||
tab name="terminal" {
|
||||
pane command="bash"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Full Development Setup
|
||||
Complete development environment with monitoring:
|
||||
|
||||
```kdl
|
||||
layout {
|
||||
default_tab_template {
|
||||
pane size=1 borderless=true {
|
||||
plugin location="zellij:tab-bar"
|
||||
}
|
||||
children
|
||||
pane size=2 borderless=true {
|
||||
plugin location="zellij:status-bar"
|
||||
}
|
||||
}
|
||||
tab name="editor" cwd="~/project" focus=true {
|
||||
pane command="nvim" size="70%"
|
||||
pane split_direction="horizontal" {
|
||||
pane size="50%" split_direction="vertical" {
|
||||
pane command="git" {
|
||||
args "status"
|
||||
cwd "~/project"
|
||||
}
|
||||
pane command="cargo" {
|
||||
args "test"
|
||||
cwd "~/project"
|
||||
}
|
||||
}
|
||||
pane command="htop"
|
||||
}
|
||||
}
|
||||
tab name="server" cwd="~/server" {
|
||||
pane command="nvim" size="60%"
|
||||
pane split_direction="vertical" {
|
||||
pane command="tail" {
|
||||
args "-f" "log/production.log"
|
||||
cwd "~/server"
|
||||
size="40%"
|
||||
}
|
||||
pane command="btop" size="40%"
|
||||
}
|
||||
}
|
||||
tab name="database" {
|
||||
pane command="psql" {
|
||||
args "-U" "postgres"
|
||||
cwd "~/server"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Monitoring Layouts
|
||||
|
||||
### System Monitoring
|
||||
Multiple monitoring tools:
|
||||
|
||||
```kdl
|
||||
layout {
|
||||
tab name="monitoring" split_direction="horizontal" {
|
||||
pane command="htop"
|
||||
pane command="btop"
|
||||
pane command="iotop"
|
||||
pane command="nethogs"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Resource Monitoring
|
||||
CPU, memory, disk, and network monitoring:
|
||||
|
||||
```kdl
|
||||
layout {
|
||||
tab name="resources" split_direction="horizontal" {
|
||||
pane split_direction="vertical" {
|
||||
pane command="htop"
|
||||
pane command="df" "-h"
|
||||
}
|
||||
pane split_direction="vertical" {
|
||||
pane command="btop"
|
||||
pane command="iotop"
|
||||
}
|
||||
pane command="nethogs"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Log Monitoring
|
||||
Monitor multiple log files:
|
||||
|
||||
```kdl
|
||||
layout {
|
||||
tab name="logs" split_direction="horizontal" {
|
||||
pane command="tail" {
|
||||
args "-f" "/var/log/syslog"
|
||||
}
|
||||
pane command="tail" {
|
||||
args "-f" "/var/log/nginx/access.log"
|
||||
}
|
||||
pane command="journalctl" {
|
||||
args "-f"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Tab Templates
|
||||
|
||||
### Default Tab Template with Plugins
|
||||
Standard tab bar and status bar:
|
||||
|
||||
```kdl
|
||||
layout {
|
||||
default_tab_template {
|
||||
pane size=1 borderless=true {
|
||||
plugin location="zellij:tab-bar"
|
||||
}
|
||||
children
|
||||
pane size=2 borderless=true {
|
||||
plugin location="zellij:status-bar"
|
||||
}
|
||||
}
|
||||
// All tabs will use this template unless overridden
|
||||
}
|
||||
```
|
||||
|
||||
### Compact Tab Template
|
||||
Minimal UI with compact bar:
|
||||
|
||||
```kdl
|
||||
layout {
|
||||
default_tab_template {
|
||||
pane size=1 borderless=true {
|
||||
plugin location="zellij:compact-bar"
|
||||
}
|
||||
children
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Floating Layouts
|
||||
|
||||
### Swap Floating Layout
|
||||
Different arrangements based on pane count:
|
||||
|
||||
```kdl
|
||||
layout {
|
||||
swap_floating_layout {
|
||||
floating_panes max_panes=1 {
|
||||
pane x="25%" y="25%" width="50%" height="50%"
|
||||
}
|
||||
floating_panes max_panes=2 {
|
||||
pane x="10%" y="25%" width="35%" height="50%"
|
||||
pane x="55%" y="25%" width="35%" height="50%"
|
||||
}
|
||||
floating_panes max_panes=3 {
|
||||
pane x="0%" y="0%" width="33%" height="50%"
|
||||
pane x="33%" y="0%" width="33%" height="50%"
|
||||
pane x="66%" y="0%" width="33%" height="50%"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Specific Floating Layout
|
||||
Predefined floating pane positions:
|
||||
|
||||
```kdl
|
||||
layout {
|
||||
pane {
|
||||
x="10%"
|
||||
y="20%"
|
||||
width="80%"
|
||||
height="60%"
|
||||
focus=true
|
||||
command="nvim"
|
||||
}
|
||||
pane {
|
||||
x="15%"
|
||||
y="70%"
|
||||
width="70%"
|
||||
height="25%"
|
||||
command="htop"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Advanced Layouts
|
||||
|
||||
### Multi-Project Setup
|
||||
Work on multiple projects simultaneously:
|
||||
|
||||
```kdl
|
||||
layout {
|
||||
tab name="frontend" cwd="~/projects/frontend" {
|
||||
pane command="npm" {
|
||||
args "start"
|
||||
cwd "~/projects/frontend"
|
||||
}
|
||||
pane command="nvim" {
|
||||
cwd "~/projects/frontend"
|
||||
}
|
||||
}
|
||||
tab name="backend" cwd="~/projects/backend" {
|
||||
pane command="npm" {
|
||||
args "start"
|
||||
cwd "~/projects/backend"
|
||||
}
|
||||
pane command="nvim" {
|
||||
cwd "~/projects/backend"
|
||||
}
|
||||
}
|
||||
tab name="docs" cwd="~/projects/docs" {
|
||||
pane command="mkdocs" {
|
||||
args "serve"
|
||||
cwd "~/projects/docs"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Database Layout
|
||||
Development with database management:
|
||||
|
||||
```kdl
|
||||
layout {
|
||||
tab name="app" cwd="~/project" {
|
||||
pane command="npm" {
|
||||
args "start"
|
||||
size="60%"
|
||||
}
|
||||
pane split_direction="vertical" {
|
||||
pane command="nvim" {
|
||||
size="40%"
|
||||
}
|
||||
pane command="psql" {
|
||||
args "-U" "postgres"
|
||||
size="60%"
|
||||
}
|
||||
}
|
||||
}
|
||||
tab name="database-tools" {
|
||||
pane command="pgadmin" {
|
||||
size="50%"
|
||||
}
|
||||
pane command="dbeaver" {
|
||||
size="50%"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Special Purpose Layouts
|
||||
|
||||
### Git Workflow
|
||||
Git operations with diff viewer:
|
||||
|
||||
```kdl
|
||||
layout {
|
||||
tab name="git" cwd="~/project" {
|
||||
pane command="git" {
|
||||
args "status"
|
||||
size="30%"
|
||||
}
|
||||
pane command="git" {
|
||||
args "log" "--oneline" "-10"
|
||||
size="30%"
|
||||
}
|
||||
pane split_direction="horizontal" {
|
||||
pane command="git" {
|
||||
args "diff" "--cached"
|
||||
size="40%"
|
||||
}
|
||||
pane command="git" {
|
||||
args "diff" "--cached" "HEAD~1"
|
||||
size="40%"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Container Development
|
||||
Docker and development tools:
|
||||
|
||||
```kdl
|
||||
layout {
|
||||
tab name="containers" {
|
||||
pane command="docker" {
|
||||
args "ps"
|
||||
size="40%"
|
||||
}
|
||||
pane command="docker-compose" {
|
||||
args "ps"
|
||||
size="30%"
|
||||
}
|
||||
pane split_direction="vertical" {
|
||||
pane command="docker" {
|
||||
args "stats"
|
||||
size="50%"
|
||||
}
|
||||
pane command="lazydocker"
|
||||
size="50%"
|
||||
}
|
||||
}
|
||||
}
|
||||
tab name="k8s" {
|
||||
pane command="kubectl" {
|
||||
args "get" "pods" "--watch"
|
||||
size="50%"
|
||||
}
|
||||
pane command="k9s" {
|
||||
size="50%"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Layout Tips
|
||||
|
||||
### Size Specifications
|
||||
- **Fixed sizes:** `size=10` (exact lines/columns)
|
||||
- **Percentage sizes:** `size="50%"` (relative to container)
|
||||
- **Mixed sizing:** Use fixed and percentage as needed
|
||||
|
||||
### Split Directions
|
||||
- **Vertical:** `split_direction="vertical"` (stack top to bottom)
|
||||
- **Horizontal:** `split_direction="horizontal"` (side by side)
|
||||
|
||||
### Common Patterns
|
||||
1. **Focus on startup:** Add `focus=true` to important panes
|
||||
2. **Set working directories:** Use `cwd="/path"` for project-specific panes
|
||||
3. **Naming:** Use descriptive tab names for organization
|
||||
4. **Templates:** Use `default_tab_template` for consistent UI
|
||||
5. **Plugins:** Integrate tab-bar and status-bar for better UX
|
||||
|
||||
### Best Practices
|
||||
- Keep layouts readable with proper indentation
|
||||
- Use consistent naming conventions
|
||||
- Test layouts before deploying
|
||||
- Document custom layouts for team sharing
|
||||
- Consider different screen sizes when designing layouts
|
||||
399
skills/zellij-config/references/theme_examples.md
Normal file
399
skills/zellij-config/references/theme_examples.md
Normal file
@@ -0,0 +1,399 @@
|
||||
# Zellij Theme Examples
|
||||
|
||||
Collection of custom themes and theme creation guidelines.
|
||||
|
||||
## Built-in Themes
|
||||
|
||||
### Default Theme
|
||||
Standard light theme:
|
||||
|
||||
```kdl
|
||||
theme "default"
|
||||
```
|
||||
|
||||
### Nord Theme
|
||||
Popular dark theme based on Nordic colors:
|
||||
|
||||
```kdl
|
||||
themes {
|
||||
nord {
|
||||
fg "#D8DEE9"
|
||||
bg "#2E3440"
|
||||
black "#3B4252"
|
||||
red "#BF616A"
|
||||
green "#A3BE8C"
|
||||
yellow "#EBCB8B"
|
||||
blue "#81A1C1"
|
||||
magenta "#B48EAD"
|
||||
cyan "#88C0D0"
|
||||
white "#E5E9F0"
|
||||
orange "#D08770"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Dracula Theme
|
||||
Popular dark theme:
|
||||
|
||||
```kdl
|
||||
themes {
|
||||
dracula {
|
||||
fg 248 248 242
|
||||
bg 40 42 54
|
||||
black 0 0 0
|
||||
red 255 85 85
|
||||
green 80 250 123
|
||||
yellow 241 250 140
|
||||
blue 98 114 164
|
||||
magenta 255 121 198
|
||||
cyan 139 233 253
|
||||
white 255 255 255
|
||||
orange 255 184 108
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Custom Themes
|
||||
|
||||
### Custom RGB Theme
|
||||
Theme using RGB color values:
|
||||
|
||||
```kdl
|
||||
themes {
|
||||
my_custom_theme {
|
||||
fg 200 200 200
|
||||
bg 30 30 30
|
||||
black 40 40 40
|
||||
red 255 100 100
|
||||
green 100 255 100
|
||||
yellow 255 255 100
|
||||
blue 100 100 255
|
||||
magenta 255 100 255
|
||||
cyan 100 255 255
|
||||
white 255 255 255
|
||||
orange 255 200 100
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Custom Hex Theme
|
||||
Theme using hexadecimal color codes:
|
||||
|
||||
```kdl
|
||||
themes {
|
||||
cyberpunk {
|
||||
fg "#00ff00"
|
||||
bg "#0a0a0a"
|
||||
black "#1a1a1a"
|
||||
red "#ff0000"
|
||||
green "#00ff00"
|
||||
yellow "#ffff00"
|
||||
blue "#0080ff"
|
||||
magenta "#ff00ff"
|
||||
cyan "#00ffff"
|
||||
white "#ffffff"
|
||||
orange "#ff8000"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Solarized Dark
|
||||
Classic solarized color scheme:
|
||||
|
||||
```kdl
|
||||
themes {
|
||||
solarized_dark {
|
||||
fg "#839496"
|
||||
bg "#002b36"
|
||||
black "#073642"
|
||||
red "#dc322f"
|
||||
green "#859900"
|
||||
yellow "#b58900"
|
||||
blue "#268bd2"
|
||||
magenta "#d33682"
|
||||
cyan "#2aa198"
|
||||
white "#eee8d5"
|
||||
orange "#cb4b16"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Gruvbox Dark
|
||||
Popular dark theme for developers:
|
||||
|
||||
```kdl
|
||||
themes {
|
||||
gruvbox_dark {
|
||||
fg "#ebdbb2"
|
||||
bg "#282828"
|
||||
black "#1d2021"
|
||||
red "#cc241d"
|
||||
green "#98971a"
|
||||
yellow "#d79921"
|
||||
blue "#83a598"
|
||||
magenta "#d3869b"
|
||||
cyan "#8ec07c"
|
||||
white "#ebdbb2"
|
||||
orange "#fe8019"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Monokai
|
||||
Clean, minimal dark theme:
|
||||
|
||||
```kdl
|
||||
themes {
|
||||
monokai {
|
||||
fg "#ffffff"
|
||||
bg "#272822"
|
||||
black "#272822"
|
||||
red "#ff5555"
|
||||
green "#50fa7b"
|
||||
yellow "#f1fa8c"
|
||||
blue "#8be9fd"
|
||||
magenta "#bd93f9"
|
||||
cyan "#8fa8c0"
|
||||
white "#f8f8f2"
|
||||
orange "#ff6b6b"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Tokyo Night
|
||||
Modern dark theme with blue tones:
|
||||
|
||||
```kdl
|
||||
themes {
|
||||
tokyo_night {
|
||||
fg "#c0caf5"
|
||||
bg "#1a1b26"
|
||||
black "#393939"
|
||||
red "#f7768e"
|
||||
green "#9ece6a"
|
||||
yellow "#e0af68"
|
||||
blue "#7aa2f7"
|
||||
magenta "#bb9af7"
|
||||
cyan "#89dceb"
|
||||
white "#d9d7d8"
|
||||
orange "#e06c75"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Theme Component Colors
|
||||
|
||||
### Ribbon UI Colors
|
||||
Some themes support detailed ribbon component colors:
|
||||
|
||||
```kdl
|
||||
themes {
|
||||
detailed_theme {
|
||||
ribbon_unselected {
|
||||
base 10 10 10
|
||||
background 50 50 50
|
||||
emphasis_0 200 200 200
|
||||
emphasis_1 220 220 220
|
||||
emphasis_2 240 240 240
|
||||
emphasis_3 255 255 255
|
||||
}
|
||||
ribbon_selected {
|
||||
base 20 20 20
|
||||
background 60 60 60
|
||||
emphasis_0 210 210 210
|
||||
emphasis_1 230 230 230
|
||||
emphasis_2 250 250 250
|
||||
emphasis_3 255 255 255
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Multiplayer Colors
|
||||
Configure colors for multiplayer sessions:
|
||||
|
||||
```kdl
|
||||
multiplayer_user_colors {
|
||||
player_1 255 0 255 // Magenta
|
||||
player_2 0 255 255 // Blue
|
||||
player_3 0 0 0 // Black
|
||||
player_4 255 255 0 // Red
|
||||
player_5 0 255 0 // Black
|
||||
player_6 255 255 255 // White
|
||||
player_7 255 0 255 // Magenta
|
||||
player_8 0 255 0 // Black
|
||||
player_9 0 200 0 // Green
|
||||
player_10 0 0 255 // Blue
|
||||
}
|
||||
```
|
||||
|
||||
## Theme Creation Guidelines
|
||||
|
||||
### Color Format Options
|
||||
|
||||
#### RGB Format
|
||||
Use three space-separated values (0-255):
|
||||
|
||||
```kdl
|
||||
color_name 200 150 100 // R=200, G=150, B=100
|
||||
```
|
||||
|
||||
#### Hexadecimal Format
|
||||
Use standard hex color codes with # prefix:
|
||||
|
||||
```kdl
|
||||
color_name "#ff6b6b" // Orange-red
|
||||
```
|
||||
|
||||
#### Mixed Format
|
||||
You can mix formats in the same theme:
|
||||
|
||||
```kdl
|
||||
themes {
|
||||
mixed_theme {
|
||||
fg "#ffffff" // Hex for foreground
|
||||
bg 40 42 54 // RGB for background
|
||||
red "#cc241d" // Hex for accent
|
||||
green 80 250 123 // RGB for success
|
||||
yellow 241 250 140 // RGB for warning
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Theme Design Best Practices
|
||||
|
||||
1. **Contrast is Key**
|
||||
- Ensure text remains readable against background
|
||||
- Test with different terminal profiles
|
||||
- Consider accessibility (WCAG contrast ratios)
|
||||
|
||||
2. **Consistent Color Palette**
|
||||
- Limit to 8-12 colors for consistency
|
||||
- Use semantic naming (success, warning, error, etc.)
|
||||
- Maintain harmony across color choices
|
||||
|
||||
3. **Test Across Applications**
|
||||
- Verify colors work in nvim, vim, tmux, etc.
|
||||
- Test with syntax highlighting themes
|
||||
- Check compatibility with common tools
|
||||
|
||||
4. **Consider Environment**
|
||||
- Account for different lighting conditions
|
||||
- Support both dark and light variants
|
||||
- Provide high contrast options
|
||||
|
||||
### Common Color Values
|
||||
|
||||
#### Standard Colors
|
||||
```kdl
|
||||
// Pure colors
|
||||
black 0 0 0 // #000000
|
||||
white 255 255 255 // #ffffff
|
||||
red 255 0 0 // #ff0000
|
||||
green 0 255 0 // #00ff00
|
||||
blue 0 0 255 // #0000ff
|
||||
yellow 255 255 0 // #ffff00
|
||||
magenta 255 0 255 // #ff00ff
|
||||
cyan 0 255 255 // #00ffff
|
||||
```
|
||||
|
||||
#### Gray Scale
|
||||
```kdl
|
||||
// Gray variations
|
||||
gray_25 25 25 25
|
||||
gray_50 50 50 50
|
||||
gray_75 75 75 75
|
||||
gray_100 100 100 100
|
||||
gray_125 125 125 125
|
||||
gray_150 150 150 150
|
||||
gray_175 175 175 175
|
||||
gray_200 200 200 200
|
||||
```
|
||||
|
||||
#### Popular Theme Colors
|
||||
```kdl
|
||||
// Nord theme palette
|
||||
nord_frost "#D8DEE9" // Light blue
|
||||
nord_snow "#E5E9F0" // Pure white
|
||||
nord_polar "#2E3440" // Dark blue-gray
|
||||
nord_night "#3B4252" // Dark gray-blue
|
||||
nord_aurora "#88C0D0" // Cyan
|
||||
|
||||
// Dracula theme palette
|
||||
dracula_bg "#282a36" // Dark purple
|
||||
dracula_fg "#f8f8f2" // Light gray
|
||||
dracula_pink "#ff79c6" // Bright pink
|
||||
dracula_cyan "#8be9fd" // Bright cyan
|
||||
dracula_green "#50fa7b" // Bright green
|
||||
dracula_orange "#ffb86c" // Bright orange
|
||||
```
|
||||
|
||||
## Theme Testing
|
||||
|
||||
### Validate Theme Colors
|
||||
Check theme works properly:
|
||||
|
||||
```bash
|
||||
# Test theme in new session
|
||||
zellij --theme your_theme --session-name test-theme
|
||||
|
||||
# Keep session open for inspection
|
||||
```
|
||||
|
||||
### Preview Multiple Themes
|
||||
Quickly switch between themes for testing:
|
||||
|
||||
```bash
|
||||
# Test multiple themes
|
||||
for theme in nord dracula tokyo_night; do
|
||||
zellij --theme "$theme" --session-name "test-$theme"
|
||||
echo "Theme $theme ready for testing"
|
||||
done
|
||||
```
|
||||
|
||||
### Create Theme Variants
|
||||
Generate light/dark variants of base theme:
|
||||
|
||||
```kdl
|
||||
themes {
|
||||
my_theme_dark {
|
||||
fg "#e0e0e0"
|
||||
bg "#000000"
|
||||
// ... other colors
|
||||
}
|
||||
my_theme_light {
|
||||
fg "#000000"
|
||||
bg "#ffffff"
|
||||
// ... other colors (inverted/light versions)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Integration with Editors
|
||||
|
||||
### Vim Integration
|
||||
Theme compatibility with vim color schemes:
|
||||
|
||||
```kdl
|
||||
themes {
|
||||
vim_compatible {
|
||||
// Use colors that match popular vim themes
|
||||
fg "#abb2bf" // Similar to 'morning' vim theme
|
||||
bg "#1a1b26" // Similar to 'morning' vim theme background
|
||||
// Match other colors accordingly
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Neovim Integration
|
||||
Modern editor theme compatibility:
|
||||
|
||||
```kdl
|
||||
themes {
|
||||
nvim_compatible {
|
||||
fg "#b0e1e6" // Similar to 'tokyonight' nvim theme
|
||||
bg "#16161d" // Similar to 'tokyonight' nvim theme background
|
||||
// Match other accent colors
|
||||
}
|
||||
}
|
||||
```
|
||||
194
skills/zellij-config/scripts/convert_themes.py
Normal file
194
skills/zellij-config/scripts/convert_themes.py
Normal file
@@ -0,0 +1,194 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Zellij Theme Converter - Convert themes between formats and create custom themes
|
||||
|
||||
Usage:
|
||||
convert_themes.py [COMMAND] [OPTIONS]
|
||||
|
||||
Commands:
|
||||
create - Create a new custom theme
|
||||
convert - Convert legacy YAML theme to KDL
|
||||
list - List available theme templates
|
||||
|
||||
Examples:
|
||||
convert_themes.py create --name mytheme --rgb
|
||||
convert_themes.py convert /path/to/theme.yaml
|
||||
convert_themes.py list
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
THEME_TEMPLATES = {
|
||||
"nord": {
|
||||
"fg": "#D8DEE9",
|
||||
"bg": "#2E3440",
|
||||
"black": "#3B4252",
|
||||
"red": "#BF616A",
|
||||
"green": "#A3BE8C",
|
||||
"yellow": "#EBCB8B",
|
||||
"blue": "#81A1C1",
|
||||
"magenta": "#B48EAD",
|
||||
"cyan": "#88C0D0",
|
||||
"white": "#E5E9F0",
|
||||
"orange": "#D08770"
|
||||
},
|
||||
"dracula": {
|
||||
"fg": "248 248 242",
|
||||
"bg": "40 42 54",
|
||||
"black": "0 0 0",
|
||||
"red": "255 85 85",
|
||||
"green": "80 250 123",
|
||||
"yellow": "241 250 140",
|
||||
"blue": "98 114 164",
|
||||
"magenta": "255 121 198",
|
||||
"cyan": "139 233 253",
|
||||
"white": "255 255 255",
|
||||
"orange": "255 184 108"
|
||||
},
|
||||
"gruvbox-dark": {
|
||||
"fg": "#ebdbb2",
|
||||
"bg": "#282828",
|
||||
"black": "#1d2021",
|
||||
"red": "#cc241d",
|
||||
"green": "#98971a",
|
||||
"yellow": "#d79921",
|
||||
"blue": "#83a598",
|
||||
"magenta": "#d3869b",
|
||||
"cyan": "#8ec07c",
|
||||
"white": "#ebdbb2",
|
||||
"orange": "#fe8019"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def create_theme(name, use_rgb=True):
|
||||
"""Create a new custom theme interactively."""
|
||||
theme_data = {}
|
||||
|
||||
print(f"🎨 Creating theme: {name}")
|
||||
print("Enter theme colors (press Enter for defaults):")
|
||||
|
||||
colors = ["fg", "bg", "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "orange"]
|
||||
|
||||
for color in colors:
|
||||
if use_rgb:
|
||||
print(f"{color} (RGB format: r g b):")
|
||||
value = input(f" {color}: ").strip()
|
||||
if value:
|
||||
# Parse RGB values
|
||||
parts = value.split()
|
||||
if len(parts) == 3 and all(p.isdigit() for p in parts):
|
||||
theme_data[color] = f"{parts[0]} {parts[1]} {parts[2]}"
|
||||
else:
|
||||
print(f" Using default {color}")
|
||||
else:
|
||||
print(f"{color} (hex format: #RRGGBB):")
|
||||
value = input(f" {color}: ").strip()
|
||||
if value:
|
||||
theme_data[color] = value
|
||||
|
||||
return theme_data
|
||||
|
||||
|
||||
def generate_kdl_theme(name, theme_data, output_path):
|
||||
"""Generate KDL format theme file."""
|
||||
content = f"themes {{\n {name} {{\n"
|
||||
|
||||
for color, value in theme_data.items():
|
||||
content += f' {color} {value}\n'
|
||||
|
||||
content += " }}\n}}\n"
|
||||
|
||||
try:
|
||||
with open(output_path, 'w') as f:
|
||||
f.write(content)
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"❌ Error writing theme file: {e}")
|
||||
return False
|
||||
|
||||
|
||||
def convert_yaml_to_kdl(yaml_path):
|
||||
"""Convert legacy YAML theme to KDL format."""
|
||||
try:
|
||||
import yaml
|
||||
with open(yaml_path, 'r') as f:
|
||||
theme_data = yaml.safe_load(f)
|
||||
|
||||
if not theme_data:
|
||||
print("❌ No theme data found in YAML file")
|
||||
return False
|
||||
|
||||
# Extract theme name from filename
|
||||
theme_name = Path(yaml_path).stem
|
||||
output_path = Path(yaml_path).with_suffix('.kdl')
|
||||
|
||||
return generate_kdl_theme(theme_name, theme_data, output_path)
|
||||
except ImportError:
|
||||
print("❌ PyYAML not installed. Install with: pip install pyyaml")
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f"❌ Error converting YAML theme: {e}")
|
||||
return False
|
||||
|
||||
|
||||
def list_templates():
|
||||
"""List available theme templates."""
|
||||
print("📋 Available theme templates:")
|
||||
for name, colors in THEME_TEMPLATES.items():
|
||||
print(f" {name}:")
|
||||
if isinstance(colors["fg"], str):
|
||||
print(f" Type: Hexadecimal")
|
||||
print(f" Preview: FG={colors['fg']}, BG={colors['bg']}")
|
||||
else:
|
||||
print(f" Type: RGB")
|
||||
print(f" Preview: FG=({colors['fg']}), BG=({colors['bg']})")
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Manage Zellij themes")
|
||||
subparsers = parser.add_subparsers(dest='command', help='Available commands')
|
||||
|
||||
# Create command
|
||||
create_parser = subparsers.add_parser('create', help='Create new custom theme')
|
||||
create_parser.add_argument('--name', required=True, help='Theme name')
|
||||
create_parser.add_argument('--hex', action='store_true', help='Use hexadecimal color format (default: RGB)')
|
||||
create_parser.add_argument('--output', help='Output file path (default: ~/.config/zellij/themes/name.kdl)')
|
||||
|
||||
# Convert command
|
||||
convert_parser = subparsers.add_parser('convert', help='Convert YAML theme to KDL')
|
||||
convert_parser.add_argument('yaml_path', help='Path to YAML theme file')
|
||||
|
||||
# List command
|
||||
list_parser = subparsers.add_parser('list', help='List theme templates')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.command == 'create':
|
||||
theme_data = create_theme(args.name, not args.hex)
|
||||
output_path = args.output or Path.home() / ".config" / "zellij" / "themes" / f"{args.name}.kdl"
|
||||
|
||||
if generate_kdl_theme(args.name, theme_data, output_path):
|
||||
print(f"✅ Theme created: {output_path}")
|
||||
else:
|
||||
sys.exit(1)
|
||||
|
||||
elif args.command == 'convert':
|
||||
if convert_yaml_to_kdl(args.yaml_path):
|
||||
print("✅ Theme conversion complete")
|
||||
else:
|
||||
sys.exit(1)
|
||||
|
||||
elif args.command == 'list':
|
||||
list_templates()
|
||||
|
||||
else:
|
||||
parser.print_help()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
178
skills/zellij-config/scripts/create_layout.py
Normal file
178
skills/zellij-config/scripts/create_layout.py
Normal file
@@ -0,0 +1,178 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Zellij Layout Creator - Generate custom layouts from templates or parameters
|
||||
|
||||
Usage:
|
||||
create_layout.py [LAYOUT_TYPE] [OPTIONS]
|
||||
|
||||
Layout Types:
|
||||
dev - Development layout with editor and git
|
||||
monitor - Monitoring layout with system metrics
|
||||
terminal - Simple terminal layout
|
||||
custom - Interactive custom layout creation
|
||||
|
||||
Examples:
|
||||
create_layout.py dev --name myproject
|
||||
create_layout.py monitor --theme nord
|
||||
create_layout.py terminal --horizontal-split 2
|
||||
create_layout.py custom --panes 3 --direction vertical
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
LAYOUT_TEMPLATES = {
|
||||
"dev": """layout {
|
||||
default_tab_template {{
|
||||
pane size=1 borderless=true {{
|
||||
plugin location="zellij:tab-bar"
|
||||
}}
|
||||
children
|
||||
pane size=2 borderless=true {{
|
||||
plugin location="zellij:status-bar"
|
||||
}}
|
||||
}}
|
||||
tab name="{name}" cwd="{cwd}" focus=true {{
|
||||
pane command="nvim" size="80%"
|
||||
pane size="20%" split_direction="vertical" {{
|
||||
pane command="git" {{
|
||||
args "status"
|
||||
size="50%"
|
||||
}}
|
||||
pane command="htop"
|
||||
}}
|
||||
}}
|
||||
tab name="terminal" {{
|
||||
pane command="bash"
|
||||
}}
|
||||
}}""",
|
||||
|
||||
"monitor": """layout {{
|
||||
default_tab_template {{
|
||||
pane size=1 borderless=true {{
|
||||
plugin location="zellij:tab-bar"
|
||||
}}
|
||||
children
|
||||
pane size=2 borderless=true {{
|
||||
plugin location="zellij:status-bar"
|
||||
}}
|
||||
}}
|
||||
tab name="monitoring" split_direction="horizontal" {{
|
||||
pane command="htop"
|
||||
pane command="btop"
|
||||
pane command="iotop"
|
||||
pane command="nethogs"
|
||||
}}
|
||||
}}""",
|
||||
|
||||
"terminal": """layout {{
|
||||
tab name="main" {{
|
||||
pane command="bash"{split}
|
||||
}}
|
||||
}}"""
|
||||
}
|
||||
|
||||
|
||||
def create_custom_layout(panes, direction, name):
|
||||
"""Create a custom layout with specified number of panes."""
|
||||
if direction == "horizontal":
|
||||
split_attr = 'split_direction="horizontal"'
|
||||
else:
|
||||
split_attr = 'split_direction="vertical"'
|
||||
|
||||
layout = f'''layout {{
|
||||
tab name="{name}" {{
|
||||
pane command="bash"
|
||||
{split_attr} {{
|
||||
'''
|
||||
|
||||
# Add panes
|
||||
for i in range(1, panes):
|
||||
if i == panes:
|
||||
layout += f' pane command="bash"\n'
|
||||
else:
|
||||
layout += f' pane command="bash"\n'
|
||||
|
||||
layout += f' }}\n }}\n}}'''
|
||||
|
||||
return layout
|
||||
|
||||
|
||||
def get_layout_path(layouts_dir, layout_name):
|
||||
"""Get full path for layout file."""
|
||||
return layouts_dir / f"{layout_name}.kdl"
|
||||
|
||||
|
||||
def write_layout_file(layout_path, content):
|
||||
"""Write layout content to file."""
|
||||
try:
|
||||
layout_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
with open(layout_path, 'w') as f:
|
||||
f.write(content)
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"❌ Error writing layout file: {e}")
|
||||
return False
|
||||
|
||||
|
||||
def get_layout_cwd():
|
||||
"""Get current working directory for layout."""
|
||||
return os.getcwd()
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Create Zellij layouts from templates")
|
||||
parser.add_argument("layout_type", choices=["dev", "monitor", "terminal", "custom"],
|
||||
help="Type of layout to create")
|
||||
parser.add_argument("--name", default="workspace",
|
||||
help="Name for the layout (default: workspace)")
|
||||
parser.add_argument("--cwd", help="Working directory for layout (default: current directory)")
|
||||
parser.add_argument("--theme", help="Theme to apply (e.g., nord, dracula)")
|
||||
|
||||
# Custom layout options
|
||||
parser.add_argument("--panes", type=int, default=2,
|
||||
help="Number of panes for custom layout (default: 2)")
|
||||
parser.add_argument("--direction", choices=["horizontal", "vertical"], default="horizontal",
|
||||
help="Split direction for custom layout (default: horizontal)")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# Determine layouts directory
|
||||
layouts_dir = Path.home() / ".config" / "zellij" / "layouts"
|
||||
|
||||
# Get layout name and cwd
|
||||
layout_name = args.name
|
||||
cwd = args.cwd or get_layout_cwd()
|
||||
|
||||
print(f"🚀 Creating {args.layout_type} layout...")
|
||||
|
||||
# Generate layout content
|
||||
if args.layout_type == "custom":
|
||||
content = create_custom_layout(args.panes, args.direction, layout_name)
|
||||
elif args.layout_type in LAYOUT_TEMPLATES:
|
||||
content = LAYOUT_TEMPLATES[args.layout_type].format(
|
||||
name=layout_name,
|
||||
cwd=cwd
|
||||
)
|
||||
else:
|
||||
print(f"❌ Unknown layout type: {args.layout_type}")
|
||||
sys.exit(1)
|
||||
|
||||
# Add theme if specified
|
||||
if args.theme:
|
||||
content += f'\ntheme "{args.theme}"\n'
|
||||
|
||||
# Write layout file
|
||||
layout_path = get_layout_path(layouts_dir, layout_name)
|
||||
if write_layout_file(layout_path, content):
|
||||
print(f"✅ Layout created: {layout_path}")
|
||||
print(f"💡 Use with: zellij --layout {layout_path}")
|
||||
else:
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
19
skills/zellij-config/scripts/example.py
Executable file
19
skills/zellij-config/scripts/example.py
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Example helper script for zellij-config
|
||||
|
||||
This is a placeholder script that can be executed directly.
|
||||
Replace with actual implementation or delete if not needed.
|
||||
|
||||
Example real scripts from other skills:
|
||||
- pdf/scripts/fill_fillable_fields.py - Fills PDF form fields
|
||||
- pdf/scripts/convert_pdf_to_images.py - Converts PDF pages to images
|
||||
"""
|
||||
|
||||
def main():
|
||||
print("This is an example script for zellij-config")
|
||||
# TODO: Add actual script logic here
|
||||
# This could be data processing, file conversion, API calls, etc.
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
217
skills/zellij-config/scripts/setup_zellij.py
Normal file
217
skills/zellij-config/scripts/setup_zellij.py
Normal file
@@ -0,0 +1,217 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Zellij Setup Script - Automates initial Zellij configuration setup
|
||||
|
||||
Usage:
|
||||
setup_zellij.py [--theme THEME] [--layout LAYOUT] [--keybindings] [--clean]
|
||||
|
||||
Examples:
|
||||
setup_zellij.py --theme nord --layout dev
|
||||
setup_zellij.py --clean
|
||||
setup_zellij.py --keybindings
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def create_config_directory():
|
||||
"""Create Zellij configuration directory if it doesn't exist."""
|
||||
config_dir = Path.home() / ".config" / "zellij"
|
||||
config_dir.mkdir(parents=True, exist_ok=True)
|
||||
return config_dir
|
||||
|
||||
|
||||
def dump_default_config(config_path):
|
||||
"""Dump default Zellij configuration to file."""
|
||||
import subprocess
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["zellij", "setup", "--dump-config"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=True
|
||||
)
|
||||
if result.returncode == 0:
|
||||
with open(config_path, 'w') as f:
|
||||
f.write(result.stdout)
|
||||
print(f"✅ Default config written to {config_path}")
|
||||
return True
|
||||
else:
|
||||
print(f"❌ Failed to dump default config: {result.stderr}")
|
||||
return False
|
||||
except FileNotFoundError:
|
||||
print("❌ zellij command not found. Please install Zellij first.")
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f"❌ Error running zellij: {e}")
|
||||
return False
|
||||
|
||||
|
||||
def create_layout_directory(config_dir):
|
||||
"""Create layouts directory within config directory."""
|
||||
layouts_dir = config_dir / "layouts"
|
||||
layouts_dir.mkdir(exist_ok=True)
|
||||
return layouts_dir
|
||||
|
||||
|
||||
def setup_theme(theme_name, config_path):
|
||||
"""Set theme in configuration file."""
|
||||
if not theme_name:
|
||||
return True
|
||||
|
||||
try:
|
||||
with open(config_path, 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
# Check if theme block exists, if not add it
|
||||
if 'theme "' not in content:
|
||||
content += '\ntheme "' + theme_name + '"\n'
|
||||
else:
|
||||
# Replace existing theme
|
||||
import re
|
||||
content = re.sub(r'theme\s+"[^"]*"', f'theme "{theme_name}"', content)
|
||||
|
||||
with open(config_path, 'w') as f:
|
||||
f.write(content)
|
||||
|
||||
print(f"✅ Theme set to: {theme_name}")
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"❌ Error setting theme: {e}")
|
||||
return False
|
||||
|
||||
|
||||
def create_default_layout(layout_name, layouts_dir):
|
||||
"""Create a default layout template."""
|
||||
import subprocess
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["zellij", "setup", "--dump-layout", "default"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=True
|
||||
)
|
||||
if result.returncode == 0:
|
||||
layout_path = layouts_dir / f"{layout_name}.kdl"
|
||||
with open(layout_path, 'w') as f:
|
||||
f.write(result.stdout)
|
||||
print(f"✅ Default layout created: {layout_path}")
|
||||
return True
|
||||
else:
|
||||
print(f"❌ Failed to create layout: {result.stderr}")
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f"❌ Error creating layout: {e}")
|
||||
return False
|
||||
|
||||
|
||||
def setup_keybindings_hint():
|
||||
"""Provide hint for setting up keybindings."""
|
||||
print("""
|
||||
📝 Keybinding Setup Tips:
|
||||
|
||||
1. Edit ~/.config/zellij/config.kdl
|
||||
2. Add keybinds section:
|
||||
keybinds {
|
||||
normal {
|
||||
bind "Ctrl g" { SwitchToMode "locked"; }
|
||||
bind "Ctrl p" { SwitchToMode "pane"; }
|
||||
// ... add more bindings
|
||||
}
|
||||
}
|
||||
3. Common modes: normal, pane, locked, shared, session
|
||||
4. Use 'zellij setup --check' to validate
|
||||
""")
|
||||
|
||||
|
||||
def validate_config(config_path):
|
||||
"""Validate Zellij configuration."""
|
||||
import subprocess
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["zellij", "setup", "--check"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=True
|
||||
)
|
||||
if result.returncode == 0:
|
||||
print("✅ Configuration is valid")
|
||||
return True
|
||||
else:
|
||||
print(f"❌ Configuration errors: {result.stderr}")
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f"❌ Error validating config: {e}")
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Setup Zellij configuration with optional theme and layout",
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter
|
||||
)
|
||||
parser.add_argument("--theme", help="Set theme (e.g., nord, dracula, default)")
|
||||
parser.add_argument("--layout", help="Create default layout with specified name")
|
||||
parser.add_argument("--keybindings", action="store_true", help="Show keybinding setup hints")
|
||||
parser.add_argument("--clean", action="store_true", help="Start fresh (clean setup)")
|
||||
parser.add_argument("--validate", action="store_true", help="Validate existing configuration")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# Create config directory
|
||||
config_dir = create_config_directory()
|
||||
config_path = config_dir / "config.kdl"
|
||||
|
||||
print(f"🚀 Setting up Zellij configuration...")
|
||||
print(f" Config directory: {config_dir}")
|
||||
|
||||
if args.clean:
|
||||
print("Starting with clean configuration...")
|
||||
if dump_default_config(config_path):
|
||||
print("✅ Clean setup complete")
|
||||
else:
|
||||
sys.exit(1)
|
||||
return
|
||||
|
||||
if args.validate:
|
||||
if config_path.exists():
|
||||
validate_config(config_path)
|
||||
else:
|
||||
print("❌ No configuration found to validate")
|
||||
return
|
||||
|
||||
# Setup basic config if it doesn't exist
|
||||
if not config_path.exists():
|
||||
print("Creating default configuration...")
|
||||
if not dump_default_config(config_path):
|
||||
sys.exit(1)
|
||||
|
||||
# Create layouts directory
|
||||
layouts_dir = create_layout_directory(config_dir)
|
||||
|
||||
# Set theme if specified
|
||||
if args.theme:
|
||||
setup_theme(args.theme, config_path)
|
||||
|
||||
# Create default layout if specified
|
||||
if args.layout:
|
||||
create_default_layout(args.layout, layouts_dir)
|
||||
|
||||
# Show keybinding hints if requested
|
||||
if args.keybindings:
|
||||
setup_keybindings_hint()
|
||||
|
||||
# Validate final configuration
|
||||
if config_path.exists():
|
||||
validate_config(config_path)
|
||||
|
||||
print("✅ Zellij setup complete!")
|
||||
print(f"📁 Configuration file: {config_path}")
|
||||
print(f"📁 Layouts directory: {layouts_dir}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user