How to create a desktop launcher for NodeJS TW5 in linux mint/ubuntu/debian?

398 views
Skip to first unread message

Riz

unread,
Jan 2, 2017, 9:06:47 AM1/2/17
to TiddlyWiki
hese are the things I already tried.

Creating a .desktop file with
exec=tiddlywiki /path/to/my/wiki --server 8081 & xdg-open http://127.0.0.1:8081

This quit without executing.

Then I created a bash script with the same command and call it via the launcher, that closed out too. Finally I added $SHELL to the end of bash script. This one opens the firefox and navigates to the url, but no tiddlywiki.

Launcher File contents
[Desktop Entry]
Version=1.0
Type=Application
Terminal=true
Exec=bash path/to/my/wiki/serve.sh
Name=Something
Icon=Some Icon




Bash File Contents
#!/bin/bash

tiddlywiki main
-wiki-server --server 8081 & xdg-open http://127.0.0.1:8081
$SHELL



I do have the necessary permissions. Both files are marked executable. The command works when given independently in a terminal. 

Xavier Cazin

unread,
Jan 2, 2017, 9:19:30 AM1/2/17
to tiddl...@googlegroups.com
Hi Riz,

You should probably try to replace & (execute in background) with && (execute next command if the previous one is successful).

Cheers,
X.

-- Xavier Cazin

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscribe@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/446bb72b-bfbd-42c3-a61a-ad5e6369139f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rizwan Ishak

unread,
Jan 2, 2017, 9:25:29 AM1/2/17
to tiddl...@googlegroups.com
In which case the command to open Firefox will only be executed after we close the tiddlywiki server.  I just tried it for the sake of surety. 

You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/L-NJYWgaSgM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+unsubscribe@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

Mark S.

unread,
Jan 2, 2017, 11:14:33 AM1/2/17
to TiddlyWiki
Do you check your process list to see if the server is running in the background?

What happens if you just launch the server without the browser? Maybe without "?" so you can catch any errors.

Likewise if you just launch the browser?

Good luck!
Mark

Riz

unread,
Jan 2, 2017, 12:41:32 PM1/2/17
to TiddlyWiki

Hi Mark,


The bash script works when we launch it from terminal as "sh /pathToScript/serve.sh"

It does not work when I run it using double clicking the serve.sh or launch it via the desktop launcher. The browser outputs the "Unable to connect" message.

The opening browser part of the command is not the villain. Error persists when it is removed,

The jobs command to view any background jobs and fg command to bring any background jobs to foreground turns up empty. There are no process either which says anything like node or tiddlywiki. I am not sure if I should be checking anything else.

Mark S.

unread,
Jan 2, 2017, 1:04:49 PM1/2/17
to TiddlyWiki
If you change your script to take out the final "?", does it show any error message?

Riz

unread,
Jan 2, 2017, 1:09:52 PM1/2/17
to TiddlyWiki
Hi Mark

The Final "?"  - is there a question mark anywhere in that script? I couldn't find it

Mark S.

unread,
Jan 2, 2017, 1:47:17 PM1/2/17
to TiddlyWiki
Sorry. Meant ampersand &

Jed Carty

unread,
Jan 2, 2017, 3:42:33 PM1/2/17
to TiddlyWiki
While it doesn't open the wiki directly, have you tried tiddlyserver? https://groups.google.com/d/msg/tiddlywiki/QOoceRMdABE/IlJDtzsABgAJ

Riz

unread,
Jan 2, 2017, 9:47:54 PM1/2/17
to TiddlyWiki


No that does not work either.

I tried removing the entire second part of the command and just "tiddlywiki /path/ --server". While the command works well when typed in terminal, putting it in a bash script and  double clicking to open it does not work.

So I went on to clone blog edition from github repo which had the same kind of serve.sh. Can someone download the same, try to launch the serve.sh in it by double clicking, and confirm that it is not a issue at my end. If it is an issue at my end, there is no point disturbing you people with it.

phew, all I wanted is to create a shortcut with an icon to launch the TW5.

On Tuesday, 3 January 2017 00:17:17 UTC+5:30, Mark S. wrote:
Sorry. Meant ampersand &

Riz

unread,
Jan 2, 2017, 10:09:03 PM1/2/17
to TiddlyWiki
Yeah, it was an exciting development. However it had a few issues.

Last time I checked, I have to keep my tiddlers inside the Tiddlyserver folder. That means I have to carry around an extra 60MB and sync it with Dropbox too.
It had a few bugs, like not being able to import the themes other than the default ones.
I couldn't get my head around how to customize its appearance. By default it was, hmmmm, not very pleasing to eye.

And honestly, I need nothing fancy. We already know bash scripts can launch TW5 when we execute the script by calling it from a terminal. Just get it to do the same when double clicking it, or ideally by calliing it from a launcher must be easy for someone who is familiar with tiddlywiki and bash.

Mark S.

unread,
Jan 2, 2017, 10:23:27 PM1/2/17
to TiddlyWiki
There's so many varieties and setups in Linux. Are you using Nautilus for your file browser/launcher by any chance?


Good luck!
Mark

On Monday, January 2, 2017 at 6:06:47 AM UTC-8, Riz wrote:

Riz

unread,
Jan 2, 2017, 10:49:42 PM1/2/17
to TiddlyWiki


Mint comes with Nemo as the default file browser.  That is relevant how?

Mark S.

unread,
Jan 2, 2017, 11:17:47 PM1/2/17
to TiddlyWiki
With nautilus there is an additional step to make a script executable. Don't know if that's true with Nemo.

Good luck,
Mark

Riz

unread,
Jan 2, 2017, 11:41:45 PM1/2/17
to TiddlyWiki
Extra step? I did "chmod +x script.sh" to give myself the necessary permissions. I might be wrong, but I do not think this varies with file browsers.

Mark S.

unread,
Jan 3, 2017, 12:53:03 AM1/3/17
to TiddlyWiki
No, a truly extra step. You have to change behavior in the file browsers preferences.

Riz

unread,
Jan 3, 2017, 1:34:20 AM1/3/17
to TiddlyWiki

Hi Mark

The script is getting executed. There is no issue there. For example if I create a script as

firefox https://www.youtube.com
 and direct a launcher to it, firefox dutifully opens up and navigates to youtube

Now if instead I put
tiddlywiki /path/to/wiki --server
 nothing happens.

Again if the script has
tiddlywiki /path/to/wiki --server
firefox https
://www.youtube.com
 firefox opens up youtube.com

So there must be something that must be added to the tw command, some parameter or something, to keep it running?







and create a launcher for that and click, firefox dutifully opens and navigates to youtube. While 127.0.0.1:8080 is still unable to connect.

BJ

unread,
Jan 3, 2017, 4:49:08 AM1/3/17
to TiddlyWiki
you may need a delay to let node start:

tiddlywiki main-wiki-server --server 8081 &  (sleep 1; xdg-open http://127.0.0.1:8081)

Rizwan Ishak

unread,
Jan 3, 2017, 5:07:21 AM1/3/17
to tiddl...@googlegroups.com
BJ
,
Well, we are getting closer I guess. When I used your command, the terminal opened, started the server, but after 1 sec it closed itself before moving on to the next command. I feel this is what has been happening all along. It is not that the server is not starting, instead, it is getting closed the moment it is pushed to the background. I checked if it was running in the background with fuser 8081/tcp. Nope, it is closed.

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/L-NJYWgaSgM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+unsubscribe@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

BJ

unread,
Jan 3, 2017, 5:57:46 AM1/3/17
to TiddlyWiki
this works for me

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Terminal=false
Type=Application
Name=test
Exec=/bin/bash -c "tiddlywiki main-wiki-server --server 8085 &  (sleep 1; xdg-open http://127.0.0.1:8085)"

To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

BJ

unread,
Jan 3, 2017, 6:10:41 AM1/3/17
to TiddlyWiki
This is the contents of test.desktop

Riz

unread,
Jan 3, 2017, 12:39:45 PM1/3/17
to TiddlyWiki
BJ

Thanks for the help. I don't know why it did not work for me, but I finally got a different setting to run using a cli called parallel. Again, thanks for being patient.

Ste Wilson

unread,
Jan 3, 2017, 1:58:14 PM1/3/17
to TiddlyWiki
I was going to suggest nohup to let the server keep running even if the terminal window closes but you have beaten the problem.
Reply all
Reply to author
Forward
0 new messages