AddThis Social Bookmark Button

Print

Windows Compatibility for the Linux Desktop
Pages: 1, 2, 3

Non-JDS Gnome and KDE Desktops

Non-JDS Gnome desktops use exactly the same system of Category= values to place applications in menus.



To appear in the Applications menu, the categories must include Application. Under that menu, the commands appear in sub-menus if they contain Application and one of following additional category names.

Applications Sub-Menu NameCategory Names
AccessoriesUtility but not System
ProgrammingDevelopment
GamesGame
GraphicsGraphics
InternetNetwork
MultimediaAudioVideo
OfficeSpreadsheet || Office || WordProcessor || ProjectManagement || Calendar
PreferencesPreferences
SystemSettings but not System
Othernot Settings

These category names shown here come from the .vfolder-info files in /usr/share/gnome/vfolders or /etc/gnome/gnome-vfs-2.0/vfolders.

KDE uses an entirely different system. Instead of placing Category= lines in the desktop files, the files themselves appear in a directory hierarchy that corresponds to the menus. For example, if netscape.desktop were in /usr/share/applications/internet, it would appear in the Applications -> Internet menu.

Integrating Visio and Project

The same techniques works to add your Windows programs to the Gnome menus. We'll start with Visio.

Install the program as usual under Windows. Before you remove the CD, locate the icon you wish to use with the program. Running find on the CD identified a Windows VisioCD.ICO file in the /media/cdrom/Support directory. Copy the icon to a Linux file system and convert it to a Unix icon with:

$ winicontoppm VisioCD.ICO | pnmtopng > /tmp/visio.png

Copy visio.png to /usr/X11R6/share/icons/png/hicolor/48x48/apps, the default location for Gnome icons.

Next, find the executable. Running find on ~/win found ./Program Files/Visio/Visio32.exe and dir identified the path as \PROGRA~1\VISIO\VISIO32. At this point, we can copy the project script to create a visio script.

Then, create a desktop file in /usr/share/applications/visio.desktop, containing:

[Desktop Entry]
Name=Visio
Comment=Visio
Exec=/bin/visio
Icon=visio.png
MimeType=
Path=
Type=Application
Terminal=0
Categories=Application;Graphics;X-Sun-Supported

A new entry, Visio, will now appear in the JDS menus under Graphics. It's runnable.

Project requires a similar project.desktop file:

[Desktop Entry]
Name=Microsoft Project
Comment=
SwallowTitle=
SwallowExec=
BinaryPattern=
MimeType=application/vnd.ms-project
Exec=/bin/project
# Icon=
TerminalOptions=
Path=
Type=Application
Terminal=0
Categories=Application;Office;X-Sun-Supported

Visio and Project File Types

In the visio and project.desktop files above, a line identifies the MIME type of the program. This is an unambiguous name for the file type used by the program. Both Gnome and Netscape use the MIME type to find out what program to run if you double-click a file of this type.

Gnome stores its registry files covering all MIME types that it will recognize in /usr/share/mime-info. We'll create win4lin.keys and win4lin.mime files as follows.

win4Lin.keys contains:

application/vnd.ms-project
description=Microsoft Project File
short_list_application_ids=msproject
short_list_application_ids_for_novice_user_level=msproject
short_list_application_ids_for_intermediate_user_level=msproject
short_list_application_ids_for_advanced_user_level=msproject
default_action_type=application
category=Documents
application/vnd.visio
description=Microsoft Visio file
short_list_application_ids=visio
short_list_application_ids_for_novice_user_level=visio
short_list_application_ids_for_intermediate_user_level=visio
short_list_application_ids_for_advanced_user_level=visio
default_action_type=application
category=Documents

win4Lin.mime contains:

application/vnd.ms-project
ext: mpp mpc mpt mpx mpw
application/vnd.visio
ext: vsd vss

A similar applications registry for files lives in /usr/share/application-registry. We'll create a Win4Lin.applications file there, containing:

msproject
command=/bin/project
name=MS Project
can_open_multiple_files=true
expects_uris=false
requires_terminal=false
mime_types=application/vnd.ms-project

visio
command=/bin/visio
name=Visio
can_open_multiple_files=true
expects_uris=false
requires_terminal=false
mime_types=application/vnd.visio

Netscape

To integrate MS Project with Netscape, you need to provide the same information in a different set of files. Add the following lines to /etc/mailcap:

type=application/vnd.ms-project desc="Microsoft Project File"
exts="mpp,mpc,mpt"
type="application/vnd.visio desc="Microsoft Visio File"
exts="vsd,vss"

and the following lines to /etc/mailcap:

application/vnd.ms-project:	/bin/project %s
application/vnd.visio:	/bin/visio %s

The /etc/mailcap file corresponds to the /usr/share/application-registry/Win4Lin.applications file, while the mime.types file corresponds to the /usr/share/mime-info/win4lin.keys and win4lin.mime files.

After adding these to the system mime.type and mailcap files, Netscape will recognize a Project file when you double-click it either in email or on the Web. It will launch /bin/project to edit the file.

Remote Access to Win4Lin and Windows

If you have another non-x86 machine, you can run Windows programs on Linux and display the window on your other machine, to the considerable startlement of your colleagues. See Figure 6.

running Visio from a SPARC
Figure 6. Running Visio from a SPARC

With a Linux machine named Calvin and a Solaris machine named Hobbes, the command on Hobbes is:

xhost +calvin: ssh calvin "DISPLAY=hobbes:0.0 /bin/project $@"

At this point we're done. Whenever we need to run those last remaining Windows programs, we can do so without leaving Unix and without the interminable waits of dual booting.

If we need to provide this same kind of capability to a whole department, we can look at the Win4Lin terminal server, which Sun and Siceroo recently used in a large deployment of Sun Rays for the Netherlands school system.

References

David Collier-Brown is a consulting systems integrator, currently working for the performance and engineering group at Sun Opcom in Toronto.


Return to the LinuxDevCenter.com.