Mac OSX equivalent of an Open Desktop dot-desktop file?

5

1

I am mostly an Ubuntu user. I like that it is very easy to create one-click launchers for apps by (in Gnome, at least) right-clicking on the panel and choosing add-to-panel->custom-app. I use this A LOT. For custom one-liners and custom shell script utilities that I use day to day for work (I am a LAMP stack sysadmin)

Mac OS <= 9 used to have these "droplet" things which were similar.

I may be forced to use my Mac for a while, and I'd like to know of an easy way to create a one-click "app" launcher that launches, for example, a custom shell script, or a custom shell one liner, or even a normal app but with different CLI flags.

What is the "Mac Way(TM)" of doing something like that? I'd like to be able to add the .desktop-ish files to the Mac app bar at the bottom, or, failing that, make them clickable icons on my desktop. Is that even possible?

JDS

Posted 2011-05-06T02:40:54.850

Reputation: 442

All of these have been asked before, if you had bothered to rephrase your question to be less Ubuntu-focused and look for solutions; which by the way only leads to fewer Mac users on this site being able or willing to answer. – Daniel Beck – 2011-05-06T05:36:55.483

2I did look for solutions, but I don't know the Mac-specific terms to be able to search. One cannot ask a question if one does not know what one is even asking. Also, my question is not Ubuntu-focused, it is Ubuntu-referencing. Which is my only real desktop frame of reference. (pissy response removed) – JDS – 2011-05-06T12:44:08.960

You have a point there. But are these .desktop files really nothing more than "running programs with arguments from the GUI" and "executing shell scripts by opening a file"? – Daniel Beck – 2011-05-06T12:45:52.393

The .desktop files can be as simple as "running programs with arguments from the GUI" and "executing shell scripts by opening a file", yes. They can be a little more complex, also, but not much. – JDS – 2011-05-06T12:48:28.833

Then I hope my (and the others') answers provides you with a few good ideas. Please comment on mine if you have questions. – Daniel Beck – 2011-05-06T12:49:16.400

Thanks. I removed my snippety response back after seeing your follow-up comments. IDK if you even saw it, but there you go. – JDS – 2011-05-06T12:50:39.520

@JDS Didn't, unfortunately ;-) English is my second language so I apologize for getting the term wrong. I just meant to write, if you didn't look for "Mac equivalent of [...], but "way to launch programs with arguments and run shell scripts from the GUI", you'd get better responses and the question would be useful to more other users, since the windows GUI with his .bat files and program links can learn from it, too. – Daniel Beck – 2011-05-06T13:02:11.917

Ugh. Windows guy. Not Windows GUI. – Daniel Beck – 2011-05-06T14:26:02.820

Answers

3

You can use AppleScript Editor to create AppleScript script files or applications that do the following:

a) Launch an application

tell application "TextEdit" to activate

b) Run a shell command without opening Terminal

run shell script "/usr/local/bin/growlnotify 'Hello World'"

Applications can be dragged to the left side of the Dock. To execute normal scripts, enable AppleScript menu (which will be located in the menubar notification area) in AppleScript Editor's preferences. This menu is fed by using scripts in ~/Library/Scripts, it displays those e.g. in ~/Library/Scripts/Applications/TextEdit only when TextEdit in frontmost.

You can also use Automator to do this (e.g. Run Shell Script and Launch Application actions), but in my experience, it's a lot slower than running the AppleScripts themselves.


To make an executable shell script that's open the Terminal, simply chmod +x it and save with the extension .tool or .command. Optionally drag to the right side of the Dock.


To launch arbitrary shell scripts from the GUI without a Terminal, simply save them as files, and create the following application (once):

Open Automator, select Application, double-click the Run Shell Script item in the library, select to receive input as arguments and enter the following:

for f in "$@"
do
    source "$f"
done

(or something similar)

Now you just need to associate these shell scripts with this application (I called mine Shell Script Runner), and you can drag them to the Dock's file area.


To execute a Mac application (e.g. Firefox) with different arguments, use the following in shell:

open -a Firefox --args ProfileManager

Anything you can drag to the Dock, you can place on the desktop:

  • Create an alias for Applications
  • Create an alias for regular files, or just drag the files to the desktop.

Daniel Beck

Posted 2011-05-06T02:40:54.850

Reputation: 98 421

0

You can use Automator to create a small application that simply runs a shell script. Open Automator, find the Run Shell Script action, paste in your code, save as an Application, then drag the application to your Dock.

William Jackson

Posted 2011-05-06T02:40:54.850

Reputation: 7 646

0

You did not say what osx version you are using, so...

Look for AppleScript Utility.app it has the option to put a script item in the menu bar.

I have shell scripts and applescripts in that script menu, works great.

-Bill

broomdodger

Posted 2011-05-06T02:40:54.850

Reputation: 1 810

snow leopard, up to date as of last month or so. – JDS – 2011-05-06T12:49:29.753