Tw5 notificaiton via local file read

57 views
Skip to first unread message

Jared Lettau

unread,
Jun 26, 2019, 8:52:29 PM6/26/19
to TiddlyWiki
To facilitate syncing across devices, I've created a local bash script to monitor the ~/Downloads folder to move them to my ~/Dropbox/Apps/Quine/TiddlyWiki/ folder. Once there, the Dropbox service automatically uploads the current version. Right now this script launches other scripts (DBstatus.sh, wikiXFER.sh) then tails a file where child scripts log their actions. Below shows the the console output, which is tailing the status file.

$ ~/status.sh
TimeStamp                       SYSTEM        SCRIPT         STATUS
Wed Jun 26 17:22:44 PDT 2019    Dropbox       DBstatus.sh    started
Wed Jun 26 17:22:44 PDT 2019    TiddlyWiki    wikiXFER.sh    started
Wed Jun 26 17:22:44 PDT 2019    TiddlyWiki    wikiXFER.sh    Watching
Wed Jun 26 17:22:44 PDT 2019    Dropbox       DBstatus.sh    Up to date
Wed Jun 26 17:23:05 PDT 2019    TiddlyWiki    wikiXFER.sh    Found
Wed Jun 26 17:23:05 PDT 2019    TiddlyWiki    wikiXFER.sh    Moved
Wed Jun 26 17:23:05 PDT 2019    TiddlyWiki    wikiXFER.sh    Watching
Wed Jun 26 17:23:05 PDT 2019    Dropbox       DBstatus.sh    Syncing "TiddlyWiki.html"
Wed Jun 26 17:23:05 PDT 2019    Dropbox       DBstatus.sh    Uploading "TiddlyWiki.html"...
Wed Jun 26 17:23:10 PDT 2019    Dropbox       DBstatus.sh    Up to date

I'm trying to find a way to show this status within TW so I can make this script a service and still have a seamless way to monitor the results. Is there a way to basically tail -f a local file in tw5? Ideally, I'd like to integrate into the top margin of tw, so that updates are displayed as they are logged in the local file. I'm using Firefox Quantum for Fedora 67.0.4 (64-bit). Any ideas?

This isn't an issue on my Win machines since I'm using TiddlyDesktop.

I've tried:
- Gnome no longer supports building custom tray indicators/icons (with any semblance of ease).
- notify-send works, except it instantiates a new alert with every invocation, which is terribly annoying in rapid succession.
- Looked into https://tobibeer.github.io/tw/enable-js/#script, but this puts JS into the tiddler... I'd have to open/refresh the tiddler to see the status, which is less convenient than running the bash script

Any suggestions are welcome.

TonyM

unread,
Jun 26, 2019, 10:36:25 PM6/26/19
to TiddlyWiki
Jarad,

I presume this is a single file tiddlywiki. Are you serving it or opening the file in the browser?

Unix is not my natural home. If your logged content is in a file where the tiddlywiki is installed have you tried using the html object tag in a tiddler?

<object width="400" height="400" data="helloworld.txt"></object> 

I tested this and it retrieves the content of helloworld.txt in both file and TiddlyServer served wikis.

However you need to refresh the tiddler to see updates (eg edit/View, Close/open the tiddler.

Regards
Tony

Jared Lettau

unread,
Jun 26, 2019, 11:45:58 PM6/26/19
to TiddlyWiki
Wow. that was incredibly simple. I'm looking into where/if I can add this into the margin of tw5.

Since the save location is synced by Dropbox, if I keep writing logs to this file then Dropbox keeps syncing, which writes more logs.... So I created a symlink to the actual file. The other way to do it would be to tell the Dropbox service to exclude that log, but the symlink is cleaner.

Thanks Tony!

</jared>

TonyM

unread,
Jun 27, 2019, 2:38:00 AM6/27/19
to TiddlyWiki
Jarad,

Your welcome. In the side bar it may not refresh for any reason, only when the wiki is loaded. 

Add this to yourtiddler above your object to refresh on demand, Note how I am not relying on currentTiddler because it is not available in the sidebar.
Place things in the side bar with the tag $:/tags/SideBarSegment or $:/tags/SideBar on yourtiddler.

<$button set="An object!!last-refresh" setTo=<<now "0hh:0mm">> >
Refresh {{yourtiddler!!last-refresh}}
</$button>

<object width="400" height="100" data="helloworld.txt"></object>

If you want this automatic look for trigger widgets plugin, and refresh with a timer.

Basically writing to the field results in a refresh.

Regards
Tony
Reply all
Reply to author
Forward
0 new messages