View Single Post
Old 06-15-2015, 04:59 PM   #351
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
fmon and kbmenupngs

fmon is a program provided by sergeyvl12. One can tell fmon to watch a certain file and launch a certain script as soon as any process accesses the file. For instance if you run fom by calling "fmon myimage.png yourscript.sh" (for the sake of brevity I omit here the path names), fmon will watch myimage.png. If any program (for instance nickel) opens myimage.png, fmon will start the script yourscipt.sh.

When you start nickel from KSM by selecting "start nickle", KSM looks in the folder .adds\kbmenu\fmonsh for script files. If it finds any script files, it looks whether there are png files of the same name in the folder kbmenupngs. If there is such a png file, KSM checks whether this file is already in the database that is used by nickel. If it s in the database, KSM calls fmon against this png file and this script file. For instance if there is the script file exit_nickel.sh and the image file exit_nickel.png, it will call fmon against those to files. If you select in nickel exit_nickel.png, nickel will try to open it, fmon will start exit_nickel.sh, and exit_nickel.sh will close nickel.

One problem is that sometimes nickel tries to access a file even if you do not try to open it. This can happen if nickel needs to create thumbnails. Let us image you start nickel, and at this point nickel is going to place exit_nickel.png as a tile on the home screen. For this purpose it has to create a thumbnail of exit_nickel.png. In order to do this nickel opens exit_nickel.png. Therefor fmon start exit_nickel.sh. exit_nickel.sh closes nickel. You try to start nickel again, nickel tries to put exit_nickel.png on the home screen, and so on and so on.
To break this circle you can start nickel via: tools > kobo diverse.msh > start nickel no fmon.sh. In this case KSM will start nickel without involving fmon, and nickel can open the concerned png files and create thumbnails of them.

Two important things:
1) If you want that a certain script is started if you open x.png from nickel, put it in the folder kbmenupngs, and put a script x.sh in the folder .adds\kbmenu\fmonsh. Note that nickel has to be aware of the png file and write concerning information into its database. Therefore, copy the png file to the reader while connected to the pc by nickel (rather than via KSM "enable usb"). The png will be "activated" the next time you start nickel.

2) If nickel does not start as usual, start it via tools > kobo diverse.msh > start nickel no fmon.sh. After the next reboot, nickel should start normally again.
tshering is offline   Reply With Quote