Skip to content

Commit

Permalink
wezterm: Adds session manager, and for-compatibility old Nerdfonts (I…
Browse files Browse the repository at this point in the history
… can't upgrade my neovim setup without a bunch of stuffing around right now).
  • Loading branch information
damncabbage committed Feb 3, 2024
1 parent 6c3084a commit 869dccc
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 6 deletions.
21 changes: 21 additions & 0 deletions .config/wezterm/fonts/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014 Ryan L McIntyre

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions .config/wezterm/wezterm-session-manager
36 changes: 30 additions & 6 deletions .config/wezterm/wezterm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ local act = wezterm.action
local io = require 'io';
local os = require 'os';

local session_manager = require 'wezterm-session-manager/session-manager'

---------- Tab Titles ----------
local box_types = { outline = 'box_outline', filled = 'box' }
local box = function(num, type)
return wezterm.nerdfonts['md_numeric_' .. num .. '_' .. type]
if num > 10 then
return (type == box_types.filled and "[" .. num .. "]" or num)
else
return wezterm.nerdfonts['md_numeric_' .. num .. '_' .. type]
end
end

wezterm.on(
Expand All @@ -30,7 +36,10 @@ local codelia = function(overrides)
harfbuzz_features = codelia_font_features,
}
for k,v in pairs(overrides) do font[k] = v end
return wezterm.font(font)
return wezterm.font_with_fallback {
font,
'Hack Bold Nerd Font Complete Mono',
}
end

---------- Misc Helpers ----------
Expand Down Expand Up @@ -64,6 +73,12 @@ wezterm.on("trigger-vim-with-scrollback", function(window, pane)
os.remove(name);
end)

--
---------- Session Management ----------
wezterm.on("save_session", function(window) session_manager.save_state(window) end)
wezterm.on("load_session", function(window) session_manager.load_state(window) end)
wezterm.on("restore_session", function(window) session_manager.restore_state(window) end)


---------- Config ----------
local config = {
Expand Down Expand Up @@ -93,10 +108,14 @@ local config = {
font = codelia { weight = 'Medium', style = 'Italic' },
},
},
font = wezterm.font {
family = 'Codelia Ligatures',
weight = 'Medium',
harfbuzz_features = font_features,
font_dirs = { 'fonts' }, -- include ~/.config/wezterm/fonts; this _may_ shadow inbuilt fonts though
font = wezterm.font_with_fallback {
{
family = 'Codelia Ligatures',
weight = 'Medium',
harfbuzz_features = codelia_font_features,
},
"Symbols Nerd Font Mono", -- intended to refer to the local fallback/override nerdfont
},
font_size = 14.0,
use_cap_height_to_scale_fallback_fonts = true,
Expand Down Expand Up @@ -186,6 +205,11 @@ local config = {
mods = 'SUPER',
action=wezterm.action{EmitEvent="trigger-vim-with-scrollback"},
},

-- Sessions
{key = "S", mods = "SUPER|SHIFT", action = wezterm.action{EmitEvent = "save_session"}},
{key = "L", mods = "SUPER|SHIFT", action = wezterm.action{EmitEvent = "load_session"}},
{key = "R", mods = "SUPER|SHIFT", action = wezterm.action{EmitEvent = "restore_session"}},
},

mouse_bindings = {
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@

/.config/nvim/plugin

/.config/wezterm/wezterm-session-manager/*.json

/macOS/Brewfile.lock.json
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule ".zprezto"]
path = .zprezto
url = https://github.com/sorin-ionescu/prezto.git
[submodule ".config/wezterm/wezterm-session-manager"]
path = .config/wezterm/wezterm-session-manager
url = https://github.com/danielcopper/wezterm-session-manager.git

0 comments on commit 869dccc

Please sign in to comment.