WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Menu at Startup  (Read 2721 times)

Offline mtc

  • Newbie
  • *
  • Posts: 24
Menu at Startup
« 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
--------------

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Menu at Startup
« Reply #1 on: May 25, 2011, 03:48:57 PM »
Use wbar or use a script in .X.d to run a script in an aterm.

Offline danielibarnes

  • Hero Member
  • *****
  • Posts: 548
Re: Menu at Startup
« Reply #2 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.

Offline mtc

  • Newbie
  • *
  • Posts: 24
Re: Menu at Startup
« Reply #3 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. :)
« Last Edit: May 25, 2011, 06:31:24 PM by mtc »

Offline danielibarnes

  • Hero Member
  • *****
  • Posts: 548
Re: Menu at Startup
« Reply #4 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.

Offline Lee

  • Hero Member
  • *****
  • Posts: 645
    • My Core wiki user page
Re: Menu at Startup
« Reply #5 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.  :)

32 bit core4.7.7, Xprogs, Xorg-7.6, wbar, jwm  |  - Testing -
PPR, data persistence through filetool.sh          |  32 bit core 8.0 alpha 1
USB Flash drive, one partition, ext2, grub4dos  | Otherwise similar

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11049
Re: Menu at Startup
« Reply #6 on: May 26, 2011, 01:51:15 AM »
Just to avoid deps, doing things like that is rather fast in fluid.
The only barriers that can stop you are the ones you create yourself.

Offline danielibarnes

  • Hero Member
  • *****
  • Posts: 548
Re: Menu at Startup
« Reply #7 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.