Monday, May 12, 2008

The syntax of a Menu Command

Here's what you may have noticed. The vast majority of menu commands has a very simple structure, and it comes in one of two simple forms

One form to simply open an application, that works like this:

[exec] (text to display in menu) {application}

for example:
[exec] (firefox) {firefox}
[exec] (kaffeine) {kaffeine}
[exec] (virtual desktops) {kpager}

As you can see, the text to display in the menu and the command are often identical. In Linux, the name of the command is usually the name of the application.

The second form of a menu command isn't much more complicated:
[exec] (text to display in menu) {application object}

The command basically says: This opens that. For example:


Konqueror opens the "Pictures" directory
[exec] (image){konqueror ~/Pictures}*

*Note: the tilde sign represents the user's home/directory.



Firefox opens the Netflix website:
[exec] (netflix) {firefox http://www.netflix.com}

Kaffeine opens my favorite movie:
[exec] (netflix) {kaffeine ~/Videos/"Faster, Pussycat, Kill, Kill.avi"}*

*Note: quotes are needed when file names contain spaces.


Incidentally, the simple syntax that I've described here is often the syntax used by the much-dreaded Linux Command line.







No comments: