How can you close a window that was opened with tm-open-external-window?

Hi!

I know how to open an external window with tm-open-external-window. Here is an illustration using a button:

<$button>
<$action-sendmessage $message="tm-open-external-window" $param="https://mynoise.net/NoiseMachines/whiteNoiseGenerator.php" windowName="background_noise" windowFeatures="height=400, width=600"/>
Play background noise
</$button>

But I can’t see if there is any way to close this window from within my wiki? tm-close-window can close tiddlers opened with a windowID parameter, but there is no documented way to assign a windowID when using tm-open-external-window.

Can anyone help at all? :slight_smile:

Links:

What triggers the timer to start ?

A button. Though I only mentioned the timer to give an example of a specific use case, it’s not really relevant. I can see how it has made my question unclear so I’ve edit the original post.

The trigger is relevant because it might very well be possible to implement what you want without using an external window.

For example,put the following in a new tiddler:

Sound will be played when "''a''" is entered as the first and only character in the field:  <$edit-text tiddler=<<currentTiddler>> field="whatever" />

<$list filter="[{!!title}get[whatever]match[a]]">
    <audio autoplay muted>
        <source src="https://upload.wikimedia.org/wikipedia/commons/7/71/Open-mid_front_unrounded_vowel.ogg" type="audio/ogg">
        Your browser does not support the audio element.
    </audio>
</$list>

An external window opens a completely new browser, which can only be closed, if you close that new window. Closing any app from the browser is forbidden.

tm-open-window and tm-close-window can be used from the browser. But there is a difference. tm-open-window opens a “connected” window. I am not sure if that is what you want. The important parameter here is windowId

tm-close-window can not close a window which was opened with tm-open-external-window

The windowID can be almost anything, for example the tiddler name, which makes sense. Trying to open the the same window a second time should just bring the window forward.

Although not finished I made a window manager to list open windows in the side bar so you can return to them and or close them.

  • Of course we already have the Open in new window button
    • However I have used different display templates for similar buttons.