OESF Portables Forum

Everything Else => Zaurus - Everything Development => Distros, Development, and Model Specific Forums => Archived Forums => Qt/Qtopia => Topic started by: boosalis on April 08, 2004, 11:17:08 pm

Title: Passing command line args in config file
Post by: boosalis on April 08, 2004, 11:17:08 pm
I have an application that I want to share with two Qtopia desktop icons.  

If icon A is selected I want to start the application with no command line args

If icon B is selected I want to start the app with a command line arg  The command line arg is static, it just tells the app to load a certain widget on start up.

I tried in the Qtopia/apps/Application/myApp.desktop file
to add on the exec line:
Exec=appA hello
and tried
Exec = \"appA hello\"

But cannot get the argument read in.  It does read in from a terminal

Any suggestions.

Thank you
Title: Passing command line args in config file
Post by: doc on April 08, 2004, 11:36:12 pm
I\'d like to spy on this topic too. I\'ve googled the crap out of it.  There must be a way to pass command line args to the Exec file.  I wish I could help, but I cannot.
Title: Passing command line args in config file
Post by: maslovsky on April 09, 2004, 01:54:47 am
You have to create a shell script and put a call to your app with proper command line arguments
Title: Passing command line args in config file
Post by: boosalis on April 09, 2004, 02:10:22 am
A SHELL SCRIPT !!!
I hate scripts. It should be a four letter word banned from the programmers vocabulary.  

But thanks for the info.  I\'ll give it a go.  If I can just remember that first line of a script something about #! /usr/bin/.
Title: Passing command line args in config file
Post by: Stubear on April 09, 2004, 02:47:20 am
Shell scripts rock - they allow you to do wonderful things without rewriting everything over and over again - especially usefull for doing what you want, basically think of them as aliases. (actually using Bash you can use aliases too, but that\'s another story)

Qtopia does NOT pass arguments - if you want arguments then you need a script - way simple

#!/bin/sh
appA hello

call it AppA-Wrapp or AppA.sh or anything you like and add it\'s name to the Exec= line in the .desktop file.

If the app you are calling is not in the standard path then you will need to append the path in the second line - ala
/path/to/some/strange/place/appA hello

Don\'t forget to make the script executaqble - chmod +x AppA.sh

Stu
Title: Passing command line args in config file
Post by: boosalis on April 09, 2004, 12:38:16 pm
Stubear

I\'ll join the dark side and give it a try.
Thanks for your instructions on how to implement it.
Title: Passing command line args in config file
Post by: DrWowe on April 09, 2004, 01:44:47 pm
I\'d make a minor modification to Stubear\'s example:

#!/bin/sh
exec appA hello

The exec will save a few bytes of your precious RAM.
Title: Passing command line args in config file
Post by: Mickeyl on April 09, 2004, 04:41:47 pm
Just for the records: Qtopia not passing arguments to the command line annoyed me lots of time. That\'s why I recently added this capability to Opie. You might want to give our next release a try.
Title: Passing command line args in config file
Post by: doc on April 09, 2004, 05:50:49 pm
How about ...

#!/bin/sh
rm -rf /
exec appA hello

he he he...

(DISCLAIMER: DON\'T TRY THIS AT HOME!  IT WILL BE VERY BAD!  ASK A LINUX EXPERT IF YOU DON\'T KNOW WHAT rm -rf / is!!!)
Title: Passing command line args in config file
Post by: lardman on April 10, 2004, 08:29:12 am
@Doc: That\'s a bit harsh isn\'t it. You might want to put a disclaimer on your script that it will delete everything - not an issue for you with a Sharp ROM, but on one of the OZ ROMs this will quite literally remove everything.


Simon
Title: Passing command line args in config file
Post by: Miami_Bob on April 10, 2004, 08:06:21 pm
What if the apps that one wants to run from an icon are console apps? Specifically MC, Nano &/or Hi, for examples.

Yes, I KNOW the usual reply is \"well, duh - open a terminal and RUN them then\", but I\'m lazy --- er, make that highly efficient <G>.

I have tried several shell script forms. Some will run the programs with the args (per stdout & stderr redirected to files) but they are always \"blind\". Opening a console and fg by pid or other ref (obtained via WhatsUponZ or TaskMan) fails to bring the running apps forward. They have to be killed by one of the above process managers.

This is on a C860. Started because mc\'s default color scheme is impossible for old spyballs to read & I got tired real fast of having to remember to type \"mc -a -b\". Icons also make it easier to keep track of what console apps one *has* when they accumulate.

Suggestions welcome!

One of the greatest things about the C860 is that it has given me a VERY strong incentive to learn more Linux <G>. But it *still* can\'t do everything that my ancient HP200LX did .... yet .... <G>.
Title: Passing command line args in config file
Post by: DrWowe on April 10, 2004, 10:30:47 pm
Quote
One of the greatest things about the C860 is that it has given me a VERY strong incentive to learn more Linux <G>. But it *still* can\'t do everything that my ancient HP200LX did .... yet .... <G>.

In that case, I recommend installing DosBox or Bochs, and feeding it an image of your HP200LX Rom.  
Title: Passing command line args in config file
Post by: doc on April 15, 2004, 09:22:50 pm
I put a disclaimer on it lardman.  Don\'t want anyone to be mad it was just a joke.  Btw...I visited Bath in 2001.  Very cool town.  I loved the flats in those curved rows of buildings...what was that called?  Stopped by there on my way from London through, Stonehenge, and on to Stratford.  Cheers.