noctuid / tdrop

A Glorified WM-Independent Dropdown Creator
BSD 2-Clause "Simplified" License
1.12k stars 44 forks source link

Fix for Wezterm dropdown toggle failing to work whenever it spawns a new process. #418

Closed Vagr9K closed 1 year ago

Vagr9K commented 1 year ago

When Wezterm is launched with a custom configuration path (for example: wezterm --config-file="$HOME/.config/wezterm/wezterm.dropdown.lua") it causes the new instance to be launched in a new process.

Other options, such as setting a custom class/window names also cause Wezterm to create a new process instead of reusing the existing one.

On latest Git version of tdrop this causes timeout errors combined with duplicate dropdowns being spawned on toggle, as long as there is a Wezterm instance running in the background.

This seems to have been caused by this commit.

Steps to reproduce:

Workarounds

Commenting out (https://github.com/noctuid/tdrop/blob/master/tdrop#L810) fixes the issue but breaks the behavior for wezterm instances running in the same process.

Keep in mind that it takes a while for the new Wezterm process to spawn, so when running pgrep at that line, only the already existing PID gets captured, not the new one.

The possible fix

The change in this PR fixes the problem on my end, without breaking the behavior for single-process Wezterm instances. That being said I'm not sure if this is the best solution in this case.

noctuid commented 1 year ago

Thanks for the PR. I think this may be fine, but I'm interested in wezterm and will try it out more sometime in the next month or so and see if there happens to be some better solution.

noctuid commented 1 year ago

Wezterm is awesome. Goodbye tmux.

Yeah, this is the right approach. I re-arranged it a bit and added some extra commentary, so it looks like github didn't detect the merge, but it should be fixed. Thanks for pointing this out. It looks like the issue also happened when using connect unix.