pomdtr / sunbeam

Elevate Your Command Line Experience.
https://sunbeam.sh
MIT License
269 stars 12 forks source link

Possible to clear (unfocus/hide) hyper window after selection has been made #92

Closed smetroid closed 3 months ago

smetroid commented 3 months ago

When using Sunbeam with the HyperTerminal, is it possible to remove the HyperTerminal screen/focus after running/executing a command?

Toggle the Hyperterminal window again to make it go away and back to the previous focused window.

For example, I have a base64 encode/decode script, that uses what's in the clipboard to encode/decode as necessary. I would like for the HyperTerminal window to go away once I run the script/command.

I really appreciate any help you can provide.

smetroid commented 3 months ago

Also, just an FYI on Fedora39/Wayland the HyperTerminal and Sunbeam show/hide shortcut appears to be working just fine.

pomdtr commented 3 months ago

Thanks for your feedback! It's the behaviour of the hyper plugin on macos, I'll see if I can fix it on linux.

How is the latency when hitting the trigger shortcut ?

smetroid commented 3 months ago

Re: lagging ... Once HyperTerminal and Sunbeam start, there is no lagging, that I can tell anyway. However, if I exit Sunbeam (by hitting ESC a few times), the HyperTerminal disappears along with Sunbeam. When I hit the HyperTerminal shortcut again, Sunbeam takes ~3-5 seconds to start. I've noticed this is the case with HyperTerminal and Sunbeam only, so as a workaround I try not to hit the ESC key too many times to the point where Sunbeam exists.

Sunbeam works fine within the Konsole terminal, when starting Sunbeam it starts within milliseconds, with no lag whatsoever.

smetroid commented 3 months ago

Update 1: If I exit the script, the screen will go away, however, if I open the HyperTerminal again, Sunbeam needs to start and therefore takes 3-5 seconds for it to start under HyperTerminal.

So in short, I think this is the intended behavior, on my scripts I just need to exit Sunbeam and the screen will go away as intended. However, when I start the HyperTerminal again Sunbeam takes 3-5 seconds to start, so I believe this is the lag you're speaking off?

Here is the simple testing script I created for testing purposes https://github.com/smetroid/sunbeam-extensions/blob/main/base64-encode-decode.sh

smetroid commented 3 months ago

Update2: After looking at this further and playing around with the hyper.js settings, I think the lagging is caused by starting a new session. If I start hyper.js it takes around 3-5 seconds to start on its own without Sunbeam (no shell arguments) being involved. Once the session has started Sunbeam can be started and stopped easily without issues. If there is a lag it's a very minimal lag, hardly noticeable.

So in short it seems like shell arguments are starting a new session as opposed to attaching to an existing/created session or the session that was initially started.

We can probably close this issue, I think we've determined that hyper.js and the shell arguments are the source of this problem, along with fixing the shell script above to exit Sunbeam once an action has been selected.

smetroid commented 3 months ago

I ended up using Zsh Shell with Hyper and it loads within a second ... give or take ... it could be faster IMHO. This works for now, but I am not sure we need to exit Sunbeam for the Hyper window to disappear/hide.

I think Sunbeam should be started again from the beginning, an action to hide the window after completing a command or running a script would probably be better.

Thanks for the help/guidance!