Skip to content

Commit

Permalink
chore(wezterm): small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
silveiralexf committed Jul 29, 2024
1 parent 7484f08 commit 5db7097
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 39 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@


### [2024-07-29]
* [[7484f08]](https://github.com/silveiralexf/.dotfiles/commit/7484f087bb7e733b79eb9f80081749dbaa1cb7f1) chore(docs): readme and spelling updates (silveiralexf@gmail.com)


* [[7e560cd]](https://github.com/silveiralexf/.dotfiles/commit/7e560cd58a7bc366f2440869fcf78c988369876f) chore(tasks): add dotfile dirs as global vars (silveiralexf@gmail.com)


Expand Down
2 changes: 0 additions & 2 deletions wezterm/config/appearance.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ return {
window_close_confirmation = 'NeverPrompt',
window_frame = {
active_titlebar_bg = '#090909',
-- font = fonts.font,
-- font_size = fonts.font_size,
},
inactive_pane_hsb = {
saturation = 0.9,
Expand Down
54 changes: 22 additions & 32 deletions wezterm/config/bindings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ local wezterm = require('wezterm')
local act = wezterm.action

local mod = {}

local keyboard = {}
if platform.is_mac then
mod.CMD = 'SUPER'
mod.CMD_REV = 'SUPER|SHIFT'
mod.CTRL = 'CTRL'
mod.CTRL_REV = 'CTRL|SHIFT'
mod.LEADER = 'ALT'
keyboard.COMPOSED_KEYS = true -- when curly brackets are opt + shift + 8/9, not ctrl
else
mod.CMD = 'ALT' -- to not conflict with other key shortcuts
mod.CMD = 'ALT' -- to avoid conflicting with other key shortcuts
mod.CMD_REV = 'ALT|SHIFT'
mod.CTRL = 'CTRL'
mod.CTRL_REV = 'CTRL|SHIFT'
mod.LEADER = 'ALT|CTRL'
keyboard.COMPOSED_KEYS = false
end

local keys = {
Expand Down Expand Up @@ -90,14 +92,28 @@ local keys = {
-- tabs --
-- tabs: spawn+close
{ key = 't', mods = mod.CMD, action = act.SpawnTab('DefaultDomain') },
{ key = 'w', mods = mod.LEADER, action = act.CloseCurrentTab({ confirm = false }) },
{ key = 'w', mods = mod.CMD, action = act.CloseCurrentPane({ confirm = false }) },

-- tabs: navigation
{ key = 'LeftArrow', mods = mod.CMD, action = act.ActivateTabRelative(-1) },
{ key = 'RightArrow', mods = mod.CMD, action = act.ActivateTabRelative(1) },
{ key = 'LeftArrow', mods = mod.CMD_REV, action = act.MoveTabRelative(-1) },
{ key = 'RightArrow', mods = mod.CMD_REV, action = act.MoveTabRelative(1) },

-- tabs: renaming
{ -- TODO: still needs work: formatting, detection, hovering, etc...
key = 'r',
mods = mod.CMD,
action = act.PromptInputLine({
description = 'Enter new name for tab',
action = wezterm.action_callback(function(window, _, line)
if line then
window:active_tab():set_title(line)
end
end),
}),
},

-- window --
-- spawn windows
{ key = 'n', mods = mod.CMD, action = act.SpawnWindow },
Expand Down Expand Up @@ -132,35 +148,7 @@ local keys = {
}),
},

-- panes --
-- panes: split panes
{ key = 'w', mods = mod.CMD, action = act.CloseCurrentPane({ confirm = false }) },
{ -- TODO: this still needs work
key = 'r',
mods = mod.CMD,
action = act.PromptInputLine({
description = 'Enter new name for tab',
action = wezterm.action_callback(function(window, _, line)
if line then
window:active_tab():set_title(line)
end
end),
}),
},

-- panes: navigation
{ key = 'k', mods = mod.LEADER, action = act.ActivatePaneDirection('Up') },
{ key = 'j', mods = mod.LEADER, action = act.ActivatePaneDirection('Down') },
{ key = 'h', mods = mod.LEADER, action = act.ActivatePaneDirection('Left') },
{ key = 'l', mods = mod.LEADER, action = act.ActivatePaneDirection('Right') },
{
key = 'p',
mods = mod.LEADER,
action = act.PaneSelect({ alphabet = '1234567890', mode = 'SwapWithActiveKeepFocus' }),
},

-- key-tables --

-- font --
-- font: resize with single stroke
{ mods = mod.CMD, key = '+', action = act.IncreaseFontSize },
{ mods = mod.CMD, key = '-', action = act.DecreaseFontSize },
Expand Down Expand Up @@ -201,4 +189,6 @@ return {
keys = keys,
key_tables = key_tables,
mouse_bindings = mouse_bindings,
send_composed_key_when_left_alt_is_pressed = keyboard.COMPOSED_KEYS,
send_composed_key_when_right_alt_is_pressed = keyboard.COMPOSED_KEYS,
}
2 changes: 1 addition & 1 deletion wezterm/events/left-status.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ local _push = function(text, fg, bg)
end

M.setup = function()
wezterm.on('update-right-status', function(window, _pane)
wezterm.on('update-right-status', function(window, _)
__cells__ = {}

local name = window:active_key_table()
Expand Down
6 changes: 3 additions & 3 deletions wezterm/events/tab-title.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ local _set_tab_idx = function(tabs, tab)
return tab_idx
end

local _set_title = function(process_name, base_title, max_width, inset, override)
local _set_title = function(process_name, base_title, max_width, inset)
local title
inset = inset or 6

Expand Down Expand Up @@ -77,14 +77,14 @@ local _push = function(bg, fg, attribute, text)
end

M.setup = function()
wezterm.on('format-tab-title', function(tab, tabs, _panes, _config, hover, max_width)
wezterm.on('format-tab-title', function(tab, tabs, _, _, hover, max_width)
__cells__ = {}

local bg
local fg
local process_name = _set_process_name(tab.active_pane.foreground_process_name)
local is_admin = _check_if_admin(tab.active_pane.title)
local title = _set_title(process_name, tab.active_pane.title, max_width, (is_admin and 8), _)
local title = _set_title(process_name, tab.active_pane.title, max_width, (is_admin and 8))

local tab_idx = _set_tab_idx(tabs, tab)

Expand Down
1 change: 0 additions & 1 deletion wezterm/utils/backdrops.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
local colors = require('colors.custom')
local platform = require('utils.platform')()
local wezterm = require('wezterm')

-- Seeding random numbers before generating for use
Expand Down

0 comments on commit 5db7097

Please sign in to comment.