How do I prevent closing of locked tab?

Hi All,

I am looking for a option that could help me prevent a locked tab from being closed. I tried to search the forum, but none current solution seems to work on some but not all scenarios I have. So please give advice on what I can do to get all these covered:

  1. It should be an option, like a sub option under "Lock Tab", like perhaps "Locked (Cannot be closed)". Or at least it should be enabled with mouse click for each tab, because I don't want all locked tabs to be un-close-able..

  2. It should prevent all sorts of tab closing methods, include clicking the cross, double clicking, close by hot key (included customized hot keys), and closing by any of "close all tabs" method.

  3. It should be an option to enable or disable prompt on closing attempt, that it is prevented.

I believe there must be some quite magical script that enables this for me but I still think it should be an function provided by the program because I feel it is way too complicated.

However, because I am limited by my search abilities, if you could find a simple solution that does all above, please do let me know!

Thank you in advance!

I thought there was a script on the forum (could be wrong) where if a tab was set to a certain color it couldn't be closed, but I cannot find it ATM.

I've written a quick and dirty version, extremely basic. I will improve it later when I have more time, so that it will not rely on the tab color to be enabled/disabled but instead a button/menu item as you've pointed out.

Script functionality...
If the tab is locked and is set to the color red (255,0,0) the tab will not close. As of right now you must unset the color first to close the tab.

To change the color, edit the script (255,0,0) (red,green,blue)

tab_lock_no_close.zip (453 Bytes)

This is a good function! I use locked tabs a lot and sometimes i middle click by accident and the user gets no verification if it happens. Sometimes i have more than 12 tabs open and i lock some of them and when i try to close some tabs by rapidly clicking sometimes my fingers misfire. I work at an energy provider and i use a lot of different folders tabbed.

This script add-in blocks closing locked tabs:

2 Likes

Hey yonder,
Thanks for your script! It works quite much to my need except there's no prompt but I guess I am fine as long as a color is on the tab. I think I would still want to request for official function support because this reuse of coloring the tab is not going to be helpful to all when one is using color in some ways. However, again, thanks for your script!

The script I linked just above your reply uses the lock state instead of color, so you should already be able to do what you want (I think?).

1 Like

I tried this, thx for sharing Leo! Works great for me.

1 Like