Bottles
Bottles copied to clipboard
[Request]: File association to open file with program installed inside bottle
Tell us the problem or your need
I want to open .doc, docx file with office program WINWORD.EXE installed in a bottle.
simply passing the argument doesn't work.
ex - flatpak run --command=bottles-cli com.usebottles.bottles run -p WINWORD -b Office2007 --args "/var/home/zihad/Downloads/wo_pbc_15_4.doc"
Someone posted some tweaks in forum which unfortunately doesn't work.
We want some option to associate some document or other file to open with program installed inside bottles.
Describe the solution you'd like
- Set file association with program installed inside bottles.
- double click the file and open from linux file explorer. eg: nautilus, dolphin.
Other solutions?
No response
Additional context and references
No response
Yeah,
I have a similar issue with trying to open .rar archives using WinRAR.
By looking in the .desktop file they just pass the %u argument to WinRAR, which is not how it should be done. The path needs to be converted to something a Windows program understands. With pure wine it should work by using winepath.
Once passing file paths to the Windows program is fixed, you could associate various file extension via the "Open With" context menu entry in your file manager
The only one solution that worked for me was:
flatpak run --command=bottles-cli com.usebottles.bottles run -b 'Software_bottle' -e "/home/full_path_to_exe/word.exe" --args "/home/full_path_to_file/file.doc
or
flatpak run --command=bottles-cli com.usebottles.bottles run -b 'Software_bottle' -e "/home/full_path_to_exe/word.exe" --args %f
for .desktop file
for some reason -a option doesn't work but --args does, no idea why.
For browser application links it is sometimes necessary to use double brackets like '"%u"'
But yeah the state of bottles-cli
for today is barely working.
It needs drive letter and double quotes in the --args like below in .desktop file.
Exec=flatpak run --command=bottles-cli com.usebottles.bottles run -b BOTTLE_NAME -e PATH_TO_EXE --args "z:%F"
Terminal=false
And, if an error message pops up saying "Bottles is not responding" when opening multiple files in one program, write the following in a desktop file and launch the WINE cmd.exe utility in advance to resolve the issue.
Exec=flatpak run --command=bottles-cli com.usebottles.bottles tools -b BOTTLE_NAME cmd
Terminal=true
It needs drive letter and double quotes in the --args like below in .desktop file.
Exec=flatpak run --command=bottles-cli com.usebottles.bottles run -b BOTTLE_NAME -e PATH_TO_EXE --args "z:%F"
Terminal=false
And, if an error message pops up saying "Bottles is not responding" when opening multiple files in one program, write the following in a desktop file and launch the WINE cmd.exe utility in advance to resolve the issue.
Exec=flatpak run --command=bottles-cli com.usebottles.bottles tools -b BOTTLE_NAME cmd
Terminal=true
Ah, thank you! Single quotes did the trick.
I think I figured out what I need. Using this for my file association:
run --command=bottles-cli com.usebottles.bottles run -p Inkscape -b Common -- '"%U"'
Exec=flatpak run --command=bottles-cli com.usebottles.bottles run -p Inkscape -b Common -- '"%U"'
(Edit, sorry, meant to reply to the comment in #3234 )
@ftdt10 yours works. But if there's a space in document file name. It won't work.
A) steps for file association to open file with Bottles program. using Nautilus file manager. Add desktop entry using this guide. Edit the added .desktop file at ~/.local/share/applications folder as described in https://github.com/bottlesdevs/Bottles/issues/2425#issuecomment-1880785975. In Nautilus, right-click a file with the extension, click "Open With", choose the Bottles app in the list and check "Always use for this file type". Then double-click the extension file in Nautilus.
B) to open file using terminal CLI
Add single quotes if space exists in file/folder name, prepend drive letter, and wrap it with double quotes.
flatpak run --command=bottles-cli com.usebottles.bottles run -b BOTTLE_NAME -e PATH_TO_EXE --args "z:'/home/USER/dir abc/file test.ext'"
It needs also directory expose like this guide
If filename has special characters such as single quote, colon, and etc, add additional backslash and single quotes.
'\''
'\:'
ex) if filename is /home/USER/abc's file
flatpak run --command=bottles-cli com.usebottles.bottles run -b BOTTLE_NAME -e PATH_TO_EXEC --args "z:'/home/USER/abc'\''s file'"
I got it to work with files on Dolphin with whitespace using this:
run -b BOTTLE_NAME -e EXE_PATH --args 'z:'\''%F'\'''
Just chiming in with the only solution that worked (for a .desktop
file) for me that prepends the drive and converts forward slashes to (double) backwards slashes. %U
should be replacable with other options too (%u
, %f
, etc.).
Exec=bash -c "flatpak run --command=bottles-cli com.usebottles.bottles run -p 'PROGRAM NAME' -b 'BOTTLE NAME' -- $(echo \\'z:%U\\' | sed 's!/!\\\\\\\\\\\\\\\\!g')"