Adding "open with..." integration to app installed with bottles

Hi all :slight_smile:
I’m new in bottles and I installed notepad++ on it, everything works fine and I have been able to add the notepad++ shortcut in the applications menu.

The perfect integration would be to be able to launch notepad++ by right clicking on a .txt file and choosing “open with…” to open the selected file. I followed a guide to add the app entry on the app lists of “open with…” adding %F to the exec line of the .desktop file, this way I can see the app on the list but it doesn’t open at all…

Is there a method to configure it?

Thanks :slight_smile:

You gave me a fun learning hour. Thank you for that.

Now for stuff that I learned:

  1. At first I had no success using the Mint “Open with” menu. It opened notepad++ but it didn’t show the file or any errors
  2. Running bottles from CLI with:

flatpak run com.usebottles.bottles -b software -e “/home/zakapslowany/.var/app/com.usebottles.bottles/data/bottles/bottles/software/drive_c/Program Files/Notepad++/notepad++.exe” -a /home/zakapslowany/Pulpit/sampletext.txt

threw error:

Cannot open file
“Z:\home\zakapslowany\Pulpit\sampletext.txt” cannot be opened: Folder “Z:\home\zakapslowany\Pulpit” doesn’t exist.

  1. After giving Bottles filesystem permissions to my home folder using Flatseal, the command above worked, but you still had to manually type it into CLI and that’s not what we are looking for.
  2. Having learned about “-a” in Bottles CLI I added it to Mint “Open With” menu and this time it worked. Tried turning off filesystem permission in Flatseal but it threw an error so you either have the sandboxing or functional “open with”

You can do it with following command:

flatpak run com.usebottles.bottles -b BOTTLE_NAME -e “EXE_PATH” -a

(if you don’t use flatpak replace “flatpak run com.usebottles.bottles” with “bottles”)

Sources that I learned from:

Thank you :slight_smile: for some reason launching the program with -p instead of -e (using the program name instead of the .exe path) it didn’t work.
So i was trying this:

Exec=flatpak run --command=bottles-cli com.usebottles.bottles run -p 'notepad++' -b 'Notepad++' -a %F

but this worked eventually:

Exec=flatpak run --command=bottles-cli com.usebottles.bottles run -b 'Notepad++' -e "/home/luca/.var/app/com.usebottles.bottles/data/bottles/bottles/Notepad++/drive_c/Program Files/Notepad++/notepad++.exe" -a %F

btw i had already flatseal permission for the home folder for some reason , I don’t know if it’s the default behavior or what

It shouldn’t be. I’ll see it the next time I reinstall Bottles, but I’m sure it comes with no access to home folder at default.

I found a problem in this configuration, if the path of the file to open contains white spaces or special characters it doesn’t work and the wine app (notepad++) interprets them as multiple paths to open divided by the whites spaces or special characters.

Any idea on how to fix this? :pray:

I can’t say for special characters, but generally white spaces in path and names can be included with putting them inside " ".

for example:
“purple rainbow 123”

Special characters may need to be escaped, but you would need to research that yourself.