Rox Rocks II – Application Directories

Rox is a multi-functional tool. I’ve written about some of its file management uses previously. It can be used to manage desktop icons (called a pinboard in rox-speak), to serve as a panel for launching applications (called, surpringly enough, a panel), to mount/unmount devices and mountable files (e.g., MyDSL UCIs), to act as a drag-and-drop file manager, and to act as a drag and drop platform for opening files or running scripts via drag and drop.This page takes a look at some of the nuts and bolts that can help you get even more out of rox.

APPLICATION DIRECTORIES
The concept of application directories (or appdirs) is pretty simple — within one directory is an executable named AppRun that enables the directory itself to be an executable (e.g., an appdir for Sylpheed contains an executable named AppRun instead of sylpheed — it’s the sylpheed binary, but it’s named AppRun in the appdir). This allows applications to be completely self-contained within one directory and they can then be launched with a single click.

The concept of self-contained directories isn’t entirely novel. DSL has been using them in the form of UCI and UNC extensions, which can be mounted and run and then unmounted again when not in use to save RAM. The way it works in rox is a little different since the application directory itself is executable.

In a nutshell, the only thing needed to make an appdir is an executable file named AppRun in a directory. This AppRun filename tells rox that clicking on the appdir folder, whatever it’s called, should run the executable AppRun.

An appdir can also contain other files and directories. The two most common files in an appdir besides the AppRun are a hidden icon (png and xpm preferably) that’s been renamed .DirIcon and a file named AppInfo.xml. When rox reads .DirIcon, it applies it to the appdir. This can also be done throughout rox to apply unique icons for various non-appdir directories. Rox has a default icon for application directories should you not include one.

The AppInfo.xml file can tell rox to include a special menu section and provide information about the AppRun (author, license, etc.).

So there is one requirement to turn a regular directory into an application directory, an executable file named AppRun. There are at least two options that can be included in an appdir: an icon named .DirIcon and an info file written in XML named AppInfo.xml.

WHAT IS APPRUN?
An AppRun can be a binary, a wrapper script that calls on a binary elsewhere on the computer, an executable script, or even a symlink, though symlinks aren’t the preferred way to manage running applications in rox. One reason a script is preferable to a symlink is for drag-and-drop operation. For example, the following wrapper script not only can launch with a single click a terminal window with the console editor nano, it can also launch it with a particular file when dragged and dropped:

#!/bin/bash
exec aterm -T “nano editor” -e nano “$@”

Script wrappers for rox can be as simple as that or much more elaborate. This example tells rox to open up nano and open the file (“$@”) that’s dragged on to the appdir in nano. Just clicking on it by itself without dragging a file to edit opens a new terminal with nano, just as should be expected. So you’re not limited to running rox with GUI-only applications or launching files in GUI apps (e.g., text files can be edited in nano via drag and drop, music files or playlists can be launched in mpg321 with drag and drop, etc.).

You’re also not limited to running script instances one file at a time. I have a set of appdirs for scripts that batch-scale image files with imagemagick to various sizes (such as for converting a set of icons or individual ones to sizes I want for my computer). I just highlight the files I want in rox-filer and drag them onto an appdir icon. The icon can be anywhere: on a panel, on a pinboard, or in rox-filer (rox-filer is like a “folder view”). I then have a set of icons in whatever size I want — scripted once, then just a matter of drag-and-drop for however many files I need to change. The second image shows the directory with my resize script appdirs with my own edited default appdir icon (any icon can be used, but rox has defaults for various MIME-types including appdirs so you can distinguish visually between normal directories and executable ones).

And since multiple instances can be run in rox on the fly, it’s possible to set up pinboards and panels for different tasks and always have things set up for relevant tasks. I have several pinboards set up for different tasks, including graphics work per the example above. That pinboard has icons that can be used to launch applications like GIMP as well as scripts that I can drag files onto and have things taken care of quickly — resizing images, converting from one format to another, etc. I don’t have to dig my way through rox-filer to find my scripts since they’re on the desktop: drag and drop and done. I can switch to another pinboard when I’m finished with graphics work (I’ve written a little lua script that allows me to click on buttons for my different pinboards and panels or turn them off completely).

APPINFO
The AppInfo.xml file that can optionally be added to an appdir gives a variety of information, such as the program’s or script’s name and a description of it, its author, and menu entries that can execute various options. For example, menu entries for an xscreensaver appdir can include settings related to its options:

-timeout <minutes>
-cycle <minutes>
-lock-mode
-lock-timeout <minutes>
etc.

Multiple entries for the timeouts could be set up so a right click on the appdir allows you to reset it for different times on the fly. No need to open the GUI, no need to remember the command. Right click on the appdir, select the setting, done.

SUMMARY
Rox is much more than a graphical file manager. It’s very customizable with respect to how it functions, including application directories. It can be used to replace desktop icon managers like xtdesk, file managers like emelfm, and even menus (click on the application you want whether it’s on a panel, pinboard, or in rox-filer). It lets you drag and drop without regard for GUI or CLI applications. It’s unbeatable at running scripts: select the files you want (manually or use the select part of the menu — which is something I’ll write about soon), drag them to your appdir icon, you’re done. Your applications often have different options: set those up for right-click ease with menu entries in AppInfo. It can be set up however you want to do whatever you want to get as much out of it as you can — and that’s what computing is supposed to be about.

Advertisements

%d bloggers like this: