I seem to recall being able to use a button with tm-open-window a second time to reopen the window again.
- Anyone know how we could make this happen?
- tm-close-window works so perhaps I could close then open again but that seems wasteful
I seem to recall being able to use a button with tm-open-window a second time to reopen the window again.
Is your problem that the new window gets hidden behind the main window?
See https://tiddlywiki.com/#WidgetMessage%3A%20tm-open-window
If you add a unique “windowID” it should use the same window
It remains behind whe I attempt to use the open widow message the second time, yes.
Yes I did - I mased the window ID on the parm “by default”.
Will revisit tomorrow
I will bump this topic by mentioning why I want this.
I cannot as yet re-open a window and have it brought to the front
If I can resolve this gap it would be possible to build a fully featured (sub) window manager into tiddlywiki to manage an unlimited number of windows, not dissimilar to Gimp if you have used that. Such windows can;
Even better would be if we could do the same or subset of this with tm-open-external-window
then it could become a real windows manager for browser windows.
BASIC Anywhere Machine relies heavily on open windows.
Opened via menu items. If a window gets lost, pressing the menu item brings the window back up again.
Try it: Open BAM, click on the Project Menu, click “View Preprocess Code”. Hide the “Preprocess Code” window behind other windows. Go back to BAM, and click on the menus to show the already open but hidden “Preprocess Code” window.
If what works for me A-1 does not work for you, then there’s either a device or browser difference. I’m using a Chromebook. Well, BAM is a TW5.2.3 instance, so differences could be attributed to TW versions behaving differently.
Thanks @Charlie_Veniot your example has led me to discover the problem is on my computer at least, in FireFox only, it works in Chrome and Edge.
I will research further.
The JS function used is window.open()
. May be you find something at: Window: open() method - Web APIs | MDN
Thanks @pmario that is a good reference, and it suggests it should be working in FireFox but there are a few possibilities that could be interfering.
I see also;
Makes a request to bring the window to the front. It may fail due to user settings and the window isn’t guaranteed to be frontmost before this method returns.
There seems to be a simple fix for FF. I’ll create an issue at GH and post a PR with a fix soon. Thx for reading through it. I did completely miss the .focus()
function.
The PR preview (not production) can be found at: TiddlyWiki — a non-linear personal web notebook
I did test it with FF and Edge on Windows 11.
Fantastic @pmario
Can you possibly give me the changed tiddler(s) so I can use a “monkey patch?” to develop a window manage while we wait?
The changed file can be found at: tm-open-window set focus to existing window by pmario · Pull Request #7708 · Jermolene/TiddlyWiki5 · GitHub