enricozb / popup.kak

Kakoune popup plugin
22 stars 2 forks source link

Popups immediately close #4

Closed jtrv closed 11 months ago

jtrv commented 1 year ago

I'm not sure what the issue is but when I try using popups they all seem to immediately close.

enricozb commented 1 year ago

What OS are you using?

chriselrod commented 11 months ago

I have the same issue. OS: I tried both Fedora and Clear Linux TERM: foot Window manager: DWL. Uses Wayland and I have not enabled XWayland.

Does this require X? I have noticed electron apps, for example, open and immediately close if you don't force them to use Wayland.

I am running with fish as the default shell, running kak in it. I have tmux installed and available on path, but have no existing sessions.

enricozb commented 11 months ago

Thanks for the OS info. X should not be needed, I use popup.kak over ssh on a machine that does not have X. I have a hard time reproducing this over docker, but I'll try on fedora.

chriselrod commented 11 months ago

Okay, let me know if there's anything else I can do to help.

enricozb commented 11 months ago

Sigh. I still can't reproduce this. It works fine on docker on a non-root user:

docker run -it fedora
# in docker container...

dnf install -y kakoune tmux rust cargo git
useradd test-user && su test-user
cd ~

cargo install kak-popup

mkdir -p ~/.config/kak/autoload
git clone https://github.com/enricozb/popup.kak ~/.config/kak/autoload/popup.kak

export PATH=$PATH:~/.cargo/bin

kak
# inside kakoune...

:popup bash
image

Did you install kak-popup and make sure it's in your path?

enricozb commented 11 months ago

Additionally, is there any debug output in the *debug* buffer?

jtrv commented 11 months ago

What OS are you using?

Sorry, I thought I responded to this issue already, I am on Arch Linux using Alacritty with Fish shell.

I've followed the instructions in the README, tried both cork.kak and manually sourcing, and made sure kak-popup is on my path. I have tried fish -N to rule out any fish plugins/config conflicts. I have tried kak -n -e 'eval %sh{kak-popup init}' to make sure it is not a kakrc/plugin conflict. I have also tried the above tests with wezterm, kitty, and bash to the same effect. I have no output in my debug buffer in any case. I'm not sure of how else to troubleshoot or debug this further.

chriselrod commented 11 months ago

My debug buffer is also empty. I built kak from source, but that probably shouldn't matter. I have

> echo $RUSTFLAGS 
-C target-cpu=native -C strip=symbols

I don't think that should be an issue. Strip is bad for debugging of course, but I don't think I'm likely to get a stack trace anyway. Maybe trying build an unstripped version, and attach gdb to kak with set follow-fork-mode child?

EDIT: My gdb-foo isn't that strong. I tried

> gdb kak
(gdb) set follow-fork-mode child
(gdb) r -n -e 'eval %sh{kak-popup init}'

but the only thing that seemed to do is make fish lose its cursor, so I needed to restart the terminal. Not setting the fork mode lets me enter kak and run the popup, but then I don't get any diagnostics related to kak-popup, only kak itself.

enricozb commented 11 months ago

I am on Arch Linux using Alacritty with Fish shell.

This is so close to my setup. I'm on NixOS with fish shell and alacritty as a terminal. The fact that there is no output in the debug buffer is surprising.

Can both of you (@jtrv and @chriselrod) try the following and report back:

  1. Open two terminals.
  2. Terminal 1:
    • Run kak
    • Type :echo %val{session} %val{client} %val{window_width} %val{window_height}
    • Take note of the line that was printed.
  3. Terminal 2:
    • Run the following:
      kak-popup \
      popup \
      --debug \
      --kak-session ${your_kak_session} \
      --kak-client ${your_kak_client} \
      --width ${your_width} \
      --height ${your_height} \
      fish
  4. You should see a popup on the kakoune side, or some output on the terminal 2.

You should see some output like this:

image
jtrv commented 11 months ago

This had the same effect, blank tmux window briefly flashed. The *debug* buffer in Terminal 1 and the output of Terminal 2 are identical:

kakoune::debug: waiting for quit
kakoune::debug: refresh::step: tmux display exited with non-zero status: exit status: 1, err: no server running on /tmp/tmux-1000/default

kakoune::debug: done waiting
kakoune::debug: failed to kill tmux session 1697839357992550816: tmux kill-session exited with non-zero status: exit status: 1, err: no server running on /tmp/tmux-1000/default

kakoune::debug: exiting popup
kakoune::debug: error: Capture::handle_output

Caused by:
    0: status
    1: No such file or directory (os error 2)
chriselrod commented 11 months ago

I have the same output:

> kak-popup \
                                              popup \
                                              --debug \
                                              --kak-session 67239 \
                                              --kak-client client0 \
                                              --width 319 \
                                              --height 105 \
                                              fish
kakoune::debug: waiting for quit
kakoune::debug: refresh::step: tmux display exited with non-zero status: exit status: 1, err: no server running on /tmp/tmux-1000/default

kakoune::debug: done waiting
kakoune::debug: keys::step: quitting
kakoune::debug: failed to kill tmux session 1697846636965795490: tmux kill-session exited with non-zero status: exit status: 1, err: no server running on /tmp/tmux-1000/default

kakoune::debug: exiting popup
kakoune::debug: error: Capture::handle_output

Caused by:
    0: status
    1: No such file or directory (os error 2)
enricozb commented 11 months ago

This is so weird, I've had this happen before where tmux doesn't start for some reason. I'll investigate thanks a ton for the outputs.

chriselrod commented 11 months ago

If I start tmux so that a server is running, I get

> kak-popup \
                                              popup \
                                              --debug \
                                              --kak-session 67239 \
                                              --kak-client client0 \
                                              --width 319 \
                                              --height 105 \
                                              fish
kakoune::debug: waiting for quit
kakoune::debug: refresh::step: Failed to parse: {       "size": {         "width": ,         "height":        },       "cursor": {         "x": ,         "y":        }     }

Caused by:
    expected value at line 1 column 36
kakoune::debug: done waiting
kakoune::debug: failed to kill tmux session 1697852648201323459: tmux kill-session exited with non-zero status: exit status: 1, err: can't find session: 1697852648201323459

kakoune::debug: exiting popup
kakoune::debug: error: Capture::handle_output

Caused by:
    0: status
    1: No such file or directory (os error 2)
enricozb commented 11 months ago

@jtrv out of curiosity what output do you get if you have tmux running in another terminal as well?

@chriselrod This is more unexpected, what version of tmux are you running (tmux -V)

chriselrod commented 11 months ago
> tmux -V
tmux 3.3a
enricozb commented 11 months ago

Okay so I'm back with some changes and suggestions. I've published a v0.5.0 that should start the tmux server even if it isn't running yet.

Can either (or both) of you please try the following:

  1. In one terminal: tmux -L kak-popup new-session -s testing -d bash \; set-option -g remain-on-exit on (this will start the server and make sure that panes don't exit after dying)
  2. kak and then :popup fish or some other shell/command.
  3. If you have a pane that is dead appearing, you can exit it with <c-space>.

Please tell me what appears, if anything.

Mine looks like this for example:

image

After testing please do tmux -L kak-popup kill-server so you don't have any orphan tmux server running.

chriselrod commented 11 months ago

I do get a pane. At the top, it says

bash -c $'fish    ; echo $? >$\'/tmp/.tmp9mqltL/status\''

while at the bottom of the pane, it says Pane is dead (status 0, date), just like in your screenshot.

Using other commands yield the same thing, e.g. :popup 'ls -l' yields

bash -c $'ls -l    ; echo $? >$\'/tmp/.tmpaYsomeotherrandomtmpfile/status\''
enricozb commented 11 months ago

progress, ok i'll take a look at these. any chance you could send a screenshot?

enricozb commented 11 months ago

Actually I might have figured it out. Does v0.5.1 work for either of you?

chriselrod commented 11 months ago

Actually I might have figured it out. Does v0.5.1 work for either of you?

Yes, I can confirm it works! Fish is my default login shell, set via chsh (/bin/sh is of course a POSIX-compliant shell, bash in this case).

enricozb commented 11 months ago

Awesome! Yep indeed that was it. Didn't even think about how tmux was running the commands through a shell (and idk why i did bash $-quoted strings for the top-level command). I'll close this issue for now, @jtrv let me know if it doesn't work so I can reopen this.

jtrv commented 11 months ago

Nice it works perfectly now! Thank you!