Menus for User-Chosen Programs under Mikewalsh’s Wine-portables

Moderator: Forum moderators

Post Reply
User avatar
mikeslr
Posts: 2963
Joined: Mon Jul 13, 2020 11:08 pm
Has thanked: 178 times
Been thanked: 917 times

Menus for User-Chosen Programs under Mikewalsh’s Wine-portables

Post by mikeslr »

On this thread, https://oldforum.puppylinux.com/viewtop ... 66#p979566, and elsewhere you can find discussions about creating menu entries to programs that run under Wine. With such entries you can assign Windows applications to launchers, and no longer have to file-browse to their executables nor drag them to to desktop to conveniently start them.

But Mikewalsh’s Wine-portables are sufficiently different that an explanation of how to create menu entries to the Windows programs you add may be of value. Moreover, it’s important to point out that old discussions regarding portables had to do with portables using the technique of the ‘Shinobar/Japanese Team’s’ portables (see, https://www.forum.puppylinux.com/viewto ... 318#p67318) under which a different Linux command is required.

The programs you choose to run under Wine may be either 32-bit or 64-bit and will either be ‘installed’ or themselves portable. Mikewalsh’s WINE_4.0.4_portable, being only 32-bit, can only run 32-bit Windows programs; but Mikewalsh’s WINE_5.11_portable can run both 32 and 64 bit programs. What Linux command is used to start these programs will depend on that program’s architecture.
For your operating system to ‘know’ where a Window’s executable is located, you have to provide it with the path to that executable. For a menu entry to display an icon (and sometime to display at all) you must also provide it with an appropriate icon and –it doesn’t hurt to also-- provide the path to that icon.

Under Linux in general, and Puppy Linux in particular, menu entries are generated by a text file located at /usr/share/applications with the ending ‘desktop’: e.g. /usr/share/applications/My-Application.desktop.

The following two examples should clear-up almost all mysteries:

SumatraPDF is a very efficient 32-bit Windows pdf reader. When its Setup program is run it installs into Wine’s ‘prefix’. Under Mikewalsh’s portables that Wine prefix [=drive_c] is located within the Wine-portable’s folder as shown in this Screenshot.

Sumatra-installed.png
Sumatra-installed.png (37.09 KiB) Viewed 991 times

So the command to start that program would be wine32, and the path to Sumatra’s executable would be:
/mnt/home/WINE_5.11-portable64/WINE/wine/drive_c/'Program Files'/SumatraPDF/SumatraPDF.exe

Note the Quotes surrounding Program Files (colored only for emphasis). In their absence Linux will treat the space between Program and Files as the end of a command and stop reading. A ‘file not found’ error will be displayed.

The full command to start Sumatra would be:
wine32 /mnt/home/WINE_5.11-portable64/WINE/wine/drive_c/'Program Files'/SumatraPDF/SumatraPDF.exe

That command can be run via a bash script located anywhere [Right-Click>New>Script]. But it is sufficient that the entire command be used as the argument following Exec= in the /usr/share/applications/Sumatra.desktop file.
To be useful, such desktop file only needs a little more information supplied to a couple other arguments. It’s contents could be as simple as this:

[Desktop Entry]
Encoding=UTF-8
Name=SumatraPDF
Icon=/usr/share/pixmaps/Sumatra.png
Comment=Read PDF files
Exec=wine32 /mnt/home/WINE_5.11-portable64/WINE/wine/drive_c/'Program Files'/SumatraPDF/SumatraPDF.exe
Terminal=false
Type=Application
Categories=X-Document-viewer
GenericName=SumatraPdf

Notes re above. The above shows the contents. Remember that the text file located in /usr/share/applications must have a name ending with ‘.desktop’. Following ‘Name=’ will be the name that appears on the Menu. You can find icons on the web, or create your own. You can place them anywhere; but Puppys will first look in /usr/share/pixmaps and if not placed there you have to provide the ‘path’ to it: and it doesn’t hurt to provide the path to /usr/share/pixmaps. Categories under Puppy are somewhat unique. To provide a valid name, I look on the Menu for where a similar application appears; then open that application’s /usr/share/desktop file in a text editor and copy the argument it supplies to Categories=.

The Exec= argument for all installed programs will be similar to the above. Three things will differ: (1) Sumatra is a 32bit program. Had it been a 64-bit program the argument supplied to Exec= would have started with wine64. (2) The name of a program’s folder will differ; (3) as will the command to start the program. So, for example, the command following Exec= to start CryptEdit would be:
Exec=wine32 /mnt/home/WINE_5.11-portable64/WINE/wine/drive_c/'Program Files'/'Crypt Edit'/CryptEdit.exe

Creating menu entries for Windows portables will be almost identical to the above. By Windows portables I mean programs which under Windows are NOT installed and indexed in Window’s Registry. Under Windows they can be run from anywhere. The same is true using Wine. Under Wine, the Exec= argument must provide the full path to the executable. [When you run the Setup.exe, you get to choose such portable’s location; or having done that the first time, that programs folder can be moved/copied anywhere].

I find it most convenient to locate Windows portables within the Wine-portable folder. The argument I use for one portable can serve as a template (copied) for another portable. And with all Window’s portable folders being within the Wine-portable folder, I can easily copy/transfer that folder –including all programs-- to a USB-Key and/or different computer.

As this screenshot shows I’ve located the EssentialPim’s folder in the WINE_5.11-portable64 folder.

EssentialPim-portable.png
EssentialPim-portable.png (53.66 KiB) Viewed 997 times

The Exec= argument for EssentialPim’s /usr/share/deskop file would read:

wine32 /mnt/home/WINE_5.11-portable64/EssentialPim-042823/EssentialPIM.exe

Note: Under your Puppy /mnt/home may appear as /initrd/dev_save.

As with ‘installables’ the Exec= arguments of portables other than EssentialPim will be similar, differing only with regard to which wine-command is required; specifying the program’s containing folder; and name of the executable.

Edit: You need only do this with the first of your programs. If after setting up portable wine Left-Clicking an exe doesn't start it, you may have to associate the exe-file-type with Wine's executable. Right-Click the exe and from the pop-up menu Select Set-Run-Action. Type wine32 in front of the command and click the Use Command Button.

Setting Run Action.png
Setting Run Action.png (28.15 KiB) Viewed 458 times

This will set that command for ALL exes. Most of the programs you want to use will be 32-bit. The command to run a 64-bit program would be wine64 "$@". Caution, the command is global. You'll have to re-set it to wine32 "$@" to run 32-bit programs.

Post Reply

Return to “Tips & Tweaks”