Skip to content

Commit

Permalink
make WezTerm keybinding issue Ctrl+L instead when run from a Zellij pane
Browse files Browse the repository at this point in the history
When multiple sessions are active, Zellij requires the name of a session to send actions to.

Alas a WezTerm pane does not inherit a shell's environment and therefore cannot use the ZELLIJ_SESSION_NAME environment variable.

wez/wezterm#5906
zellij-org/zellij#3581
zellij-org/zellij#2100
  • Loading branch information
franckrasolo committed Sep 3, 2024
1 parent 1ffe103 commit 30ce257
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions home/wezterm/config/key_bindings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@ return function(config)
local action = wezterm.action
local mod = "ALT|SHIFT"

local function zellij(args)
os.execute("/etc/profiles/per-user/" .. os.getenv("USER") .. "/bin/zellij " .. args)
end

config.keys = {
{
mods = "CMD|SHIFT",
key = "K",
action = wezterm.action_callback(function(window, pane)
if pane:get_foreground_process_info()["name"] == "zellij" then
zellij("action clear")
zellij("action write 12") -- 12 -> ^L
window:perform_action(action.SendKey { mods = "CTRL", key = "L" }, pane)
else
window:perform_action(
action.Multiple {
Expand Down

0 comments on commit 30ce257

Please sign in to comment.