-
-
Notifications
You must be signed in to change notification settings - Fork 4
feat: add a hyde deployment metafile and split the wezterm config #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Deployment metadata for HyDE. | ||
| # | ||
| # HyDE consumes this over the branch archive, so it needs no second git remote: | ||
| # | ||
| # [[wezterm.files]] | ||
| # source = "https://github.com/HyDE-Project/terminal-emulators/archive/refs/heads/main.zip" | ||
| # | ||
| # The archive contains a single top-level directory, which the installer strips, | ||
| # so every path below is written as if this file sat at the root. | ||
|
|
||
| [wezterm] | ||
| description = "A GPU-accelerated cross-platform terminal emulator and multiplexer" | ||
| owner = "The HyDE Project" | ||
|
|
||
| [[wezterm.dependency]] | ||
| dnf = [ "wezterm" ] | ||
| pacman = [ "wezterm" ] | ||
|
|
||
| # HyDE's defaults. Replaced on update. | ||
| [[wezterm.files]] | ||
| action = "sync" | ||
| paths = "hyde.lua" | ||
| source_root = "wezterm" | ||
| target_root = "${XDG_CONFIG_HOME}/wezterm" | ||
|
|
||
| # The user's entry point. Never overwritten once it exists. | ||
| [[wezterm.files]] | ||
| action = "preserve" | ||
| paths = "wezterm.lua" | ||
| source_root = "wezterm" | ||
| target_root = "${XDG_CONFIG_HOME}/wezterm" | ||
|
|
||
| # The wallbash template. Rendered to ${XDG_CONFIG_HOME}/wezterm/hyde.toml on a | ||
| # theme change, which WezTerm picks up through the watch list in hyde.lua. | ||
| [[wezterm.files]] | ||
| action = "sync" | ||
| paths = "wezterm.dcol" | ||
| source_root = "wezterm" | ||
| target_root = "${XDG_DATA_HOME}/wallbash/theme" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,49 @@ | ||
| # WezTerm | ||
|
|
||
| ## Adding Templates | ||
| ## With HyDE | ||
|
|
||
| To add templates, follow these steps: | ||
| Select the `wezterm` dot during install, or deploy it directly. HyDE reads | ||
| `dots.toml` in the root of this repository over the branch archive, so nothing | ||
| has to be copied by hand. | ||
|
|
||
| 1. Copy the file `/wezterm.dcol` to either `~/.config/hyde/wallbash/always` or `~/.config/hyde/wallbash/theme`. | ||
| 2. Run `hyde-shell reload` to generate the file. | ||
| | File | Deployed to | Managed | | ||
| | --- | --- | --- | | ||
| | `hyde.lua` | `$XDG_CONFIG_HOME/wezterm/hyde.lua` | replaced on update | | ||
| | `wezterm.lua` | `$XDG_CONFIG_HOME/wezterm/wezterm.lua` | yours, never overwritten | | ||
| | `wezterm.dcol` | `$XDG_DATA_HOME/wallbash/theme/wezterm.dcol` | replaced on update | | ||
|
|
||
| **NOTE** The target file's directory should exist first `$XDG_CONFIG_HOME/wezterm/` | ||
| ## By hand | ||
|
|
||
| ## Applying and Reloading the Theme through `wezterm.lua` | ||
| 1. Copy `wezterm.dcol` into `~/.config/hyde/wallbash/theme` or | ||
| `~/.config/hyde/wallbash/always`. | ||
| 2. Copy `hyde.lua` and `wezterm.lua` into `~/.config/wezterm/`. | ||
| 3. Run `hyde-shell reload`. | ||
|
|
||
| To apply the theme, include or copy the `./wezterm.lua` file in your WezTerm configuration. | ||
| `~/.config/wezterm/` has to exist first: wallbash skips a template whose target | ||
| directory is missing. | ||
|
|
||
| **Note:** The Lua script tries to find the set config home. | ||
| ## How the colours reach WezTerm | ||
|
|
||
| For more information on configuring and theming the WezTerm terminal, you can visit the following resources: | ||
| `wezterm.dcol` renders to `~/.config/wezterm/hyde.toml`, a native WezTerm colour | ||
| scheme named `wallbash`. `hyde.lua` puts that path on WezTerm's config reload | ||
| watch list, so a theme change reloads the terminal on its own with no signal and | ||
| no apply hook. | ||
|
|
||
| - [WezTerm Wiki](https://github.com/wez/wezterm/wiki) | ||
| - [WezTerm Theming Guide](https://wezfurlong.org/wezterm/config/files.html#theming) | ||
| - [This Guide to handle dynamic files](https://github.com/wez/wezterm/issues/1036) | ||
| The scheme is selected only once the file exists. Naming a scheme that is not | ||
| there makes WezTerm log an error on every start, which is what a fresh install | ||
| looks like before the first theme switch. | ||
|
|
||
| ## Your own settings | ||
|
|
||
| `wezterm.lua` is three lines and stays yours: | ||
|
|
||
| ```lua | ||
| local config = require("hyde").config() | ||
| config.font_size = 12 | ||
| return config | ||
| ``` | ||
|
|
||
| ## References | ||
|
|
||
| - [WezTerm configuration files](https://wezfurlong.org/wezterm/config/files.html) | ||
| - [WezTerm colour schemes](https://wezfurlong.org/wezterm/config/appearance.html#defining-a-color-scheme-in-a-separate-file) | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,82 @@ | ||||||
| --! ░▒▓ | ||||||
| --! ░▒▒░▓▓ | ||||||
| --! ░▒▒▒░░░▓▓ ___________ | ||||||
| --! ░░▒▒▒░░░░░▓▓ //___________/ | ||||||
| --! ░░▒▒▒░░░░░▓▓ _ _ _ _ _____ | ||||||
| --! ░░▒▒░░░░░▓▓▓▓▓▓ | | | | | | | __/ | ||||||
| --! ░▒▒░░░░▓▓ ▓▓ | |_| | |_/ /| |___ | ||||||
| --! ░▒▒░░▓▓ ▓▓ \__ |____/ |____/ █░█░█ █▀▀ ▀█ ▀█▀ █▀▀ █▀█ █▀▄▀█ | ||||||
| --! ░▒▓▓ ▓▓ //____/ ▀▄▀▄▀ ██▄ █▄ ░█░ ██▄ █▀▄ █░▀░█ | ||||||
|
|
||||||
| -- HyDE's WezTerm defaults. | ||||||
| -- | ||||||
| -- This file is replaced on update. Put your own settings in wezterm.lua, | ||||||
| -- which HyDE never overwrites. | ||||||
|
|
||||||
| local wezterm = require("wezterm") | ||||||
|
|
||||||
| local M = {} | ||||||
|
|
||||||
| local config_dir = (os.getenv("XDG_CONFIG_HOME") or (os.getenv("HOME") .. "/.config")) .. "/wezterm" | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== files =="
git ls-files | rg '(^|/)wezterm/|hyde\.lua$|hyde\.toml$|wezterm' || true
echo "== hyde.lua =="
if [ -f wezterm/hyde.lua ]; then
cat -n wezterm/hyde.lua
else
fd -a 'hyde\.lua$' . | while read -r f; do echo "--- $f"; cat -n "$f"; done
fi
echo "== wezterm config files =="
git ls-files wezterm | sortRepository: HyDE-Project/terminal-emulators Length of output: 3569 🌐 Web query:
💡 Result: In WezTerm, you can specify a custom configuration file via the command line or environment variable, and access the configuration directory path within your Lua configuration. Command Line and Environment Configuration You can override WezTerm's default configuration file resolution using the following methods: 1. --config-file CLI Argument: You can specify a custom configuration file by using the --config-file flag when launching WezTerm [1][2]. Example: wezterm --config-file /path/to/my-config.lua 2. WEZTERM_CONFIG_FILE Environment Variable: Setting this environment variable will also direct WezTerm to use the specified file as your configuration [1][3]. Note that configuration specified via the --config CLI argument (for individual key/value overrides) will always override the values provided in your configuration file, even if that file is reloaded [1][4]. Accessing the Directory in Lua Within your wezterm.lua configuration file, you can access the path of the directory containing the loaded configuration file using the wezterm.config_dir constant [5]. Example usage: local wezterm = require 'wezterm' wezterm.log_info('The configuration directory is: '.. wezterm.config_dir) This constant is useful for modularizing your configuration, such as requiring other Lua files located in the same directory as your main wezterm.lua [3]. Citations:
🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== wezterm.lua outline =="
ast-grep outline wezterm/wezterm.lua --view expanded || true
echo "== wezterm.lua relevant content =="
cat -n wezterm/wezterm.lua
echo "== hyde.lua usages =="
rg -n "config\\(|require\\(\"hyde\"\\)|hyde\\.toml|config_dir" wezterm -SRepository: HyDE-Project/terminal-emulators Length of output: 1632 🌐 Web query:
💡 Result: To use a specific configuration file with WezTerm, you can use the --config-file command-line argument. This flag overrides the standard configuration file resolution logic [1][2]. Usage syntax: wezterm --config-file /path/to/your/config.lua If you are referring to the wezterm.config_file variable within a Lua configuration script, this variable provides the absolute path to the configuration file that WezTerm is currently using [3]. It is part of the wezterm module and can be accessed as follows: local wezterm = require 'wezterm' print(wezterm.config_file) Similarly, wezterm.config_dir provides the path to the directory containing that configuration file [3]. These are often useful when you need to reference other files (such as themes or helper scripts) relative to your main configuration file. Citations:
Use WezTerm’s resolved configuration directory. This reconstruction ignores configurations loaded via Proposed fix-local config_dir = (os.getenv("XDG_CONFIG_HOME") or (os.getenv("HOME") .. "/.config")) .. "/wezterm"
+local config_dir = wezterm.config_dir📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
|
|
||||||
| -- config_builder validates keys and reports typos, but only exists on builds | ||||||
| -- from 2022 onwards. An older WezTerm gets a plain table instead of an error. | ||||||
| local function new_config() | ||||||
| if type(wezterm.config_builder) == "function" then | ||||||
| return wezterm.config_builder() | ||||||
| end | ||||||
| return {} | ||||||
| end | ||||||
|
|
||||||
| --- Returns HyDE's defaults as a config table. | ||||||
| --- | ||||||
| --- Merge your own settings on top of it: | ||||||
| --- | ||||||
| --- local config = require("hyde").config() | ||||||
| --- config.font_size = 12 | ||||||
| --- return config | ||||||
| function M.config() | ||||||
| local config = new_config() | ||||||
|
|
||||||
| -- wallbash writes hyde.toml here as a native colour scheme named | ||||||
| -- "wallbash". Watching that file means a theme switch reloads WezTerm on | ||||||
| -- its own, with nothing to signal and no need to touch the entry point. | ||||||
| -- | ||||||
| -- The scheme is only selected once the file exists: naming a scheme that is | ||||||
| -- not there makes WezTerm log an error on every start, which is what a | ||||||
| -- fresh install looks like before the first theme switch runs. | ||||||
| local palette = config_dir .. "/hyde.toml" | ||||||
| wezterm.add_to_config_reload_watch_list(palette) | ||||||
|
|
||||||
| local handle = io.open(palette, "r") | ||||||
| if handle then | ||||||
| handle:close() | ||||||
| config.color_scheme_dirs = {config_dir} | ||||||
| config.color_scheme = "wallbash" | ||||||
| end | ||||||
|
|
||||||
| config.font = wezterm.font_with_fallback({ | ||||||
| "JetBrainsMono Nerd Font", | ||||||
| "mononoki Nerd Font", | ||||||
| "monospace", | ||||||
| }) | ||||||
| config.font_size = 11 | ||||||
|
|
||||||
| config.window_background_opacity = 0.8 | ||||||
| config.window_decorations = "NONE" | ||||||
| config.window_padding = {left = 8, right = 8, top = 8, bottom = 8} | ||||||
|
|
||||||
| config.use_fancy_tab_bar = false | ||||||
| config.hide_tab_bar_if_only_one_tab = true | ||||||
| config.tab_bar_at_bottom = false | ||||||
|
|
||||||
| config.scrollback_lines = 10000 | ||||||
| config.enable_scroll_bar = false | ||||||
|
|
||||||
| config.audible_bell = "Disabled" | ||||||
| config.check_for_updates = false | ||||||
|
|
||||||
| return config | ||||||
| end | ||||||
|
|
||||||
| return M | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,14 @@ | ||
| local wezterm = require 'wezterm' | ||
| local home = os.getenv("HOME") | ||
| local config_home = os.getenv("XDG_CONFIG_HOME") or (home .. "/.config") | ||
| local wezterm_config_dir = config_home .. "/wezterm" | ||
| -- Your WezTerm configuration. | ||
| -- | ||
| -- HyDE does not manage this file, so anything you put here survives an | ||
| -- update. HyDE's defaults and the wallbash colours live in hyde.lua, which is | ||
| -- replaced on every update. | ||
|
|
||
| wezterm.add_to_config_reload_watch_list(wezterm_config_dir .. "/hyde.toml") | ||
| local config = require("hyde").config() | ||
|
|
||
| return { | ||
| color_scheme_dirs = {wezterm_config_dir}, | ||
| color_scheme = "wallbash", | ||
| font = wezterm.font("CaskaydiaCove Nerd Font Mono"), | ||
| } | ||
| -- Your settings go below. They override the defaults, for example: | ||
| -- | ||
| -- config.font_size = 12 | ||
| -- config.window_background_opacity = 1.0 | ||
|
|
||
| return config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Update the WezTerm reference links.
Both
wezfurlong.org/wezterm/config/...URLs currently return 404; the official pages are now underwezterm.org/config/.... ()Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents