Open levinotik opened 6 months ago
I see the issue now. wezterm is looking for the file in one of several locations:
runtime error: [string "/Users/me/.config/wezterm/wezterm.lua"]:2:
module 'wezterm-session-manager' not found:
no field package.preload['wezterm-session-manager']
no file '/Users/me/.config/wezterm/wezterm-session-manager.lua'
no file '/Users/me/.config/wezterm/wezterm-session-manager/init.lua'
no file '/Users/me/Library/Application Support/wezterm/plugins/wezterm-
session-manager/plugin/init.lua'
no file '/Users/me/.wezterm/wezterm-session-manager.lua'
no file '/Users/me/.wezterm/wezterm-session-manager/init.lua'
no file '/usr/local/share/lua/5.4/wezterm-session-manager.lua'
no file '/usr/local/share/lua/5.4/wezterm-session-manager/init.lua'
no file '/usr/local/lib/lua/5.4/wezterm-session-manager.lua'
no file '/usr/local/lib/lua/5.4/wezterm-session-manager/init.lua'
no file './wezterm-session-manager.lua'
no file './wezterm-session-manager/init.lua'
can't load C modules in safe mode
stack traceback:
[C]: in function 'require'
[string "/Users/me/.config/wezterm/wezterm.lua"]:2: in main chunk
I renamed wezterm-session-manager.lua
to init.lua
and it worked. I believe your instructions have the file ending up in ~/.config/wezterm/wezterm-session-manager/session-manager.lua
. The file would need to be one level up and renamed to wezterm-session-manager.lua
for that to work or it can remane in the wezterm-session-manager
directory and renamed to init.lua
as I've done.
Another update: the session seems to be saved. I can see it in wezterm_state_config.json
but I can't restore it. The restore session key binding just doesn't seem to do anything.
Hi. I won't have time for the next couple of days to really check the issue. But I will get to it. In the meantime feel free to check out my dotfiles. https://github.com/danielcopper/dotfiles/blob/arch/.config/wezterm/wezterm.lua
This is the wezterm config where it does work for me on Linux.
@levinotik I just had the same issue (file not found) as you. Renaming to init.lua
fixed this. Unsure about your "restore" issue though. My restore is working fine. Did you figure it out in the end?
Hi again,
i finally had time to look into it. I noticed that i actually have set up the session manager differently than what i described in the readme. The require statement should actually look like this:
local session_manager = require("wezterm-session-manager/session-manager)
I will update the readme and close the PR.
Concerning your other question about some visual feedback. i just used your config, adjusted the path for the session manager and i get a visual feedback for save and restore.
Let me know if everything works now.
Cheers
Ah thanks @danielcopper
@Broderick-Westrope I haven't tried to fix this again. I'm going to look at it again soon and hopefully resolve.
I updated my wezterm config to reference:
local session_manager = require('wezterm-session-manager/session_manager')
Still seem to have issues. When I load up wezterm, I see the following error:
runtime error: [string "/Users/me/.config/wezterm/wezterm.lua"]:2:
module 'wezterm-session-manager/session_manager' not found:
no field package.preload['wezterm-session-manager/session_manager']
no file '/Users/me/.config/wezterm/wezterm-session-manager/
session_manager.lua'
no file '/Users/me/.config/wezterm/wezterm-session-manager/
session_manager/init.lua'
no file '/Users/me/Library/Application Support/wezterm/plugins/wezterm-
session-manager/session_manager/plugin/init.lua'
no file '/Users/me/.wezterm/wezterm-session-manager/
session_manager.lua'
no file '/Users/me/.wezterm/wezterm-session-manager/session_manager/
init.lua'
no file '/usr/local/share/lua/5.4/wezterm-session-manager/session_manager.lua'
no file '/usr/local/share/lua/5.4/wezterm-session-manager/session_manager/
init.lua'
no file '/usr/local/lib/lua/5.4/wezterm-session-manager/session_manager.lua'
no file '/usr/local/lib/lua/5.4/wezterm-session-manager/session_manager/
init.lua'
no file './wezterm-session-manager/session_manager.lua'
no file './wezterm-session-manager/session_manager/init.lua'
can't load C modules in safe mode
stack traceback:
[C]: in function 'require'
[string "/Users/me/.config/wezterm/wezterm.lua"]:2: in main chunk
to be 100% clear, here's what my config directory looks like now:
/Users/me/.config/wezterm
❯ tree
.
├── wezterm-session-manager
│ ├── LICENSE
│ ├── README.md
│ ├── session-manager.lua
│ └── wezterm_state_config.json
└── wezterm.lua
2 directories, 5 files
~/.config/wezterm
❯
Change your require statement to
local session_manager = require("wezterm-session-manager/session-manager")
instead of local session_manager = require("wezterm-session-manager/session_manager")
Doh! Thanks. That does get rid of errors, but still no indicator that saving the session succeeded (though I can see the json file) and restoring doesn't seem to work at all.
Oh it looks like it's creating a state file for each workspace. I tested by creating a new workspace "foo" and that got saved as wezterm-session-manager/wezterm_state_foo.json
. Does that get referenced from another state file or is the design that only a single workspace can be restored?
From the README:
restore Session Reopens a previously saved session that matches the current workspace name, restoring its layout and directories.
It sounds like I'd have to manually recreate workspaces with matching names and then restore within those? That could work, but it does mean this is a lot less useful than it could be. Is there some limitation within wezterm that makes restoring all workspaces with all layouts not possible?
You are right, this is currently how you would have to restore sessions that are not the default one. I am in the process of adding the load workspace option. That should allow to pick which saved session to restore.
Sounds great @danielcopper please let us know if there's anything we could do to help. Happy to take on anything even if administrivia or testing.
I just opened up the discussions page. Feel free to use it for requests and ideas. I might also open a connected project page, not sure yet.
@levinotik Please test the notifications again, so we can close this issue. maybe give it a try with a minimal setup or use mine as a template.
Thanks for this much needed script. I'm having some trouble getting it set up. I cloned this project into
~/.config/wezterm
and modified mywezterm.lua
to add:in my
config.keys = {...}
, I've added:After saving and trying with this key bindings, nothing seems to happen. Is there supposed to be some confirmation or visual clue that the session was successfully saved? I thought there might not be, so just to be sure in case the session did save, I tried restoring, but that didn't seem to do anything either.
Appreciate any guidance or assistance you can provide. Thanks again!
My full config is below for reference: