gobble icon indicating copy to clipboard operation
gobble copied to clipboard

Crash when trying to gobble terminal that isn't focused

Open SeerLite opened this issue 11 months ago • 4 comments

Describe the bug If the terminal isn't focused when the new window is opened, gobble crashes leaving the command running in a weird state where the terminal/stdin is shared between the called shell/program and the gobbled command.

To Reproduce Steps to reproduce the behavior: Having mpv installed, run the following expression in a shell. While sleeping, minimize/unfocus all windows.

sleep 5; gobble mpv --force-window --idle

Expected behavior gobble doesn't unmap/hide any windows nor does it exit to the shell/calling command. mpv runs as if it was called directly.

Additional context Version 1.3 from nixpkgs

SeerLite avatar Mar 05 '24 04:03 SeerLite

Reproduced (with Konsole, on X11, GNOME, Manjaro = stable Arch x64 Linux, current main (68cb9c562b69ffd8152cd409ec1afd68253399f4) installed with makepkg -si). image

(UPDATE: I've moved the previous content about terminal-specific behaviour to #12.)

peter-lyons-kehl avatar Mar 08 '24 00:03 peter-lyons-kehl

Hi @EmperorPenguin18, if this issue is confirmed, suggest re-using some code from https://github.com/Liupold/pidswallow. Its README.md > Features says: "Based on process hierarchy (don't care about window focus)". (Plus, Liupold/pidswallow is also Arch-friendly, AUR-distributed.) Though, that requires the child window ID - can we get it in any way?

If that would slow gobble too much, maybe there could be two executables (rather than an option, which makes it awkward). For example gobble (current behaviour) and gobble-any-focus?

peter-lyons-kehl avatar Mar 08 '24 01:03 peter-lyons-kehl

FYI same problem with Devour (an older alternative, written in C, even less maintained, unfortunately): https://github.com/salman-abedin/devour/issues/39.

peter-lyons-kehl avatar Mar 09 '24 17:03 peter-lyons-kehl

I can reproduce the issue and have pushed a change to main. Try it to see if that fixes the crash for you. I have a feeling this may be window manager dependent, because I had to jump through some hoops to be able to manually iconify a window.

EmperorPenguin18 avatar May 01 '24 16:05 EmperorPenguin18