Timimi icon indicating copy to clipboard operation
Timimi copied to clipboard

Add minimal instructions to build native apps

Open YakovL opened this issue 5 years ago • 10 comments

Hi Rizwan,

could you also help a bit with building the apps themselves? I'm new to the ecosystem of Go and also I'm not aware of the toolchain used for creating native installers, so it would be lovely if you at least give some links or keywords so simplify this a bit. (I can see that Timimi.go files have different length for different OSes so I wonder if one has to test each one on the corresponding OS which is quite.. complicated thing to maintain; but may be I just don't understand something)

Best regards, Yakov.

YakovL avatar Jun 23 '19 21:06 YakovL

@ibnishak would you mind helping with this a bit? At least with pointing some direction to how to build and test go apps in general and what's the basic difference between different OS codebases (so that if I propose some changes for one, I can do so for others)

YakovL avatar Jul 26 '19 06:07 YakovL

K. I ll see to it this weekend

ibnishak avatar Jul 26 '19 22:07 ibnishak

Ok, here we are. Are we talking about the timimi.go files? If so, of course there is no difference between codebases for different OS. As for testing and building go apps, there are tonnes of guides written by experts on the subject matter.

ibnishak avatar Jul 28 '19 03:07 ibnishak

Are we talking about the timimi.go files? If so, of course there is no difference between codebases for different OS.

Well, there are several differences between https://github.com/ibnishak/Timimi/blob/master/os-gnulinux/timimi.go and https://github.com/ibnishak/Timimi/blob/master/os-windows/timimi.go and I can't say I understand all of them. Why 3 different files anyway?

What are those install-linux-chrome.go files? Why 9 of them? (for each OS/browser pair)

Is there some middleware to check out the messages between Timimi browser extension and the native app? One reason why I'd like to tweak the main app is that in TWC (and in TW5 I believe) we need an event firing not only on successful saving, but also on fail – so that we can notify a user that saving failed.

By the way, what is Scripts folder for? (in the installed Timimi folder)

As for testing and building go apps, there are tonnes of guides written by experts on the subject matter.

Most tutorials are about creating a server apps with go or about certain UI frameworks, neither of which seems to apply to Timimi. Well, I'll try to play around a bit, but I have some questions (for now I haven't succeeded with building/running the hello.go app on Windows, getting "Access is denied" on go run hello.go, some error when trying to start .exe created with go build hello.go and "CreateProcess() failed with error code 2" on GOOS=windows GOARCH=amd64 go build hello.go): is it this line which should create the .exe file? (on Windows, do I have to set some env variables?) What will happen if I start a patched Timimi.exe when Timimi is installed already, will it replace it? What controls Timimi being launched after OS restart?

YakovL avatar Jul 28 '19 21:07 YakovL

Hi

Why 3 different files anyway?

I do not manually manage the repository structure. I have automated build scripts to take care of that. Hence three different copies. In my development branch which I work at home, there is only one.

What are those install-linux-chrome.go files? Why 9 of them? (for each OS/browser pair)

They are exactly that - helper files which move the executables to proper locations. For each browser, the target folder is different in different OS. Hence the need to create one for each browser-OS pair. I wanted to user to jump through as few hoops as possible two install the app. So if you are a Firefox user, just download the Firefox zip file, launch the installer and be done. The other option was to have a combined installer, and during installation process ask the user to select which browser to install for. As I said, fewest number of hoops principle.

we need an event firing not only on successful saving, but also on fail

For that what need to be changed is not the golang part but the content.js. It needs to wait for reply from native application before firing the save-succees event. This is where I failed, for my JavaScript skills are practically non existent. Once the tiddlyfox protocol can do that, tweaking the golang code is a matter of editing 2 or 3 lines of code.

What will happen if I start a patched Timimi.exe when Timimi is installed already, will it replace it? What controls Timimi being launched after OS restart?

Timimi backend in completely hot swappable. There is no persistent process as far the native messaging backend is concerned. That is, if you change timimi.exe between 2 saves of a TW5 file, timimi will work as usual. Each call to timimi.exe starts up a new process, which is killed immediately upon completion of saving. Restarting the OS or even the browser is not required to test a new backend.

Ultimately the question is, is it useful. The community or the key players seem hardly interested. If the lion share of functionality is there, the cost benefit analysis of ironing out the wrinkles and fine tuning should be solely propelled by community demands, IMO.

ibnishak avatar Jul 29 '19 09:07 ibnishak

Hi Rizwan, thanks for clarifying,

I do not manually manage the repository structure. I have automated build scripts to take care of that. Hence three different copies. In my development branch which I work at home, there is only one.

Any particular reason to keep all those in the public repo? Are all the build scripts inside this repo? I can't see a single entry point for updating code and building, that's why I'm asking.

For that what need to be changed is not the golang part but the content.js. It needs to wait for reply from native application before firing the save-succees event. This is where I failed, for my JavaScript skills are practically non existent. Once the tiddlyfox protocol can do that, tweaking the golang code is a matter of editing 2 or 3 lines of code.

Yeah, I'll probably deal with that (that's actually #31). Still, I'll need to extend the backend part to enable file loading too (not needed in FireFox, but I hope I'll deal with #32 at some point and this is needed for TW/"tiddlyfox protocol" in general).

By the way, I wonder what Timimi scripts are. Are they shell scripts and supposed to work only in Unix?

Timimi backend in completely hot swappable. There is no persistent process as far the native messaging backend is concerned.

I see, thanks for clarifying!

Ultimately the question is, is it useful. The community or the key players seem hardly interested.

Is what useful? Is Timimi useful? Yes it is indeed. For some TWC users it's a lifeboat, some (like me) use it along with other solutions. Do you mean that Timimi is not popular in TW5 community?

YakovL avatar Aug 18 '19 15:08 YakovL

I wanted to port timimi to nixos, as I recently switched to it.

The only reference I could find about how to build timimi from source is this issue, however it seems that this questions stayed unanswered for 1.5 years:

Are all the build scripts inside this repo? I can't see a single entry point for updating code and building, that's why I'm asking.

maybe someone can clarify how to build the package from source

schlichtanders avatar May 04 '21 12:05 schlichtanders

maybe someone can clarify how to build the package from source

totally.

monomycelium avatar Sep 03 '22 15:09 monomycelium

I have a long-term plan to (re)write Timimi analog in js (using nw.js), but this requires learning/testing several pieces of tech (making nw.js app headless, communicating with IO streams, registering as a native app, communicating of an extension with it), so it's not a quick task – if anybody is interested in contributing, let me know.

Still, it would be nice to have a full "open sourced" pipeline for updating (building) Timimi.

YakovL avatar Sep 04 '22 06:09 YakovL

I think I've managed to build the Timimi host (not the add-on for Firefox)!

building

On an aarch64 Linux beast, I cloned this repository, built everything in the host directory, symlinked the timimi binary to the installer/unix directory, and build everything in that directory.

installing

Running ./timimiinstaller from the installer/unix, the program installed Timimi for me and now it seems to be working on Firefox.

commands

git clone https://github.com/ibnishak/Timimi # clone Timimi
cd Timimi/host
go build # build Timimi executable
cd ../installer/unix
go build # build installer
ln -sf ../../host/timimi ./
./timimiinstaller # install Timimi

conclusion

Timimi is amazing, and it can be built on any Unix machine as long as it can build Go. This is why I love open-source. Anyway, I'm sure there are many Timimi users out there who are forced to find an alternative because their computer's architecture does not support the Timimi binaries released. What if… we could ship this in AUR (the epic Arch User Repository) and GURU (like AUR, but for Gentoo)? I'm working on it right now, and I'd really appreciate your help.


about the add-on

You could actually build the add-on, but you'd need to get it signed. Check out this guide: https://extensionworkshop.com/documentation/develop/.

And for other platforms like nw.js, I guess you'd need to find out how you can implement the add-on into the app, using the manifest.json or something. And then tweak the host timimi.go for your app. I just realised my comment is pretty useless for your context.

monomycelium avatar Oct 14 '22 01:10 monomycelium