Jelmerro / Vieb

Vim Inspired Electron Browser - Vim bindings for the web by design
https://vieb.dev
GNU General Public License v3.0
1.29k stars 61 forks source link

Option to prevent pinned tab from suspending automatically #495

Closed chunleng-woven closed 8 months ago

chunleng-woven commented 1 year ago

Checklist

Addition or change

I found that pinned tabs are usually the tabs that I access frequently and it will be nice if they don't suspend, as compared to normal tabs (Willing to try and contribute if this option is sound

Alternatives considered

Jelmerro commented 1 year ago

This is a good suggestion, but I'm wondering if we should make it exclusively allow pinned tabs with a toggle or if we can make this into a setting that can be used to control which tabs get excluded from this via some sort of list, perhaps one that allows url patterns and such. Though I do also think that just excluding pinned/regular tabs from this should be easy.

chunleng-woven commented 1 year ago

Good thought there, both pinned and url pattern method sounds feasibile imo. I think each feature probably has its target audience. The pinned method for explicit control and the url pattern for controlling how the browser works.

I am not sure for other users, for me, if I have many tabs and if I am going to search for a tab of a certain url pattern, I don't usually do that and usually just open the page with a shortcut key mapping like this. But I think it will definitely work for things like chat apps, email and calendar.

Pinned tabs can be more naturally since intuitively you can see a group of tabs that you choose to make sure it's there. If a user uses pin, I assume he will likely pin the chat apps, email and calendar. Also, there are other ways I use pin can be beneficial when the tab doesn't close. Sometimes I can have adhoc tabs that I pin to track stuff, (maybe the current status of my CI jobs, food delivery) sometimes I use it to pin the ticket I am working on (Which can be tricky for URL pattern to handle since I require a moving subset of URL patterns based on what I am doing currently)

Jelmerro commented 1 year ago

I guess a list setting with patterns that are excluded from auto-suspending would work, where some of the patterns can be special values such as s:pinned, s:muted (as in muted by the user), s:silent (as in, no audio playing) etc for various tab states that you would likely want to target in bulk and would rarely be valid as a url pattern. We can use the various flags used for :h ranges as a source of inspiration as to what special values should be in this list besides allow regex patterns.

Did you want to work on this yourself or do you want me to work on this later?

chunleng commented 12 months ago

Did you want to work on this yourself or do you want me to work on this later?

I guess I can take on this one =)

chunleng commented 12 months ago

I looked through and thought that maybe we can design by reusing this searching algorithm.

So basically it will be a setting call suspendtimeoutpattern and it has the following specifications:

As I will make this search algorithm common between ranges and suspendtimeoutpattern, flags p and q will also be made available for range after this patch

What do you think?

Jelmerro commented 11 months ago

I'm very sorry @chunleng I completely missed your comment in my notifications! Yes, this sounds like a solid implementation for this feature, I would say go for it. Do let me know if you have further questions, and feel free to make a draft PR before it's ready so I can provide early feedback on it if desired.

Jelmerro commented 9 months ago

You can test it out using this commit: https://github.com/Jelmerro/Vieb/commit/3d4361d7ce875e9c937f94cc876b8161302dda8e or wait for the next stable release.

Jelmerro commented 8 months ago

Added in 10.5.0 :tada: