├── .gitignore ├── .luarc.json ├── package.json ├── readme.md ├── screenshots ├── move.png ├── normal.png ├── pane.png ├── resize.png └── tab.png ├── src ├── helpers.ts └── wm.ts ├── tsconfig.json ├── types └── wezterm │ ├── actions.d.ts │ ├── coreTypes.d.ts │ ├── index.d.ts │ └── wezterm.d.ts └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | dist/ 4 | -------------------------------------------------------------------------------- /.luarc.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", 3 | "Lua.diagnostics.globals": [ 4 | "vim", 5 | "createHintText" 6 | ] 7 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wezmode-ts", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "license": "MIT", 6 | "scripts":{ 7 | "build": "tstl --luaBundle wezmode.lua --luaBundleEntry ./src/wm.ts -lt JIT --outDir ./dist/" 8 | }, 9 | "devDependencies": { 10 | "lua-types": "^2.13.0", 11 | "typescript": "^4.8.4", 12 | "typescript-to-lua": "^1.10.1" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Wezmode 2 | *Modal keybinds and prompts for wezterm* 3 | 4 | >NOTICE: I've since decided to take development of this plugin more seriously. As a result, please consider it to be pre-release. Things may (will) change. And they may (probably) break. I will treat version 3.0.0 as the first stable release to avoid changing the versions of older releases. For now, the docs below refer to version 2. 5 | 6 | ## What is it? 7 | A super simple set of helper methods (**plugin?**) to create custom "modes" using the `key_tables` functionality of wezterm. 8 | 9 | Here's a few of my modes: 10 | ![normal mode](./screenshots/normal.png) 11 | ![pane mode](./screenshots/pane.png) 12 | ![resize mode](./screenshots/resize.png) 13 | 14 | ## Table of Contents 15 | 1. [Limitations](#limitations) 16 | 2. [Installation](#installation) 17 | 3. [Usage](#usage) 18 | 4. [Advanced Usage](#advanced) 19 | - [Config](#advanced.config) 20 | - [Merging with existing keymaps](#advanced.merging) 21 | - [Manually setting the status](#status) 22 | 5. [Full config example](#config_example) 23 | 24 | 25 | 26 | ## Limitations 27 | Using this plugin, we decide on a modifier and a set of keys that will trigger certain modes. 28 | By default, `CTRL` is the modifier. There is currently no way to have different modes under different modifiers. 29 | 30 | There is currently no way to have nested modes. This feature is on the roadmap. 31 | 32 | 33 | 34 | ## Installation 35 | To install this script, place [wezmode.lua from the latest release](https://github.com/twilsoft/wezmode/releases/latest) in your [wezterm config directory](https://wezfurlong.org/wezterm/config/files.html). This is usually `$HOME/.config/wezterm` 36 | 37 | Once the script is installed. Sweet nothing will happen. Let's move on to usage. 38 | 39 | 40 | 41 | ## Usage 42 | ```lua 43 | -- wezterm.lua 44 | local wezterm = require("wezterm") 45 | 46 | -- 1. Import wezmode into your `wezterm.lua` config. 47 | local wezmode = require("wezmode") 48 | 49 | -- 2. Call the setup function to generate your keymaps, 50 | -- key tables and mode texts (The text in the status bar) 51 | wezmode.setup({ 52 | { 53 | name = "pane", -- the name that will show in the status bar for the mode 54 | key = "p", -- the key you'll use with your modifier to enter the mode 55 | modeColor = "#89b4fa", -- the color of the mode indicator 56 | keyTable = { 57 | { 58 | key = "r", 59 | desc = "right", 60 | action = wezterm.action.SplitHorizontal({ domain = "CurrentPaneDomain" }) 61 | }, 62 | -- more keybinds here 63 | } 64 | }, 65 | -- some more modes here 66 | }) 67 | 68 | -- 3. Set up the right status text to use our modes 69 | wezmode.handleRightStatusUpdate() 70 | 71 | -- 4. Add our modes to our wezterm config 72 | return { 73 | -- other config options 74 | keys = wezmode.getKeys(), 75 | key_tables = wezmode.getKeyTables(), 76 | } 77 | ``` 78 | 79 | See the next section (Advanced usage) for more complex configurations. 80 | 81 | 82 | 83 | ## Advanced usage 84 | 85 | 86 | 87 | ### Config 88 | An optional config can be supplied as the second argument for `wezmode.setup` 89 | The default config is as follows: 90 | ```lua 91 | { 92 | modifier = "CTRL", -- follows the same modifier syntax as wezterm key maps 93 | hintSeparator = "/", -- the character that separates each hint 94 | theme = { 95 | normalModeColor = "red", -- the color to use for the normal mode indicator 96 | hintColor = "green", -- the color to use for the key hints 97 | modeTextColor = "black", -- the text color for the mode indicators 98 | textColor = "white", -- the basic text color 99 | } 100 | } 101 | ``` 102 | For example if we want to use `Ctrl & Alt` for our modifier: 103 | ```lua 104 | wezmode.setup({ 105 | -- modes here as usual 106 | }, 107 | { 108 | modifier = "CTRL|ALT" 109 | }) 110 | ``` 111 | 112 | This plugin also supports `HYPER`, `HYP` & `MEH` as modifiers. Under the hood they expand to `CMD|ALT|CTRL|SHIFT` and `ALT|CTRL|SHIFT` respectively. 113 | The modifier hint will show the "shortcut" text rather than the expanded modifier. 114 | 115 | 116 | 117 | ### Merging with existing keymaps 118 | By using only `wezmode.getKeys` and `wezmode.getKeyMaps` to set our keybinds, we are limited to using bindings only defined in our `wezmode.setup` call. To use other key maps we can use `wezmode.extendTable`. 119 | For example if we wanted to use ALT+Arrow Keys to navigate between panes as well as use our mode config: 120 | ```lua 121 | -- wezterm.lua 122 | return { 123 | -- the rest of your config... 124 | keys = wezmode.extendTable({ 125 | { mods = "ALT", key = "LeftArrow", action = wezterm.action { ActivatePaneDirection = "Left" } }, 126 | { mods = "ALT", key = "RightArrow", action = wezterm.action { ActivatePaneDirection = "Right" } }, 127 | { mods = "ALT", key = "UpArrow", action = wezterm.action { ActivatePaneDirection = "Up" } }, 128 | { mods = "ALT", key = "DownArrow", action = wezterm.action { ActivatePaneDirection = "Down" } }, 129 | }, wezmode.getKeys()), 130 | -- extendTable can also work with `key_tables` 131 | } 132 | ``` 133 | 134 | 135 | 136 | ### Manually setting the status 137 | If you want to get the text used in the status to set it manually we can use `wezmode.getModeText`. 138 | 139 | For example let's remove the call to `wezmode.handleRightStatusUpdate` and replace it with: 140 | ```lua 141 | wezterm.on('update-right-statuis', function(window) 142 | window:set_right_status(wezmode.getModeText(window:active_key_table() or "normal")) 143 | end) 144 | ``` 145 | 146 | This will behave the same as `wezmode.handleRightStatusUpdate` but allows us to extend the behavior or use the mode text in other ways. 147 | 148 | 149 | 150 | ## Full wezterm.lua config example 151 | ```lua 152 | local wezterm = require('wezterm') 153 | local wezmode = require("wezmode") 154 | 155 | -- custom vars 156 | local resize_amount = 3; 157 | 158 | local wezmodeConfig = { 159 | theme = { 160 | textColor = "white", 161 | hintColor = "#a6e3a1", 162 | normalModeColor = "#cba6f7", 163 | modeTextColor = "#11111b", 164 | } 165 | } 166 | 167 | wezmode.setup({ 168 | { 169 | name = "pane", 170 | key = "p", 171 | modeColor = "#89b4fa", 172 | keyTable = { 173 | { key = "r", desc = "right", action = wezterm.action.SplitHorizontal({ domain = "CurrentPaneDomain" }) }, 174 | { key = "n", desc = "new", action = wezterm.action.SplitHorizontal({ domain = "CurrentPaneDomain" }) }, 175 | { key = "d", desc = "down", action = wezterm.action.SplitVertical({ domain = "CurrentPaneDomain" }) }, 176 | { key = "x", desc = "close", action = wezterm.action.CloseCurrentPane({ confirm = false }) }, 177 | { key = "s", desc = "select", action = wezterm.action.PaneSelect }, 178 | -- Cancel the mode by pressing escape 179 | { key = "Escape", desc = "back", action = "PopKeyTable" }, 180 | } 181 | }, 182 | { 183 | name = "resize", 184 | key = "n", 185 | modeColor = "#fab387", 186 | keyTable = { 187 | { key = "h", desc = "left", action = wezterm.action.AdjustPaneSize({ "Left", resize_amount }) }, 188 | { key = "l", desc = "right", action = wezterm.action.AdjustPaneSize({ "Right", resize_amount }) }, 189 | { key = "k", desc = "up", action = wezterm.action.AdjustPaneSize({ "Up", resize_amount }) }, 190 | { key = "j", desc = "down", action = wezterm.action.AdjustPaneSize({ "Down", resize_amount }) }, 191 | -- Cancel the mode by pressing escape 192 | { key = "Escape", desc = "back", action = "PopKeyTable" }, 193 | }, 194 | }, 195 | { 196 | name = "move", 197 | key = "h", 198 | modeColor = "#f38ba8", 199 | keyTable = { 200 | { key = "n", desc = "Rotate next", action = wezterm.action.RotatePanes('Clockwise') }, 201 | -- Cancel the mode by pressing escape 202 | { key = "Escape", desc = "back", action = "PopKeyTable" }, 203 | } 204 | }, 205 | { 206 | name = "tab", 207 | key = "t", 208 | modeColor = "#a6e3a1", 209 | keyTable = { 210 | { key = "n", desc = "new", action = wezterm.action.SpawnTab("CurrentPaneDomain") }, 211 | { key = "h", desc = "left", action = wezterm.action.ActivateTabRelative(-1) }, 212 | { key = "l", desc = "right", action = wezterm.action.ActivateTabRelative(1) }, 213 | { key = "x", desc = "close", action = wezterm.action.CloseCurrentTab({ confirm = false }) }, 214 | -- Cancel the mode by pressing escape 215 | { key = "Escape", desc = "back", action = "PopKeyTable" }, 216 | } 217 | } 218 | }, wezmodeConfig) 219 | 220 | wezmode.handleRightStatusUpdate() 221 | 222 | return { 223 | font = wezterm.font("VictorMono Nerd Font Mono", { weight = "DemiBold" }), 224 | use_fancy_tab_bar = false, 225 | tab_max_width = 50, 226 | window_padding = { left = 4, right = 2, top = 1, bottom = 0 }, 227 | font_size = 15, 228 | keys = wezmode.extendTable({ 229 | -- pane moving 230 | { mods = "ALT", key = "LeftArrow", action = wezterm.action { ActivatePaneDirection = "Left" } }, 231 | { mods = "ALT", key = "RightArrow", action = wezterm.action { ActivatePaneDirection = "Right" } }, 232 | { mods = "ALT", key = "UpArrow", action = wezterm.action { ActivatePaneDirection = "Up" } }, 233 | { mods = "ALT", key = "DownArrow", action = wezterm.action { ActivatePaneDirection = "Down" } }, 234 | }, wezmode.getKeys()), 235 | key_tables = wezmode.getKeyTables(), 236 | } 237 | ``` 238 | -------------------------------------------------------------------------------- /screenshots/move.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilsoft/wezmode/de22c140455bcf34508e2719d0d21a3b78374a75/screenshots/move.png -------------------------------------------------------------------------------- /screenshots/normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilsoft/wezmode/de22c140455bcf34508e2719d0d21a3b78374a75/screenshots/normal.png -------------------------------------------------------------------------------- /screenshots/pane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilsoft/wezmode/de22c140455bcf34508e2719d0d21a3b78374a75/screenshots/pane.png -------------------------------------------------------------------------------- /screenshots/resize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilsoft/wezmode/de22c140455bcf34508e2719d0d21a3b78374a75/screenshots/resize.png -------------------------------------------------------------------------------- /screenshots/tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilsoft/wezmode/de22c140455bcf34508e2719d0d21a3b78374a75/screenshots/tab.png -------------------------------------------------------------------------------- /src/helpers.ts: -------------------------------------------------------------------------------- 1 | type mergable = { [key: string]: mergable | string | number | boolean } 2 | 3 | const isObject = (o: any): o is mergable => { 4 | return typeof o === "object" 5 | } 6 | 7 | export const mergeObjects = ( 8 | o1: T, 9 | o2: P 10 | ): T => { 11 | Object.keys(o2).forEach((k) => { 12 | const v1 = o1[k]; 13 | const v2 = o2[k]; 14 | if (isObject(v1) && isObject(v2)) { 15 | o1 = Object.assign(o1, {[k]:mergeObjects(v1, v2)}); 16 | } else { 17 | o1 = Object.assign(o1, {[k]: o2[k]}); 18 | } 19 | }); 20 | return o1; 21 | }; 22 | -------------------------------------------------------------------------------- /src/wm.ts: -------------------------------------------------------------------------------- 1 | import type { Modifier, Key, KeyBind, FormatAttributeIntensity } from "wezterm"; 2 | import * as wezterm from "wezterm"; 3 | 4 | import { mergeObjects } from "./helpers"; 5 | 6 | type describedKeyBind = KeyBind & { 7 | desc: string; 8 | }; 9 | 10 | type mode = { 11 | name: string; 12 | key: Key; 13 | modeColor: string; 14 | keyTable: describedKeyBind[]; 15 | one_shot?: boolean; 16 | until_unknown?: boolean; 17 | prevent_fallback?: boolean; 18 | }; 19 | 20 | type wezmodeOpts = { 21 | modifier: Modifier; 22 | hintSeparator: string; 23 | theme: { 24 | intensity: FormatAttributeIntensity; 25 | normalModeColor: string; 26 | hintColor: string; 27 | modeTextColor: string; 28 | textColor: string; 29 | }; 30 | }; 31 | 32 | type wezmodeState = { 33 | keys: KeyBind[]; 34 | modeTexts: Record; 35 | keyTables: Record; 36 | }; 37 | 38 | const state: wezmodeState = { 39 | keys: [], 40 | modeTexts: {}, 41 | keyTables: {}, 42 | }; 43 | 44 | const defaultOpts: wezmodeOpts = { 45 | modifier: "CTRL", 46 | hintSeparator: "/", 47 | theme: { 48 | intensity: "Bold", 49 | normalModeColor: "red", 50 | hintColor: "green", 51 | modeTextColor: "black", 52 | textColor: "white", 53 | }, 54 | }; 55 | 56 | const createPrefixText = ( 57 | prefix: string, 58 | textColor: string, 59 | intensity: FormatAttributeIntensity 60 | ) => { 61 | return wezterm.format([ 62 | { Attribute: { Intensity: intensity } }, 63 | { Foreground: { Color: textColor } }, 64 | { Text: prefix }, 65 | ]); 66 | }; 67 | 68 | const createHintText = ( 69 | key: Key, 70 | desc: string, 71 | hintColor: string, 72 | textColor: string, 73 | intensity: FormatAttributeIntensity 74 | ) => { 75 | return wezterm.format([ 76 | { Attribute: { Intensity: intensity } }, 77 | { Foreground: { Color: textColor } }, 78 | { Text: "<" }, 79 | { Foreground: { Color: hintColor } }, 80 | { Text: key }, 81 | { Foreground: { Color: textColor } }, 82 | { Text: `> ${desc}` }, 83 | ]); 84 | }; 85 | 86 | const createModeText = ( 87 | name: string, 88 | textColor: string, 89 | modeColor: string, 90 | intensity: FormatAttributeIntensity 91 | ) => { 92 | return wezterm.format([ 93 | { Attribute: { Intensity: intensity } }, 94 | { Foreground: { Color: modeColor } }, 95 | { Text: " \uE0B2" }, 96 | { Attribute: { Intensity: intensity } }, 97 | { Foreground: { Color: textColor } }, 98 | { Background: { Color: modeColor } }, 99 | { Text: ` ${name.toUpperCase()} ` }, 100 | ]); 101 | }; 102 | 103 | const setup = (modes: mode[], opts?: Partial) => { 104 | const options = mergeObjects(defaultOpts, opts ?? {}); 105 | 106 | const expandedModifier = (() => { 107 | switch(options.modifier) { 108 | case "MEH": 109 | return "ALT|CTRL|SHIFT" 110 | case "HYP": 111 | case "HYPER": 112 | return "CMD|ALT|CTRL|SHIFT" 113 | default: { 114 | return options.modifier 115 | } 116 | } 117 | })() 118 | 119 | const modeHints = modes 120 | .map((m) => 121 | createHintText( 122 | m.key, 123 | m.name, 124 | options.theme.hintColor, 125 | options.theme.textColor, 126 | options.theme.intensity 127 | ) 128 | ) 129 | .join(` ${options.hintSeparator} `); 130 | 131 | state.modeTexts["normal"] = `${createPrefixText( 132 | options.modifier, 133 | options.theme.normalModeColor, 134 | options.theme.intensity 135 | )} + ${modeHints} ${createModeText( 136 | "normal", 137 | options.theme.modeTextColor, 138 | options.theme.normalModeColor, 139 | options.theme.intensity 140 | )}`; 141 | 142 | modes.forEach((m) => { 143 | state.keys.push({ 144 | key: m.key, 145 | mods: expandedModifier, 146 | action: wezterm.action.ActivateKeyTable({ 147 | name: m.name, 148 | one_shot: !!m.one_shot, 149 | until_unknown: !!m.until_unknown, 150 | prevent_fallback: !!m.prevent_fallback, 151 | }), 152 | }); 153 | 154 | state.keyTables[m.name] = m.keyTable; 155 | 156 | const actionHints = m.keyTable 157 | .map((k) => 158 | createHintText( 159 | k.key, 160 | k.desc, 161 | options.theme.hintColor, 162 | options.theme.textColor, 163 | options.theme.intensity 164 | ) 165 | ) 166 | .join(` ${options.hintSeparator} `); 167 | 168 | state.modeTexts[m.name] = `${actionHints} ${createModeText( 169 | m.name, 170 | options.theme.modeTextColor, 171 | m.modeColor, 172 | options.theme.intensity 173 | )}`; 174 | }); 175 | }; 176 | 177 | const getModeText = (modeName: string) => state.modeTexts[modeName]; 178 | const getKeys = () => state.keys; 179 | const getKeyTables = () => state.keyTables; 180 | const handleRightStatusUpdate = () => { 181 | wezterm.on("update-right-status", (window) => { 182 | window.set_right_status(getModeText(window.active_key_table() ?? "normal")); 183 | }); 184 | }; 185 | const mergeTables = mergeObjects; 186 | const extendTable = (t1: any[], t2: any[]) => t1.concat(t2); 187 | 188 | export { 189 | setup, 190 | getModeText, 191 | getKeys, 192 | getKeyTables, 193 | handleRightStatusUpdate, 194 | mergeTables, 195 | extendTable, 196 | }; 197 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["./src"], 3 | "compilerOptions": { 4 | "target": "esnext", 5 | "lib": ["esnext"], 6 | "moduleResolution": "node", 7 | "types": [], 8 | "strict": true, 9 | "types": ["lua-types/jit", "./types/wezterm"], 10 | }, 11 | "tstl": { 12 | "luaTarget": "JIT", 13 | "noImplicitSelf": true 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /types/wezterm/actions.d.ts: -------------------------------------------------------------------------------- 1 | declare module "wezterm/coreTypes/actionFuncs" { 2 | export type Action = () => void; 3 | export type ActivateKeyTable = (opts: { 4 | name: string, 5 | one_shot: boolean, 6 | until_unknown: boolean, 7 | prevent_fallback: boolean 8 | }) => Action; 9 | } 10 | -------------------------------------------------------------------------------- /types/wezterm/coreTypes.d.ts: -------------------------------------------------------------------------------- 1 | declare module "wezterm/coreTypes" { 2 | // ** helpers 3 | type uniqueUnion< 4 | baseUnion extends string, 5 | removalCandidates extends string, 6 | usedCandidate 7 | > = Exclude>; 8 | 9 | type uniqueSet = uniqueUnion< 10 | modifierKeys, 11 | superKeys, 12 | s 13 | > & 14 | uniqueUnion; 15 | 16 | type modifierPermutations< 17 | t extends string, 18 | u extends string = t 19 | > = t extends any ? t | `${t}|${modifierPermutations>}` : never; 20 | 21 | export type formatAttributeUnderline = 22 | | "None" 23 | | "Single" 24 | | "Double" 25 | | "Curly" 26 | | "Dotted" 27 | | "Dashed"; 28 | 29 | export type formatAttributeIntensity = "Normal" | "Bold" | "Half"; 30 | 31 | export type formatAttributeElement = { 32 | Attribute: 33 | | { Underline: formatAttributeUnderline } 34 | | { Intensity: formatAttributeIntensity } 35 | | { Italic: boolean }; 36 | }; 37 | 38 | export type formatColor = { Color: string } | { AnsiColor: string }; 39 | export type formatForegroundElement = { Foreground: formatColor }; 40 | export type formatBackgroundElement = { Background: formatColor }; 41 | export type formatTextElement = { Text: string } 42 | 43 | export type formatElement = 44 | | formatAttributeElement 45 | | formatForegroundElement 46 | | formatBackgroundElement 47 | | formatTextElement; 48 | 49 | export type keyMapPreference = "Physical" | "Mapped"; 50 | 51 | export type modifierKeys = 52 | | "SUPER" 53 | | "CMD" 54 | | "WIN" 55 | | "CTRL" 56 | | "SHIFT" 57 | | "ALT" 58 | | "OPT" 59 | | "META" 60 | | "LEADER" 61 | | "VoidSymbol"; 62 | 63 | export type mappedKeys = `mapped:${allKeys}`; 64 | export type physicalKeys = `phys:${allKeys}`; 65 | export type allKeys = 66 | | "Hyper" 67 | | "Super" 68 | | "Meta" 69 | | "Cancel" 70 | | "Backspace" 71 | | "Tab" 72 | | "Clear" 73 | | "Enter" 74 | | "Shift" 75 | | "Escape" 76 | | "LeftShift" 77 | | "RightShift" 78 | | "Control" 79 | | "LeftControl" 80 | | "RightControl" 81 | | "Alt" 82 | | "LeftAlt" 83 | | "RightAlt" 84 | | "Menu" 85 | | "LeftMenu" 86 | | "RightMenu" 87 | | "Pause" 88 | | "CapsLock" 89 | | "VoidSymbol" 90 | | "PageUp" 91 | | "PageDown" 92 | | "End" 93 | | "Home" 94 | | "LeftArrow" 95 | | "RightArrow" 96 | | "UpArrow" 97 | | "DownArrow" 98 | | "Select" 99 | | "Print" 100 | | "Execute" 101 | | "PrintScreen" 102 | | "Insert" 103 | | "Delete" 104 | | "Help" 105 | | "LeftWindows" 106 | | "RightWindows" 107 | | "Applications" 108 | | "Sleep" 109 | | "Numpad0" 110 | | "Numpad1" 111 | | "Numpad2" 112 | | "Numpad3" 113 | | "Numpad4" 114 | | "Numpad5" 115 | | "Numpad6" 116 | | "Numpad7" 117 | | "Numpad8" 118 | | "Numpad9" 119 | | "Multiply" 120 | | "Add" 121 | | "Separator" 122 | | "Subtract" 123 | | "Decimal" 124 | | "Divide" 125 | | "NumLock" 126 | | "ScrollLock" 127 | | "BrowserBack" 128 | | "BrowserForward" 129 | | "BrowserRefresh" 130 | | "BrowserStop" 131 | | "BrowserSearch" 132 | | "BrowserFavorites" 133 | | "BrowserHome" 134 | | "VolumeMute" 135 | | "VolumeDown" 136 | | "VolumeUp" 137 | | "MediaNextTrack" 138 | | "MediaPrevTrack" 139 | | "MediaStop" 140 | | "MediaPlayPause" 141 | | "ApplicationLeftArrow" 142 | | "ApplicationRightArrow" 143 | | "ApplicationUpArrow" 144 | | "ApplicationDownArrow" 145 | | "F1" 146 | | "F2" 147 | | "F3" 148 | | "F4" 149 | | "F5" 150 | | "F6" 151 | | "F7" 152 | | "F8" 153 | | "F9" 154 | | "F10" 155 | | "F11" 156 | | "F12" 157 | | "F13" 158 | | "F14" 159 | | "F15" 160 | | "F16" 161 | | "F17" 162 | | "F18" 163 | | "F19" 164 | | "F20" 165 | | "F21" 166 | | "F22" 167 | | "F23" 168 | | "F24"; 169 | 170 | export type superKeys = "SUPER" | "WIN" | "CMD"; 171 | export type metaKeys = "ALT" | "OPT" | "META"; 172 | 173 | export type modifierCombos = // there has to be a nicer way than this?? 174 | | modifierPermutations> 175 | | modifierPermutations> 176 | | modifierPermutations> 177 | | modifierPermutations> 178 | | modifierPermutations> 179 | | modifierPermutations> 180 | | modifierPermutations> 181 | | modifierPermutations> 182 | | modifierPermutations>; 183 | } 184 | -------------------------------------------------------------------------------- /types/wezterm/index.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | -------------------------------------------------------------------------------- /types/wezterm/wezterm.d.ts: -------------------------------------------------------------------------------- 1 | /** @noResolution **/ 2 | declare module "wezterm" { 3 | import type { 4 | allKeys, 5 | mappedKeys, 6 | physicalKeys, 7 | modifierCombos, 8 | formatElement, 9 | formatAttributeIntensity, 10 | } from "wezterm/coreTypes"; 11 | 12 | import type * as actions from "wezterm/coreTypes/actionFuncs"; 13 | 14 | export class Window { 15 | set_right_status(text: string): void; 16 | active_key_table(): string; 17 | } 18 | 19 | type HyperKey = "HYPER" | "HYP" 20 | type MehKey = "MEH" 21 | 22 | export type Modifier = modifierCombos | HyperKey | MehKey; 23 | export type Key = allKeys | mappedKeys | physicalKeys; 24 | 25 | export type KeyBind = { 26 | key: Key; 27 | mods?: Modifier; 28 | action: actions.Action; 29 | }; 30 | 31 | export type KeyTable = KeyBind[]; 32 | 33 | export type FormatElement = formatElement; 34 | 35 | export const action: { 36 | ActivateKeyTable: actions.ActivateKeyTable; 37 | }; 38 | 39 | /** @noSelf **/ 40 | export const format: (elements: formatElement[]) => string; 41 | 42 | /** @noSelf **/ 43 | type eventHandler = (window: Window, pane: any) => void; 44 | 45 | /** @noSelf **/ 46 | export const on: ( 47 | event: string, 48 | handler: eventHandler 49 | ) => void; 50 | 51 | export type FormatAttributeIntensity = formatAttributeIntensity 52 | } 53 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | "@typescript-to-lua/language-extensions@1.0.0": 6 | version "1.0.0" 7 | resolved "https://registry.yarnpkg.com/@typescript-to-lua/language-extensions/-/language-extensions-1.0.0.tgz#fad73b01c21ace67abbd1477cd2b1f8b3ce7287b" 8 | integrity sha512-GtmhFqyg+txpGgGLM3mlS3R6AEG9MQhKALxxcbr6SBzg9u7YAXcPKqUBaBYd6nH+Pi/eQLcWz4BNOLhz8v4TjQ== 9 | 10 | enhanced-resolve@^5.8.2: 11 | version "5.10.0" 12 | resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.10.0.tgz#0dc579c3bb2a1032e357ac45b8f3a6f3ad4fb1e6" 13 | integrity sha512-T0yTFjdpldGY8PmuXXR0PyQ1ufZpEGiHVrp7zHKB7jdR4qlmZHhONVM5AQOAWXuF/w3dnHbEQVrNptJgt7F+cQ== 14 | dependencies: 15 | graceful-fs "^4.2.4" 16 | tapable "^2.2.0" 17 | 18 | function-bind@^1.1.1: 19 | version "1.1.1" 20 | resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" 21 | integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== 22 | 23 | graceful-fs@^4.2.4: 24 | version "4.2.10" 25 | resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" 26 | integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== 27 | 28 | has@^1.0.3: 29 | version "1.0.3" 30 | resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" 31 | integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== 32 | dependencies: 33 | function-bind "^1.1.1" 34 | 35 | is-core-module@^2.9.0: 36 | version "2.11.0" 37 | resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.11.0.tgz#ad4cb3e3863e814523c96f3f58d26cc570ff0144" 38 | integrity sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw== 39 | dependencies: 40 | has "^1.0.3" 41 | 42 | lua-types@^2.13.0: 43 | version "2.13.0" 44 | resolved "https://registry.yarnpkg.com/lua-types/-/lua-types-2.13.0.tgz#b76b2d56cfba7e649fb57498f1e60cec4accdb8c" 45 | integrity sha512-wra+mIPZlcbm8bYoM6QutEwTOAjZ9KyKMiaidGeZ+QJItIAK9hwG+1I6GCDKnW0T9E/Xv2IoTFtZwxQv4zAIJw== 46 | 47 | path-parse@^1.0.7: 48 | version "1.0.7" 49 | resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" 50 | integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== 51 | 52 | resolve@^1.15.1: 53 | version "1.22.1" 54 | resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" 55 | integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== 56 | dependencies: 57 | is-core-module "^2.9.0" 58 | path-parse "^1.0.7" 59 | supports-preserve-symlinks-flag "^1.0.0" 60 | 61 | source-map@^0.7.3: 62 | version "0.7.4" 63 | resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.4.tgz#a9bbe705c9d8846f4e08ff6765acf0f1b0898656" 64 | integrity sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA== 65 | 66 | supports-preserve-symlinks-flag@^1.0.0: 67 | version "1.0.0" 68 | resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" 69 | integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== 70 | 71 | tapable@^2.2.0: 72 | version "2.2.1" 73 | resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" 74 | integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== 75 | 76 | typescript-to-lua@^1.10.1: 77 | version "1.10.1" 78 | resolved "https://registry.yarnpkg.com/typescript-to-lua/-/typescript-to-lua-1.10.1.tgz#0046d88237dcc013e69441df1734d881168a32bf" 79 | integrity sha512-R6KQc1YzFcejyaZ9tAvVK0MFTlRS1b10vON5sxjtGVSUWl+W4KRLik0LDCgKfI0wnDQH+LNVnKBNUsBfTtEoQQ== 80 | dependencies: 81 | "@typescript-to-lua/language-extensions" "1.0.0" 82 | enhanced-resolve "^5.8.2" 83 | resolve "^1.15.1" 84 | source-map "^0.7.3" 85 | 86 | typescript@^4.8.4: 87 | version "4.8.4" 88 | resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6" 89 | integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ== 90 | --------------------------------------------------------------------------------