View Single Post
Old 08-16-2013, 02:44 PM   #1
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
kobo menu and message

I wrote two little tools and hope they might be useful for some people here.

The idea behind kobomenu is to let bash scripts interact with the user.
Example code:
Code:
mychoice=$(kobomenu Coffee Tea Cocoa)
The user will be presented with a list of the options Coffee, Tea, Cocoa, and EXIT to choose from. The variable mychoice will be set to the selected value. For how it looks, cf. kbmenu_001.jpg and kbmenu_003.jpg of post 2.

kbmessage can be used to display some text and offers zoom in and out.
Example code:
Code:
kbmessage 'Hello world!'
Example code:
Code:
kbmessage -f /mnt/onboard/mytext.txt
Example code:
Code:
choice=$(kobomenu Coffee Tea Cocoa)
if [ "$choice" != "EXIT" ]; then
   kbmessage "Your choice was $choice"
fi
For how it looks, cf. kbmenu_003.jpg of post 2.

kobomenu and kbmessage are depending on libraries and drivers provided by Sergey with his KoboLauncher.
If you call your script from the KoboLauncher the necessary environment variables are already exported.
If you call your script from a Qt neutral context you have to export the variables yourself and add the argument -qws when calling kobomenu or kbmessage. You can take KoboLauncher.sh as a model, or kobosubmenu.sh of kbmenuOnStart.zip of post 2.

I would like to thank Sergey for providing the drivers.
Attached Files
File Type: zip kbmm02.zip (21.7 KB, 592 views)

Last edited by tshering; 08-23-2013 at 12:15 PM.
tshering is offline   Reply With Quote