1

This might be simple but I cant think of an easy way to create the following behavior:

  • launch a gui app (say gimp) from a terminal emulator (e.g alacritty)
  • have the gui app temporarily replace the terminal window (rather than leave it hanging around) and pass focus to the gui app
  • then upon exit of said gui app have it return to the same terminal session showing the gui apps std output and all history and put the focus back

Ideally I want to be able to do this as an alias for specific applications but I'm open to other options. If its not simple maybe someone can point me in the right direction to RTFM

SwiftD
  • 245
  • It's not easy in the sense of one solution fits all terminal emulators, but you can try this alias example as a starting point for Gnome terminal alias gimp='gimp && gnome-terminal & exit' ... No output history though (either use a terminal multiplexer like screen or redirect output to a file and restore it later) ... That also might not open a new terminal upon exit if there is another one already open ... this although not directly related, but can be useful with e.g. tput – Raffa Oct 15 '23 at 06:07
  • Can you explain why this isn't what already happens? If I have a terminal open and launch a GUI command from it, that appears on top of existing windows, and usually has focus. If I then close it, I am back at my terminal which was just behind it. Does it bother you that the terminal is still open in the background? Do you just want it to be minimized automatically? – terdon Oct 15 '23 at 13:39
  • @Raffa that's where I've been sniffing... im already running tmux around every terminal emulator launch to pull out any previous session on launch, this means next terminal launch pulls up the output (not what I want). I will have a look at throwing the terminal into a separate named session when launching gui app and pulling that back out as needed but I still don't really like the transition of closing the terminal emulator and reopening.... but I guess I need to fight with a window manager for that as im assuming tmux cant run my gui app in a window – SwiftD Oct 15 '23 at 19:56
  • @terdon minimising (or similar) is an option. I would prefer not to have it hanging around in any way. I use a tiling window manager and don't currently have any function to minimise windows (and i quite like it that way). You may be right that this is something that needs to be managed from the window manager end though – SwiftD Oct 15 '23 at 20:02
  • Ah, then please mention that you are using a tiling window manager, and which one. That is a very important detail. – terdon Oct 15 '23 at 20:52
  • @terden I was hoping for an independent solution if possible (session based/switch to background and revert)... I'm using Hyprland atm but I would prefer the solution wasnt tied to it (Im fickle with my WMs) – SwiftD Oct 15 '23 at 22:40

0 Answers0