WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Ondemand: append "$1" to command line?  (Read 1708 times)

Offline dentonlt

  • Sr. Member
  • ****
  • Posts: 318
    • the trombone analog
Ondemand: append "$1" to command line?
« on: November 10, 2010, 10:57:15 PM »
I'm using stock 3.2. Redirect me if this has already been mentioned - I couldn't find it in the forum.

If I call an 'ondemand' item from a running program, then the stock ondemand script does not pass arguments on first call. For example:

  • Set leafpad to ondemand
  • Open pcmanfm
  • set leafpad %f as default text file viewer (right click, open with)
  • open a text file by double clicking

On the first time, that opens a blank leafpad window (expected). Later attempts pass arguments. Explanation:

On first call, pcmanfm calls something like:

Code: [Select]
/mnt/hda2/tce/ondemand/leafpad [filename]
But the ondemand script does not pass along any arguments:

Code: [Select]
[ $(which leafpad) ] && exec leafpad
Since pcmanfm has sent a filename as argument ... I've edited my ondemand script to read:

Code: [Select]
[ $(which leafpad) ] && exec leafpad "$1"
That pops open the file on first load. I make the same edit to other ondemand scripts: firefox, openoffice, geeqie, evince, etc. Notably document readers which being called from a file manager, or being called from the CLI with an argument.

I'm not sure if this is a 'desired option' or a 'necessary function.' Not all ondemand extensions will receive an argument on first call (if ever). Perhaps it is possible to check the extension's desktop/application file to see what type of application it is, and then append "$1" to the ondemand script if an argument is likely?

?

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Ondemand: append "$1" to command line?
« Reply #1 on: November 11, 2010, 01:24:59 AM »
Already done. See: Change log for v3.3rc1 http://forum.tinycorelinux.net/index.php?topic=7671.0
* Updated ondemand generated scripts to pass command line arguments.
10+ Years Contributing to Linux Open Source Projects.

Offline dentonlt

  • Sr. Member
  • ****
  • Posts: 318
    • the trombone analog
Re: Ondemand: append "$1" to command line?
« Reply #2 on: November 11, 2010, 01:28:34 AM »
Oops - I should get the current RC!  ::)