wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
17.16k stars 774 forks source link

process information doesn't work in flatpak: All new pane splits open in home directory #3552

Open crispinb opened 1 year ago

crispinb commented 1 year ago

What Operating System(s) are you seeing this problem on?

Linux Wayland

Which Wayland compositor or X11 Window manager(s) are you using?

mutter 43.4 I do use PaperWM to manage windows, but that's only a Gnome plugin.

WezTerm version

20230408-112425-69ae8472

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

No, and I'll explain why below

Describe the bug

New splits, created with the default keybindings, open in my $HOME directory, regardless of the cwd in the pane from which I created the split.

To Reproduce

Configuration

"no config" (I actually do have a config, but the same behaviour happens if I move that aside)

Expected Behavior

Logs

The debug overlay doesn't appear, and there's no wezterm folder in $XDG_RUNTIME_DIR. Running wezterm with wezterm start --always-new-process produces no output unless I use WEZTERM_LOG="debug", which produces too much for me to find the point where I did the split.

Anything else?

I'm running the from org.wezfurlong.wezterm, which seems to be up to date (20230408-112425-69ae8472)

wez commented 1 year ago

You installed using the flatpak?

Can you try a non-flatpak installation instead? In the flatpak build, the GUI runs in an isolated sandbox and cannot introspect the spawned programs to determine system information.

Another option is to install the shell integration manually on the host system so that the current working directory will get set by bash or zsh via an escape sequence, which means that wezterm won't need to try to inspect the running programs to determine it.

crispinb commented 1 year ago

Of course. I've just tried the rpm and that behaves as expected. I was on the flatpak for ease of update, but I'll just follow the repo releases and update manually. I think I prefer the simple direct approach for a terminal app anyway.

Appreciate the help and the most excellent terminal.

wez commented 1 year ago

I'm not sure what can be done to improve this with flatpaks, so for the moment, I've added a note about flatpak limitations to the install section of the docs.

sandorex commented 1 year ago

I was thinking about this

When running any launch_menu just use a small shell sh -c 'echo $$; exec /usr/bin/zsh' and cause exec replaces the process the shell will have the same pid as the one printed then use that to check if the process is stateful as it will be the real process and have all the children

For testing i used this but needs work to then get the children and everything which could possibly exposed from the internal wezterm code, will take a look at the code later

config.launch_menu = {
    {
        label = 'Test',
        args = wezterm.shell_split("sh -c 'printf \"\\033]1337;SetUserVar=%s=%s\\007\" \"pid\" \"$(echo -n \"$$\" | base64)\"; exec /usr/bin/zsh"),
    },
}