Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variants to only quit current focus / tab? #5

Open
MaxNeedsSnacks opened this issue Dec 29, 2024 · 1 comment
Open

Variants to only quit current focus / tab? #5

MaxNeedsSnacks opened this issue Dec 29, 2024 · 1 comment

Comments

@MaxNeedsSnacks
Copy link

Hey, thanks for this plugin first off, it's been really great for me especially, since I tend to be a little bit too zealous with pressing my quit bind (and forgetting I had a download or update running in another tab 🙃)!

One thing I was wondering whether it'd be possible to do was to only quit the current focus or tab with a confirmation message, since right now zj-quit is only able to quit the entire session at once. This obviously won't be a big issue for most people, but if you wanted to say, replace your native terminal's tabs and splits with zellij then you may want for it to warn you when you are about to close an important tab, as well.

One possible idea I've had here was to add a "scope" config option which defines what kind of quit message is sent back to zellij ultimately, i.e.

zjquit location="https://github.com/cristiand391/zj-quit/releases/download/0.3.1/zj-quit.wasm" {
        confirm_key "y"
        cancel_key "Esc"
        scope "Session" // can also be "Focus" or "Tab", "Session" is the default to preserve existing behaviour
}

That way, if I for example wanted to have different quit prompts for certain keybinds, I would just import the plugin three times with different aliases and configs. I've already tried to tinker with the plugin a little bit to get this to work locally, though I think for the tab and focus scopes we need to save which pane was active before the plugin was invoked (if that's even possible? Sorry I'm... not exactly the most knowledgeable person when it comes to the inner workings of zellij), since the focus obviously shifts when the prompt is launched.

@cristiand391
Copy link
Owner

I've been thinking about this for a while (I'm mostly interested in tabs, panes could work tho) but as a separate plugin, was waiting for support for headless plugin (added in 0.41.0) and for someone to ask for this 😁

Dumping thoughts/ideas out of my brain:
This should be a new headless plugin, you update your keybinds to close current tab/pane to send msg to it (AFAIK there's no way to intercept API calls, that's why zj-quit requires you to redefine the Quit keybind), features:

  • Allow to "pin" a tab/pane so it can't be accidentally deleted (so, no prompts like in zj-quit)
  • Allow to re-open a closed tab (plugin can dump the current layout, keep the tab layout in memory for a bit so you can CTRL + SHIFT + T to recover it)
  • maybe a UI like this? (screenshot from firefox's Recent browsing tab:
    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants