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:
/mnt/hda2/tce/ondemand/leafpad [filename]
But the ondemand script does not pass along any arguments:
[ $(which leafpad) ] && exec leafpad
Since pcmanfm has sent a filename as argument ... I've edited my ondemand script to read:
[ $(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?
?