Private_Tab icon indicating copy to clipboard operation
Private_Tab copied to clipboard

Toolbar button to toggle private mode

Open ghost opened this issue 9 years ago • 3 comments

Hi,

Private Tab includes a toolbar button to open a page in Private mode as well as an option to toggle private mode from the page''s tab menu.

Would it be possible to include a toolbar button which performs what the tab menu does, that is simply toggling Private Mode for the present page?

I've spent hours trying to at least create a bookmarklet which would simply perform a sendkeyevent, that is ctrl+alt++T in order to simulate private mode toggling, but unsuccessfully.

So, either a new toolbar button or the script to simulate ctrl+alt+t in order to create the bookmarklet/button would be much appreciated.

Thanks!

ghost avatar Aug 12 '16 16:08 ghost

This is not possible using bookmarklets: scripts with regular privileges can't access private things for privacy and security reasons... E.g. you can add private: before URL to load page in private mode, but only manually (or from some another extension). So, only privileged code can simulate hotkey, but privileged code can just use API: https://github.com/Infocatcher/Private_Tab#api-for-other-extensions

For Custom Buttons extension (for "code" section in the button editor):

privateTab.toggleTabPrivate(gBrowser.selectedTab);

Or just like checkbox in tab context menu:

document.getElementById("privateTab-tabContext-toggleTabPrivate").doCommand();

Infocatcher avatar Aug 19 '16 12:08 Infocatcher

OK- Thanks a lot, @Infocatcher

ghost avatar Aug 19 '16 20:08 ghost

A quick word to confirm that indeed the Custom Buttons Firefox extension (which I've discovered) together with

privateTab.toggleTabPrivate(gBrowser.selectedTab);

does the job I was aiming. Nice.

In fact I use two pages as "Home" pages, a customized Mozilla Firefox Start Page and the Super Start Firefox extension page, so being able to toggle each to Private Tab mode brings me extra comfort.

Thanks again for your efficient help, @Infocatcher

ghost avatar Aug 20 '16 11:08 ghost