arpandaze / scratchpad-rs

Floating Scratchpad for Yabai Window Manager
32 stars 0 forks source link

Application didn't launch error msg even though it did (Alacritty) #4

Open tlvenn opened 8 months ago

tlvenn commented 8 months ago

Hi,

Trying to use Scratchpad and whatever I am trying it with (target title vs app), the command always spawn the floating window properly but does not manage to detect it did.

thread 'main' panicked at src/scratchpad.rs:67:21:
Application didn't launch within timeout period!
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Any idea what the issue might be ? Thanks in advance.

Env: Sonoma 14.3 / Yabai 6.0.12

tlvenn commented 8 months ago

This seems to happen only with the launch_type command. I tried the example with Discord app and the command returns properly however when I execute the command again, it does not hide away the discord scratchpad.

tlvenn commented 8 months ago

My alacritty test config

[[scratchpad]]
name = "alacritty"
target_type = "title"
target = "AlacrittyScratchpad"
position = [290, 175]
size = [1100, 700]
launch_type = "command"
launch_command = "/etc/profiles/per-user/tlvenn/bin/alacritty --title AlacrittyScratchpad"
tlvenn commented 8 months ago

Ha ignore the Discord issue, did not realize the test was done on which window has the focus and I am triggering the command from a terminal instead of skhd so of course discord loose the focus..

tlvenn commented 8 months ago

If i query yabai myself, it does not return Alacritty even though there is a floating alacritty window on the space which explains why Scratchpad fails to see it as well I guess.

❯ yabai -m query --windows | jq '.[].app'
".kitty-wrapped"
".kitty-wrapped"
"Discord"
"Floorp"

If i start Alacritty manually and toggle it to float then yabai sees it properly:

❯ yabai -m query --windows | jq '.[].app'
"Alacritty"
".kitty-wrapped"
".kitty-wrapped"
"Discord"
"Floorp"
arpandaze commented 8 months ago

Thanks for reporting the issue @tlvenn. Seems like you are using self compiled alacritty. I just tested multiple configurations. Only case that I fould when yabai fails to detect alacritty window is when launching alacritty binary compiled with make binary. Running binary inside of Alacritty.app works but not standalone binary for some reason.

This Works: Compiled with: make app Config:

[[scratchpad]]
name = "alacritty"
target_type = "title"
target = "AlacrittyScratchpad"
position = [290, 175]
size = [1100, 700]
launch_type = "command"
launch_command = "**/alacritty/target/release/osx/Alacritty.app/Contents/MacOS/alacritty --title AlacrittyScratchpad"

This Doesn't: Compiled with: make binary Config:

[[scratchpad]]
name = "alacritty"
target_type = "title"
target = "AlacrittyScratchpad"
position = [290, 175]
size = [1100, 700]
launch_type = "command"
launch_command = "**/alacritty/target/release/alacritty --title AlacrittyScratchpad"
arpandaze commented 8 months ago

It appears to be Alacritty issue as suggested by yabai's creator in this thread: https://github.com/koekeishiya/yabai/issues/1250#issuecomment-1255709045

tlvenn commented 8 months ago

Ha good finding ! Ya I use Nix so it's indeed self compiled. The good news is I actually use Kitty, was merely trying to check the examples with Alacritty to make sure I was not making a mistake somewhere and I probably was given that now I can make everything works with Kitty.

Super happy, awesome to have scratchpads with kitty and yazi, thanks for this project.