Skip to content

Commit bcc6e4e

Browse files
committed
feat: wezterm loads default workspace.yaml if present
some other minor tweaks to wezterm config
1 parent e543d71 commit bcc6e4e

File tree

2 files changed

+36
-6
lines changed

2 files changed

+36
-6
lines changed

users/profiles/wezterm/default.nix

+17-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@
55
}: let
66
inherit (config) xdg home;
77
in {
8+
xdg.configFile."wezterm/workspace.yaml".source = pkgs.writeText "workspace.yaml" ''
9+
windows:
10+
- command: direnv exec . hx .
11+
name: editor
12+
restart: true
13+
panes:
14+
- size: 0.20
15+
name: term
16+
direction: Bottom
17+
split_from: 1
18+
'';
819
xdg.configFile."wezterm/wezterm.fnl.lua".source =
920
pkgs.runCommand "wezterm.fnl.lua" {
1021
nativeBuildInputs = [pkgs.fennel];
@@ -17,12 +28,14 @@ in {
1728
extraConfig = ''
1829
_G.wezterm = wezterm
1930
_G.dev_remote = "${config.userinfo.devRemote}"
31+
-- fake
32+
local function getinfo()
33+
end
34+
local function traceback()
35+
end
36+
_G.debug = {getinfo = getinfo, traceback = traceback}
2037
local config
2138
if os.getenv("WEZTERM_FNL") then
22-
-- fake
23-
local function getinfo()
24-
end
25-
_G.debug = {getinfo = getinfo}
2639
local fennel = dofile("${pkgs.lua54Packages.fennel}/share/lua/5.4/fennel.lua")
2740
config = fennel.dofile(os.getenv("WEZTERM_FNL"))
2841
else

users/profiles/wezterm/wezterm.fnl

+19-2
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,28 @@
8080
(table.insert listing line))
8181
listing))
8282

83+
(local default-project-workspace-yaml-path
84+
(.. wezterm.config_dir :/workspace.yaml))
85+
86+
; (wezterm.log_info "package.loaded.fennel " package.loaded.fennel)
87+
; (wezterm.log_info "_G.debug " _G.debug)
88+
89+
(fn _G.debug.traceback [] nil)
90+
91+
(lambda default-project-workspace []
92+
(let [(wsloaded err) (pcall #(with-open [wsyaml (io.open default-project-workspace-yaml-path
93+
:rb)]
94+
(wezterm.serde.yaml_decode (wsyaml:read :*a))))]
95+
(if wsloaded err {:windows [{}]})))
96+
97+
(wezterm.log_info "default-project-workspace: " (default-project-workspace))
98+
8399
(lambda project-workspace-config [window pane dir]
84-
"Reads and returns the workspace config for a project"
100+
"Reads and returns the effective workspace config for a project"
101+
(wezterm.log_info "default-project-workspace " (default-project-workspace))
85102
(let [(status out err) (run-child-process window pane
86103
[:cat (.. dir :/workspace.yaml)])]
87-
(if status (wezterm.serde.yaml_decode out) {:windows [{}]})))
104+
(if status (wezterm.serde.yaml_decode out) (default-project-workspace))))
88105

89106
(lambda project-jump-list [window pane]
90107
"Returns a jump list for use with the input selector"

0 commit comments

Comments
 (0)