Create Wine Menu Shortcuts to Portable Apps the Hard Way

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
User avatar
drunkjedi
Posts: 882
Joined: Mon 25 May 2015, 02:50

Create Wine Menu Shortcuts to Portable Apps the Hard Way

#1 Post by drunkjedi »

The easy way: Create a .desktop file which will execute "wine /path/to/your/portable/app.exe"


But there's another way....

Prologue: I have never used wine before (I mean the app, just look at my name).
So a friend of mine gave me 2 windows apps to tryout.
One was needed to be installed first, another was a portable app so didn't need any installing to be done.
So I downloaded wine-3.0-i686-1.sfs from Fatdog's SFS Manager. And loaded it.
Then Installed the first software by executing it's install.exe through wine. It installed nicely and runs nicely too.
The other app runs too by executing it's .exe file through wine.

I noticed the install script of first program did create menu entries.
Main Menu > Wine > Programs > App1

This got me thinking.
Of course I knew "The Easy Way"
But I wanted to investigate how wine does it.

Well, I found out wine created windows .lnk files in /root/.wine/drive_c/ProgramData/Microsoft/Windows/Start Menu/Programs/ folder
And also .desktop file in /root/.local/share/applications/wine/Programs/ folder which executed the .lnk file (not the .exe file) (the Exec= line in that .desktop file contained a lot of backslashes, 3 where I would use only one).
For example, Exec=env WINEPREFIX="/root/.wine" wine C:\\\\windows\\\\command\\\\start.exe /Unix /root/.wine/dosdevices/c:/ProgramData/Microsoft/Windows/Start\\ Menu/Programs/FluidSim/FluidSim.lnk

So I searched for making .lnk files in linux.
After 4 hours of searching found something usefull, because most would only talk about "just use .desktop file", "you can't create/edit .lnk file it's a windows file".
Well sorting through all those negatives remarks and thread leading to nowhere I finally made following HowTo...

Finally coming to the point of this thread..... lol

Howto:

1) Make a .lnk file pointing to your app's .exe
>a) Download the bash script from Here
This script makes .lnk files using hexdump I belive, more knowledgeable persons please comment.
The script has french comments, someone who knows french like Musher may translate them. (One more script to count musher, ;) )
Copy this script to some place and make it executable

>b) Note down the "Windows" path to your portable app.
In my system / is seen as Z: drive and my app is on sda6.
So Path for me is Z:\mnt\sda6\Simulation\Pneumatic\bin\fl_sim_p.exe
Note the backslashes.

>c) Open terminal where you copied that script and run following command (Replace the "windows path to your app's .exe" with your path (keep the " " ) and "your apps name.lnk" with whatever your app is called)

Code: Select all

./mslink.sh -l "windows path to your app's .exe" -o "/root/.wine/drive_c/ProgramData/Microsoft/Windows/Start Menu/Programs/Your app's name.lnk"
2) Make .desktop file executing the .lnk you created

Run following command in a terminal. (see referance.)

Code: Select all

wine winemenubuilder -w "/root/.wine/drive_c/ProgramData/Microsoft/Windows/Start Menu/Programs/Your app's name.lnk"
Done. You will see a menu entry in wine submenu for your app. Clicking on it will execute the windows portable app.


Epilogue:

Sorry for long post for just 2 commands.
But I hope it shows my 4hrs of search (+half hour of writing this post. lol)

This should be handled by wine itself, maybe playonlinux handles this.

There's chance to further enhance the mslinks.sh, so that just pointing it to a .exe will make .lnk at proper place with proper windows path.

I also see some differences between .lnk files created by an installer and what we created if I run "strings" command on them.
But it's beyond my current limits, someone more knowledgeable may help.

Is this hard way necessary to follow???, .... nope, do whatever floats your boat. ;)

Thanks folks.

Hope this helps.

User avatar
01101001b
Posts: 123
Joined: Thu 09 Mar 2017, 01:20
Location: Buenos Aires, Argentina

Re: Create Wine Menu Shortcuts to Portable Apps the Hard Way

#2 Post by 01101001b »

Great work indeed! And so much effort! :shock: Congrats! Long time ago I had my share with .lnk files and wine too. It took some time but I ended up understanding :idea: there's no real need to deal with .lnk files in Linux (with so very few, rare exceptions) and as you said, there's a much easier way.
drunkjedi wrote:After 4 hours of searching found [...] most would only talk about "just use .desktop file", "you can't create/edit .lnk file it's a windows file". [...] all negative remarks
Yes, that's what I would think in the beginning, but eventually you'll find out that their advice was not "negative" but "practical" :wink:

Regards! 8)

User avatar
Dorothée
Posts: 259
Joined: Tue 27 Nov 2012, 21:03

#3 Post by Dorothée »

Hello Drunkjedi (great pseudo),

as I use quite often wine applis, I made a menu with gtk, which open with a desktop file in usr/share.applications/

The gtk menu has 2 files: AppStarter-doc and AppStarter-doc.conf I put in /root/my-applications/bin/

I discovered this way to make menus with the wbar, and then I figured out that I could do this without any wbar.

Here is the copy of AppStarter-doc.conf and the picture of my menu. Isn't it nice and ergonomic?

Code: Select all

LABEL1="Calibre epub"
ICON1="/root/my-applications/Pipoca/Calibre/resources/images/beautify48.png"
EXEC1="/root/my-applications/Pipoca/Calibre/calibre"

LABEL2="PDF-XChange"
ICON2="/root/my-applications/Pipoca/PDF-XChangeViewerPortable/App/AppInfo/appicon.ico"
EXEC2="wine "/root/my-applications/Pipoca/PDF-XChangeViewerPortable/PDF-XChangeViewerPortable.exe""

LABEL3="WinDjView"
ICON3="/root/my-applications/Pipoca/WinDjViewPortable/App/AppInfo/appicon.ico"
EXEC3="wine "/root/my-applications/Pipoca/WinDjViewPortable/WinDjViewPortable.exe""
Attachments
menus.jpg
(29.2 KiB) Downloaded 260 times

tlchost
Posts: 2057
Joined: Sun 05 Aug 2007, 23:26
Location: Baltimore, Maryland USA
Contact:

#4 Post by tlchost »

This is all over my head...but how would you create either a desktop file or a lnk file that would do what the following windows lnk file calls

Windows Link File

Start In "C:\Program Files (x86)\Qualcomm\Eudora"
Target "C:\Program Files (x86)\Qualcomm\Eudora\Eudora.exe" "C:\eudora\thom-tlchost"

thanks

Post Reply