HGL
rare-sapphire

How to pass documents with mime-types?

Hey I just installed the Affinity V1 with ElementWarrior inside Heroic. So, everything is functional. But then I added the .afphoto , .afdesigner ,.afpub to the mime-types for recognition and convenience. Then I made a application.desktop file inside ~/.local/share/application for the system to start the app from outside. But when I try to open the document directly - it just opens the app, but not the document inside the app. I learned how to pass documents using command-line with WINEPREFIX=~/Heroic/Prefixes/default/Affinity ~/Heroic/custom_wines/ElementalWarriorWine/bin/wine start /unix '~/Heroic/Prefixes/default/Affinity/drive_c/Program Files/Affinity/Photo/Photo.exe' ~/Work/Affinity/Photo/Brush_Test.afphoto to get it running and all, but I'm struggling to do that with heroics gui settings - to get the file location from system/double-click-document to pass to xdg and then to wine and then to the app. I tried to do some-stuff with the Game Arguments, Wrapper Command, Variable Name Value, etc. inside the settings but it didn't pan out. I'll post the whole desktop file in the reply. But the executable in it is:
[Desktop Entry]
...
Exec=sh -c "xdg-open 'heroic://launch?appName=3vUkEHFLe9gca5Jw7khmHi&runner=sideload'"
...
Icon=application-x-affinity-photo
MimeType=application/x-affinity-photo;
...
[Desktop Entry]
...
Exec=sh -c "xdg-open 'heroic://launch?appName=3vUkEHFLe9gca5Jw7khmHi&runner=sideload'"
...
Icon=application-x-affinity-photo
MimeType=application/x-affinity-photo;
...
But if I cant get it running with Heroic / xdg then I'm gonna just gonna use the raw "WINEPREFIX" variable and "ElementWarrior/bin/wine" directly in the "EXEC" in the desktop file in .local/share/application/[something].desktop which I dont prefer, cause then I'll have to handle the heroic setup and my document launching separately. So, I just want to know how to pass the document from system -> xdg -> heroic -> wine -> App.exe . Thank you.
No description
No description
No description
5 Replies
rare-sapphire
rare-sapphireOP3mo ago
This is the entire desktop entry of Affinity Photo.Desktop:
[Desktop Entry]
Categories=Graphics;Design;
Comment[en_IN]=
Comment=
Exec=sh -c "xdg-open 'heroic://launch?appName=3vUkEHFLe9gca5Jw7khmHi&runner=sideload'"
GenericName[en_IN]=
GenericName=
Icon=application-x-affinity-photo
Keywords=Photo;Graphics;Paint;Draw;Raster;Print;
MimeType=application/x-affinity-photo;
Name[en_IN]=Affinity Photo
Name=Affinity Photo
NoDisplay=false
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-KDE-SubstituteUID=false
X-KDE-Username=
[Desktop Entry]
Categories=Graphics;Design;
Comment[en_IN]=
Comment=
Exec=sh -c "xdg-open 'heroic://launch?appName=3vUkEHFLe9gca5Jw7khmHi&runner=sideload'"
GenericName[en_IN]=
GenericName=
Icon=application-x-affinity-photo
Keywords=Photo;Graphics;Paint;Draw;Raster;Print;
MimeType=application/x-affinity-photo;
Name[en_IN]=Affinity Photo
Name=Affinity Photo
NoDisplay=false
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-KDE-SubstituteUID=false
X-KDE-Username=
equal-aqua
equal-aqua3mo ago
In your exec line, you aren’t passing in the file name with %f or similar Which given the general setup of Heroic being directed toward games, I wouldn’t be able to answer if the xdg-open method of running heroic can accept file arguments like that
rare-sapphire
rare-sapphireOP3mo ago
I've tried it, if I put %f beside xdg-open the app.desktop simply wont even start. I also tried to add &file=%f inside xdg-open but that also didn't work. So I just want to focus on the heroic way of getting and passing %f or %u like variables through all the layers of wrapping into the final windows executable.
equal-aqua
equal-aqua3mo ago
Do you have examples of what you tried, in full?
rare-sapphire
rare-sapphireOP3mo ago
OK, This is the normale %f command in (dot)desktop file (that doesnt work): Exec=xdg-open 'heroic://launch?appName=8qReAiWtrfZg79TBrEm7Y1&runner=sideload' %f Exec=sh -c "xdg-open 'heroic://launch?appName=8qReAiWtrfZg79TBrEm7Y1&runner=sideload' %f" Exec=sh -c "xdg-open 'heroic://launch?appName=8qReAiWtrfZg79TBrEm7Y1&runner=sideload&file=%f'" ### For now I've set up my alternative solution (the Non-Heroic, direct wine/ElementWarrior way) :
[Desktop Entry]
Comment[en_IN]=
Comment=
Exec=env WINEPREFIX=~/Heroic/Prefixes/default/Affinity ~/Heroic/custom_wines/ElementalWarriorWine/bin/wine start /ProgIDOpen Affinity.Photo %f
GenericName[en_IN]=
GenericName=
Icon=E7A2_Photo.0
MimeType=application/x-affinity-photo;
Name[en_IN]=Affinity Photo
Name=Affinity Photo
NoDisplay=true
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-KDE-SubstituteUID=false
X-KDE-Username=
[Desktop Entry]
Comment[en_IN]=
Comment=
Exec=env WINEPREFIX=~/Heroic/Prefixes/default/Affinity ~/Heroic/custom_wines/ElementalWarriorWine/bin/wine start /ProgIDOpen Affinity.Photo %f
GenericName[en_IN]=
GenericName=
Icon=E7A2_Photo.0
MimeType=application/x-affinity-photo;
Name[en_IN]=Affinity Photo
Name=Affinity Photo
NoDisplay=true
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-KDE-SubstituteUID=false
X-KDE-Username=
This is also capable of passing documents to an already open application. I also tried to pass this as %f : $(WINEPREFIX=~/Heroic/Prefixes/default/Affinity ~/Heroic/custom_wines/ElementalWarriorWine/bin/winepath -w %f) so it auto converts any path into a windows friendly format.

Did you find this page helpful?