Tiny Core Linux

General TC => General TC Talk => Topic started by: mtc on May 25, 2011, 03:39:09 PM

Title: Menu at Startup
Post by: mtc on May 25, 2011, 03:39:09 PM
I am looking for a way to create a menu when Tinycore starts up. My goal is to show the menu, I choose an option and it runs whatever I choose then closes the menu. Any help is much appreciated. Thank you.

Menu
--------------
A. Firefox
B. Thunderbird
C. Remote Desktop
D. Terminal
E. Shut Down
--------------
Title: Re: Menu at Startup
Post by: gerald_clark on May 25, 2011, 03:48:57 PM
Use wbar or use a script in .X.d to run a script in an aterm.
Title: Re: Menu at Startup
Post by: danielibarnes on May 25, 2011, 05:02:59 PM
Tcl/Tk is ideal for this. Simply arrange a sequence of buttons. To have it execute when X-Windows starts, save the following as /home/tc/.X.d/popupmenu

wish << EOF
button .b1 -text "Firefox" -command {exec /usr/local/firefox/firefox &; exit}
button .b2 -text "Thunderbird" -command {exec usr/local/thunderbird/thunderbird &; exit}
grid .b1 -row 0 -column 0
grid .b2 -row 1 -column 0
EOF

You will need the tcl and tk extensions loaded. You can change various properties, like window location and borders to suit your preference. Just google for Tcl/Tk tutorials.
Title: Re: Menu at Startup
Post by: mtc on May 25, 2011, 06:23:20 PM
Daniel, the script works exactly how I want it to. Thank you.

The locations of firefox, thunderbird, rdesktop, etc were incorrect. So I made the required changes and rebooted. My changes were not saved. It reverted back to the popupmenu that i had originally created with the wrong locations and missing buttons.

I have made the changes and saved the file as both root and tc. Am I missing something on why it did not save my changes? Do I need to save it somewhere else too? Thank you.

Edit: I did not have the "Backup" option selected when I rebooted. All settings saved just fine when "Backup" is selected. :)
Title: Re: Menu at Startup
Post by: danielibarnes on May 25, 2011, 06:35:45 PM
Quote
The locations of firefox, thunderbird, rdesktop, etc were incorrect.

Yeah, that was just a template to get you going. I tested the first entry with the minefield extension instead of the official firefox.

Quote
Do I need to save it somewhere else too?

It sounds like you are storing a backup file. Use "filetool.sh -b" to back up your files manually. All of the files listed in /opt/.filetool.lst will be included.
Title: Re: Menu at Startup
Post by: Lee on May 25, 2011, 07:03:58 PM
Quote
Tcl/Tk is ideal for this....

Well,  that was easy.

That one little example gave me the goods to put together my own custom control panel, something I've been wanting to do for a while now.  It also gave me a great starting point for learning tcl and tk, something I that's been on my to-do list for -years- but never got around to.  Thanks for the round tuit.  :)

Title: Re: Menu at Startup
Post by: curaga on May 26, 2011, 01:51:15 AM
Just to avoid deps, doing things like that is rather fast in fluid.
Title: Re: Menu at Startup
Post by: danielibarnes on May 26, 2011, 10:33:49 AM
Just to avoid deps, doing things like that is rather fast in fluid.

I did not know about fluid. I will take a look at that. Even though I've never written Tcl/Tk scripts before, I knew it could be done. I created an example in a few minutes with vi.