Hi!
I was wondering if that can be done with some code. And someone on reddit already had a script for that. But won't work for TST tabs. Quote:
sure, I have a script for it. instructions here.
edit: oh, btw it seems it doesn't work for tree style tabs. that extension makes its own context menu within the sidebar browser, which fully unloads every time the sidebar is closed, making it extremely difficult to add a menu item to it. the only way I can think of is to make an extension and hook the menu creation to use runtime.sendMessage to make a menu item when the extension makes its menu items.
but I don't think that's going to work, since this script won't work as an extension, it requires privileged modules to generate the document fragment for the recently closed tabs/windows lists and the localized menu labels. which won't be instantiated in an extension sandbox. I did a bit of research and it looks like I might be able to use the "ExtensionTestUtils" to create an invisible system extension, which would have access to the runtime API I'd need, but I'm not sure that would have access to any global objects either. and it seems like a lot of work too, I'd be basically building an entire extension file system sandwiched inside a script lol. it sounds kinda silly but oddly enough, it appears in the firefox source code several times, I guess it's used frequently for testing extensions.
if anyone has any ideas or info for making this work, I'd be happy for any feedback, I'd definitely prefer if the script worked for TST too
So @piroor (or anyone really) do you think there's a better way to do it?
There are some existing addons providing "recently closed tabs" menu to the tab context menu working with TST completely:
I've looked the userChrome.js script and I thought that the functionalities can be implemented via WebExtensions API. The method sessions.getRecentlyClosed() returns both closed tabs and windows. Thus you can provide a "recently closed windows" menu, with a filtered results of the method.
I cannot recommend you to do like that with the userChrome.js way - it requires very deep knowledge and continuous struggling around inner codes of Firefox itself. The answer is buried there: https://searchfox.org/mozilla-central/ Of course I can investigate that by myself (yes it is one of my job) but I have no private motivation about such a futureless thing... Instead I recommend you file feature requests to bugzilla.mozilla.org to add genuine WebExtensions APIs to do something currently impossible.
Oops I forgot to answer to the subject of this issue. Sorry but I have no plan to add such an menu command as a built in feature, because Firefox's tab context menu does not have that and it beyonds the project scope of TST.
There are some existing addons providing "recently closed tabs" menu to the tab context menu working with TST completely:
* [Undo Close Tab](https://addons.mozilla.org/firefox/addon/undoclosetabbutton/) * [Undo Closed Tabs Menu](https://addons.mozilla.org/firefox/addon/undo-closed-tab-menu/)I've looked the userChrome.js script and I thought that the functionalities can be implemented via WebExtensions API. The method sessions.getRecentlyClosed() returns both closed tabs and windows. Thus you can provide a "recently closed windows" menu, with a filtered results of the method.
I cannot recommend you to do like that with the userChrome.js way - it requires very deep knowledge and continuous struggling around inner codes of Firefox itself. The answer is buried there: searchfox.org/mozilla-central Of course I can investigate that by myself (yes it is one of my job) but I have no private motivation about such a futureless thing... Instead I recommend you file feature requests to bugzilla.mozilla.org to add genuine WebExtensions APIs to do something currently impossible.
In case you were curious, I did eventually manage to make it work without the extensions API. Though you're right, this one really was a constant struggle lol.
Btw, while I'm here, I noticed that the TST icon on the sidebar switcher target supports -moz-context-properties now, which is great. But the same icon appears in the "Tree of tabs" menuitem in the context menu, which doesn't have any fill or -moz-context-properties defined. So for me it's a black icon on a dark blue background. I fixed it for my own purposes but I was wondering if this is because it's impossible for you to set the style of the menuitems with an extension.
I don't know if there are any variables exposed to extensions that reflect global attributes like lwtheme-textcolor="bright" but I've seen other extensions that actually swap PNG images based on the theme, so they couldn't be relying on -moz-context-properties to do that. I suppose you could run a media query for prefers-color-scheme, it's not a perfect reflection of the UI theme but it's probably better than nothing. Then instead of setting the fill you could just swap between an icon with hardcoded black and an icon with hardcoded white fill. Anyway that's just a minor issue, just thought I'd send some feedback while it's on my mind.
@aminomancer I've tried dynamically generated SVG icon and it looks to work as expected, thus I've introduced a change 702376c to apply the icon color or the text color defined by the active theme without context="fill". Thanks!
Awesome, looks like a great change
@mzso can you close this item given there are workarounds and there is no planned work?
@piroor I think this can be closed.