View previous topic :: View next topic |
Author |
Message |
DEinspanjer Red Pill
Joined: Jul 04, 2009 Posts: 9 Location: Salem, NH
|
Posted: Sat Jul 04, 2009 2:18 pm Post subject: Is it possible to start the spreadsheet portion of NeoOffice |
|
Whenever I need to create a new spreadsheet, I will do the following as demonstrated in the linked screencast:
1. Use Spotlight to open NeoOffice
2. Click the NeoOffice menu item
3. Change to Spreadsheet
4. Close the Text Document editor
http://screencast.com/t/8mMBZNek4
I'm wondering if there might be a way to create new spotlight entries like "NeoOffice - Spreadsheet" or change some preference such that it starts up by default because I use the spreadsheet much more than the text document editor.
Thanks for any ideas you might have.
-Daniel |
|
Back to top |
|
|
yoxi Cipher
Joined: Sep 07, 2004 Posts: 1799 Location: Dawlish, Devon
|
|
Back to top |
|
|
DEinspanjer Red Pill
Joined: Jul 04, 2009 Posts: 9 Location: Salem, NH
|
Posted: Sat Jul 04, 2009 8:48 pm Post subject: An alternate way to configure default arguments |
|
Thank you yoxi for pointing me at the docs. I spent a little time familarizing myself with the system and came up with the following alternative that I wanted to share with everyone.
Attached is a script similar to the ones currently found in the MacOS folder within the NeoOffice bundle. The difference with this script is that it can pick up the arguments to pass to NeoOffice from the application preferences through the use of the "defaults" Mac OS X utility.
I made a screencast to show it's installation, configuration, and use. Hope it helps someone:
http://www.screencast.com/t/tJf9lxerqH |
|
Back to top |
|
|
yoxi Cipher
Joined: Sep 07, 2004 Posts: 1799 Location: Dawlish, Devon
|
Posted: Sat Jul 04, 2009 11:51 pm Post subject: |
|
Thanks, that's another neat little solution for the tech-savvy - the only disadvantage I can see being (as with the other shell script options) that the user will have to reapply the solution after each main NeoOffice update (and quite likely after some patch updates, if they update the Info.plist file).
- padmavyuha |
|
Back to top |
|
|
DEinspanjer Red Pill
Joined: Jul 04, 2009 Posts: 9 Location: Salem, NH
|
Posted: Sun Jul 05, 2009 12:00 am Post subject: |
|
yoxi wrote: | Thanks, that's another neat little solution for the tech-savvy - the only disadvantage I can see being (as with the other shell script options) that the user will have to reapply the solution after each main NeoOffice update (and quite likely after some patch updates, if they update the Info.plist file). |
I agree it is a big disadvantage and that is why I hope the NeoOffice developers might consider making this script (or one based on it) the default CFBundleExecutable. If they did, then NeoOffice would continue to work as it does today for the normal user, but the occasional user like myself wishing to customize it to start calc by default or to not have it open an empty text document would have to do nothing more than to open up a terminal prompt and type:
Code: | defaults write -app NeoOffice DefaultExecutableArgs -calc |
or
Code: | defaults write -app NeoOffice DefaultExecutableArgs -nodefault |
And it would instantly work the way they wish.
It would also open up the path to future enhancements such as a panel on the preferences dialog to configure what application to launch by default. All the preferences dialog would have to do to persist the user's selection is just write the appropriate DefaultExecutableArgs value. |
|
Back to top |
|
|
yoxi Cipher
Joined: Sep 07, 2004 Posts: 1799 Location: Dawlish, Devon
|
Posted: Sun Jul 05, 2009 12:31 am Post subject: |
|
I was wondering about a PrefPane myself after looking at your script - that's a good plan, let's see what they say... do you know whether the script behaves the same way in all the OSX versions NeoOffice supports? (10.4/10.5/10.6) |
|
Back to top |
|
|
DEinspanjer Red Pill
Joined: Jul 04, 2009 Posts: 9 Location: Salem, NH
|
Posted: Sun Jul 05, 2009 12:44 am Post subject: |
|
I can't say with certainty since I don't have a 10.4 or 10.6 box available to test, but I would definately expect it to. The defaults program has been around since 2003, and the bash syntax used is bash 3 compatible. I suppose with a little work, it could be rewritten as an sh script, but I figured since bash is the default interpreter on OS X it was the right target. |
|
Back to top |
|
|
sardisson Town Crier
Joined: Feb 01, 2004 Posts: 4588
|
Posted: Sun Jul 05, 2009 11:52 am Post subject: |
|
Speaking only for myself, this sounds like a really good solution, and the first one, I think, that has kept in mind the current behavior and the need to preserve that if it were to become the default launch script.
Other things I like:
* It doesn't modify any OOo files, only Neo's Info.plist (one less patch to track)
* User defaults (which we already use other places, e.g. disabling gestures or the remote control) allow you to easily set an all-the-time default for yourself, without touching the binary at all (survives across patch updates)
* Supports command-line arguments for one-time use--which also allows others to write additional script-apps to stand in for separate component applications, which many users also want.
Unfortunately, we can't really add any items to NeoOffice's preferences (hacking the OOo prefs system is a nightmare, I understand, even before you have to worry about the 70-some locales), but "defaults write" is simple enough, and it's almost as simple to write an AppleScript "chooser" for people who'd want to change the component but are deathly afraid of the Terminal.
I don't know enough about how the launch sequence works to know if there are any gotchas we're not considering, though (opening files on the command line or via 'open'?), and, sadly, I don't know if Patrick's schedule will allow him to investigate.
Thanks for putting this together, Daniel!
Smokey _________________ "[...] whether the duck drinks hot chocolate or coffee is irrelevant." -- ovvldc and sardisson in the NeoWiki |
|
Back to top |
|
|
pluby The Architect
Joined: Jun 16, 2003 Posts: 11949
|
Posted: Sun Jul 05, 2009 12:20 pm Post subject: |
|
DEinspanjer wrote: | I can't say with certainty since I don't have a 10.4 or 10.6 box available to test, but I would definately expect it to. The defaults program has been around since 2003, and the bash syntax used is bash 3 compatible. I suppose with a little work, it could be rewritten as an sh script, but I figured since bash is the default interpreter on OS X it was the right target. |
I really like this idea as it is simple. Also, I don't even need a shell script nor will you need to fuss with the Info.plist. Reading a CFPreference (that is what the "defaults" command creates) is pretty trivial in the C code that we have so I was thinking that I would just add reading the proposed "DefaultExecutableArgs" CFPreference in NeoOffice's main() function.
Our main() function is already heavily customizeed to set the necessary environment variables for proper library loading so reading that CFPreference and tacking it onto any existing arguments should be pretty trivial.
I'll try to get a test patch out in the next day or two that has this change.
Patrick |
|
Back to top |
|
|
DEinspanjer Red Pill
Joined: Jul 04, 2009 Posts: 9 Location: Salem, NH
|
Posted: Sun Jul 05, 2009 12:22 pm Post subject: |
|
Since there was interest, I did a bit more digging around on what exactly the psn argument is, and it turns out it might be important depending on how NeoOffice is written. It is the "process serial number", described here: http://forums.macrumors.com/archive/index.php/t-69397/t-207344.html
So I modified the shell script to properly pass it along. Revised file is attached. |
|
Back to top |
|
|
DEinspanjer Red Pill
Joined: Jul 04, 2009 Posts: 9 Location: Salem, NH
|
Posted: Sun Jul 05, 2009 12:25 pm Post subject: |
|
pluby wrote: | I really like this idea as it is simple. Also, I don't even need a shell script nor will you need to fuss with the Info.plist. Reading a CFPreference (that is what the "defaults" command creates) is pretty trivial in the C code that we have so I was thinking that I would just add reading the proposed "DefaultExecutableArgs" CFPreference in NeoOffice's main() function.
Our main() function is already heavily customizeed to set the necessary environment variables for proper library loading so reading that CFPreference and tacking it onto any existing arguments should be pretty trivial.
I'll try to get a test patch out in the next day or two that has this change. |
That sounds great, I'm glad you found the idea useful. Don't forget to have some logic to determine if the user is trying to pass in their own arguments so you can avoid using the defaults in that case. |
|
Back to top |
|
|
pluby The Architect
Joined: Jun 16, 2003 Posts: 11949
|
Posted: Sun Jul 05, 2009 12:29 pm Post subject: |
|
We already have code to treat the psn argument as it is a special Mac OS X argument. So, what I was planning on doing is to take arguments in the DefaultExecutableArgs CFPreference and append them onto any existing arguments that the soffice.bin executable was started with.
Patrick |
|
Back to top |
|
|
pluby The Architect
Joined: Jun 16, 2003 Posts: 11949
|
Posted: Sun Jul 05, 2009 12:35 pm Post subject: |
|
pluby wrote: | We already have code to treat the psn argument as it is a special Mac OS X argument. So, what I was planning on doing is to take arguments in the DefaultExecutableArgs CFPreference and append them onto any existing arguments that the soffice.bin executable was started with. |
Now that I think about it, I probably should ignore the arguments in the DefaultExecutableArgs CFPreference if there are already arguments other than the psn argument. My thinking is that if there are such arguments (and this would happen if you have already modified Info.plist or are executing NeoOffice from a Terminal), appending the DefaultExecutableArgs may cause conflicting args and NeoOffice may fail to launch.
Let me know if this approach sounds reasonable. If so, I will proceed with implementation.
Patrick |
|
Back to top |
|
|
DEinspanjer Red Pill
Joined: Jul 04, 2009 Posts: 9 Location: Salem, NH
|
Posted: Sun Jul 05, 2009 12:39 pm Post subject: |
|
pluby wrote: | Let me know if this approach sounds reasonable. If so, I will proceed with implementation. |
Exactly what I was in the process of typing. :) That is why my script logic says if there are 0 arguments or just the -psn argument then use the defaults, else ignore them.
I think this is the safest logic to implement. It does leave a small feature hole where a user might want to specify some default arguments and then build on to them from the command line, but honestly, that is pretty out there and providing the users with this feature as is should make the "tweakers" very happy. |
|
Back to top |
|
|
pluby The Architect
Joined: Jun 16, 2003 Posts: 11949
|
|
Back to top |
|
|
|