RFC Window manager in 5.3.3 coming soon

Tiddlywiki has long had the feature that allows you to open a tiddler in a new window, It has a range of uses, I am not confident too many people know, for example if you open a table of contents in a new window, it becomes a separate window on your device that can remote control the parent wiki, click on an item and it will open in the parent wiki.

  • I am writing a window manager tool to share and celebrate the release of tiddlywiki 5.3.2 now 5.3.3

You see until now it was easy to loose a window once opened, especially on my two screen desktop and with a lot of windows open. However we now have all the pieces of the puzzle to build a Window manager, for tiddlywiki’s open in new window, given the following “bug fix”;

fixed - WidgetMessage: tm-open-window when opening an existing window to bring it to the front and focus it

  • This means we can easily return to the open window without returning to the tiddler first, especially after other windows end up being in front.

I have raised this “Request For Comment” (RFC) if anyone would like to influence the resulting solution and to raise a question.

Planned functionality;

  • Open any tiddler in a window (remains in the story)
    • Optionally another button, Open any tiddler in a window and close that tiddler in the story, eg move tiddler to window.
  • Capture a list of all opened windows in a sidebar list, sidebar segment select widget, and/or menu item.
    • This allows you to open/reopen find a window anytime
    • Able to close the window, or close and remove from the open window list.
  • Maintain a list of previously opened windows so you can reopen them without first finding the tiddler.

What other features can you think would be helpful?

What do you think having a “Window Manager” implies?

Do we want a similar set of tools for " tm-open-external-window" as well?

  • I am still to research the possibilities here

Background
The default open in new window typically only renders and displays the text of the tiddler in question.

  • This is often enough, however if you rely on various elements introduced by the view template tags you will not see them in the new window.
  • In the past I remedied this by creating another button which also applied the view template items to the new window, as a result things like footers also appeared.
  • If we want the option to open a tiddler in a window or move the tiddler we may need another two buttons?

Here is are some specific questions I would like feedback on;

Should we have a choice of one, two or even four buttons, can we do with only one ?, and which do you think you would most often want to use?

  • Open new window With or without the full view template in the window (Less the title and buttons) and with or without closing it in the story?

Do you have any icons that you think represents these different new window buttons?

More for the technically minded

1 Like

A big feature request for me (I haven’t filed an issue about this yet) is that the new windows can’t contain too much editability.

For example, an EditTextWidget in the new window doesn’t behave the way users might expect. It may give the “Red Screen of Error”, or constantly lose keyboard focus.

What I’d love is the ability to open new windows that are “complete” from a TiddlyWiki user perspective.

I did create an edit in window in the past, but have not tested it recently, I will check its working and add an edit in new window, within this Window manager as well. However It would be nice if you can open in the widow and toggle edit if needed.

There is the old new window and new edit window package, which does not include the do be developed with the window management involved. new-windows.json (13.7 KB)

  • Only briefly tested

That is what I mean by

Including the title and toolbar within it,
has issues because some buttons are not valid in that context. But I would be happy for you to provide details for inclusion in the ultimate solution.

Perhaps a dropdown menu listing the range of choices would make sense, and stop the proliferation of similar buttons?

I certainly didn’t know that! I can imagine a lot of uses for it, although I usually tend to prefer to remain in a single window.

  1. Peter mentioned editability. I can really see opening the tiddler editor in a separate window. there are many times I would have found that incredibly helpful.

  2. At one quick test, I found I could not load new content into an existing window. It would be nice if that were possible. (It probably is. I simply haven’t seen the technique.)

Can you illustrate this?, Windows I have created have being sensitive to changes in the wiki and updated, so I am not sure how one would “load new content”.

With 5.3.2 we can jump back to a window.

I did use this mechanism some time ago for some videos. See: https://youtu.be/5dhQh6lOikM?list=PLuiC_HFhI4OxO7BAiKMp7psz9g0PBQBd-&t=44

It’s very handy for examples, if you want to show the workflow and the wiki at the same time

1 Like

If I create a new tiddler on the main site with this content:

<$button>Load "Table Of Contents" in Demo Window
<$action-sendmessage 
  $message="tm-open-window" 
  $param="TableOfContents"
  windowId="myWindow123"
  windowTitle="Demo Window"
  width="640"
  height="480"/>
</$button>

<$button>Load "Hello There" in Demo Window
<$action-sendmessage 
  $message="tm-open-window" 
  $param="HelloThere" 
  windowId="myWindow123"
  windowTitle="Demo Window"/>
</$button>

I can load the first window without a problem. I would expect that the second one, using the same title and id, would load its content into the initial window, replacing TableOfContents with HelloThere. Instead it loads a second window with the same title. (In several tests, the second button seemed to do nothing at all, but I can’t reliably reproduce that behavior, and I didn’t save the exact version of the buttons with that behavior.)

This may just be an unrealistic expectation on my part. Window handling in JS has always been problematic, and I may just be misremembering the possibilities.

Oddly, the windowID attr gives the production window.name = "external-myWindow123" (odd because the genesis was not tm-open-external-window).

As we both know, you need to somehow address external-myWindow123 but I don’t see how right now.

I’m pretty sure it must be kept internally, since we also have tm-close-window, which will need to keep a reference. I haven’t done much with windows in JS in years, but if I remember correctly, there is no way to look up a window by name; you have to keep the reference from when it was created.

(But I also don’t remember details of how to change content of such a window in JS. It might be one of those things that still requires document.write <shudder>.)

Your intuition is sound:

Ok, there was a problem with this code. When I fix it by replacing both instances of WindowId with the correct WindowID, then the second button does nothing.

Now I can successfully close the window with tm-close-window, and can get something close to what I was looking for by combining a close and an open:

<$button>Load "Table Of Contents" in Demo Window
<$action-sendmessage 
  $message="tm-close-window" 
  $param="myWindow123"
/>
<$action-sendmessage 
  $message="tm-open-window" 
  $param="TableOfContents"
  windowID="myWindow123"
  windowTitle="Demo Window"
  width="640"
  height="480"
/>
</$button>

<$button>Load "Hello There" in Demo Window
<$action-sendmessage 
  $message="tm-close-window" 
  $param="myWindow123"
/>
<$action-sendmessage 
  $message="tm-open-window" 
  $param="HelloThere" 
  windowID="myWindow123"
  windowTitle="Demo Window"
  width="640"
  height="480"
/>
</$button>

But this is not reusing the existing window. Instead it’s removing the existing one and loading a new one with the same name and id. This is a problem if I’ve moved or resized the window and simply want to update it with new content.

… period.

I made the same mistake with windowId → windowID . My thinking: “id” is not an acronym. CamelCase, yEs, all-caps, no.

I don’t know if you’re going to succeed without resorting to JS and some kind of messaging between them. Are you on node? Fetch maybe? (I’m just lobbing these at you without much thought).

I don’t have a particular usage in mind, just recalling some of the things I did with multiple window JS projects – most of them around 20 years ago. Basically Tony showed us something I didn’t know was possible, and I was just kicking the tires. (Gotta get back to our automotive analogies, right?!)

I think it would be possible, with a tweak to tm-window-open by inserting srcDocument.open() right before the lines Jeremy mentioned, although I haven’t tested this.

Scott I have not attempted what you have done and my example solution is around managing tiddler s as individual windows. The manager tab makes use of saved tiddler titles to reopen windows.

To achive the same outcome what ever tiddler you open in a window you can write that tiddler to be sencitive to some other value in the wiki and change its output rather than change windows.

I hope this makes sense but I will try and include an example in the proof of concept.

  • I am starting to think, so I don’t have too many buttons that one button for which you select open (and retain tiddler in story) OR open and close tiddler in story (move to window) with the non-default available via ctrl-click.
  • Then perhaps an alt-click to do the same to edit in the new window.
    • Herte the default can be open in new window for edit leaving the tiddler in the story as the “preview” of your edits.
  • Any thoughts, anyone?
  • I have also found multiple windows a problem for myself too, but believe this may have been because I could not return to, or find them, I hope perhaps this solution may make this more practical, we will see.
  • I am thinking of providing an optional mechanism where rather than open the current tiddler in a new window we open a special tiddler, with the current tiddler given to it for display, thus you could change is as needed simply by updating the tiddler name somewhere, eg the current focused tiddler.
    • An example may be a “current project window” and as you switch project it changes, one window, one purpose, display multiple tiddlers.

Finaly

  • Another feature we may make available is opening windows use the left and top parameters.

Just an Update, I am continuing to develop this, currently off line and the state of play includes

  • Have manged windows working
  • Need to fix some artifacts in both the view and edit windows
  • Finding my code a little fragile in a few places.

I welcome anyone passionate about windows management to work with me, on this :nerd_face:

Summary of “state of play” Window management tool for TiddlyWiki, especially on multi-screen desktops, that;

  • Lets you keep track of open windows
  • Open and reopen them from the master wiki
    • No hunting for a window
  • Close windows selectively or all from the master wiki
  • Move a tiddler from the story into a window
  • Open for edit in a window
  • Open with the full view template or cascade applied

Examples of where the lack of sophisticated templates for open in new window has arisen once again Link Preview hypertext technique - #34 by TW_Tones

  • This is contributing to delays with this project.

I have started a new tiddlyhost site for this https://window-manager.tiddlyhost.com but it remains a work in progress.

@Peter see the edit in window here Window manager — a non-linear personal web notebook its still not perfect but it illustrates it.

1 Like

This works well. Unusually, I can’t reproduce something similar on TiddlyWiki.com. How are you getting editing working?

Here are my steps:

  1. Create a new tiddler (PeterTest1) with these contents:
<$button>
New Window With Editor
<$action-sendmessage 
  $message="tm-open-window" 
  $param="PeterTest2" 
  windowTitle="My Window Title"
  width="640"
  height="480"
  something="This is my new window. There are many like it, but this one is mine." />
</$button>
  1. Create another tiddler (“PeterTest2”) with these contents:
Hi!

<$edit-text/>
  1. Open PeterTest1 and click the button. Try to edit text.

I notice when I do this that the text area loses focus after each character.