Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

q4wine-cli does not accept extra app arguments #78

Open
brezerk opened this issue Jul 7, 2016 · 28 comments
Open

q4wine-cli does not accept extra app arguments #78

brezerk opened this issue Jul 7, 2016 · 28 comments
Assignees
Labels
Bug
Milestone

Comments

@brezerk
Copy link
Owner

@brezerk brezerk commented Jul 7, 2016

Original message from @Svadkos at #69

Hello, is there any way to open file in wine program, not just open program? For example, if i want to open document with MSO Word from file manager dialog.

Well, actually i mean start file through icon that q4wine create.
/usr/bin/q4wine-cli -p "office" -i "Word" and than it just start new empty document, skipping all arguments that follow.

@brezerk brezerk added the Bug label Jul 7, 2016
@brezerk brezerk added this to the 1.3.1 milestone Jul 7, 2016
@brezerk brezerk self-assigned this Jul 7, 2016
@brezerk
Copy link
Owner Author

@brezerk brezerk commented Jul 7, 2016

Hi @Svadkos this commit 96e7093 fixes the issue, when all extra arguments passed to q4wine-cli was ignored.

Now they are by passed to the app correctly:

[ himera ] brezerk@pts/4:18  ~ $
> 07/08/16 00:37:35 EEST > /tmp/build-q4wine/src/q4wine-cli/q4wine-cli -p "Default" -d "system" -i "wordpad" "/home/brezerk/normalize.sh"
[ii] corelib::runWineBinary:  "/tmp/build-q4wine/src/q4wine-helper/q4wine-helper" ("--prefix", "Default", "--nice", "0", "--program-args", " /home/brezerk/normalize.sh", "--program-bin", "wordpad.exe", "--wrkdir", "/home/brezerk")  at:  "/home/brezerk"
Done

I have fixed *.desktop files export as well, now %f tag will be added at the end of Exec entity.

Just in case, if you need to fix any existing *desktop file manually, just add %f tag at the end of Exec entity.

Here you are the example:

[Desktop Entry]
Exec=/usr/local/bin/q4wine-cli -p "Default"  -d "system"  -i "wordpad"  %f
Icon=/usr/local/share/q4wine/icons/wordpad.svg
Type=Application
StartupNotify=true
GenericName=wordpad
Comment=Wine wordpad text editor
Name=wordpad
Path=

It will be nice if you play around latest git build to test it.
Let me know if you have any questions.

@Svadkos
Copy link

@Svadkos Svadkos commented Jul 8, 2016

Seems like he trying to open document from working directory, but this document is located in ~/Documents.
screenshot_20160708
Maybe then create some file associations as wine does, because as far as i remember, they worked? But the only ones i might create or choose myself, not all of them.

I have fixed *.desktop files export as well

And to me now it is stopped working, lol. Q4wine create file in ~/.config/menus/applications-merged/, but ~/.local/share/applications/ stays empty.

@Svadkos
Copy link

@Svadkos Svadkos commented Jul 8, 2016

And to me now it is stopped working, lol. Q4wine create file in ~/.config/menus/applications-merged/, but ~/.local/share/applications/ stays empty.

Test one more time on stable q4wine and still ~/.local/share/applications/ stays empty, hm.

@brezerk
Copy link
Owner Author

@brezerk brezerk commented Jul 9, 2016

Hi @Svadkos,

Seems like he trying to open document from working directory, but this document is located in ~/Documents.

not sure if it related to q4wine.

both:
/tmp/build-q4wine/src/q4wine-cli/q4wine-cli -p "Default" -d "system" -i "wordpad" "/home/brezerk/Documents/normalize.sh
and
/tmp/build-q4wine/src/q4wine-cli/q4wine-cli -p "Default" -d "system" -i "wordpad" "~/Documents/normalize.sh

works fine for build in wordpad app for me.

and still ~/.local/share/applications/ stays empty

Yes, q4wine does not populate ~/.local/share/applications/

@Svadkos
Copy link

@Svadkos Svadkos commented Jul 11, 2016

not sure if it related to q4wine.

You right, in new prefix it began to work.

Yes, q4wine does not populate ~/.local/share/applications/

Well, i'm pretty sure that it did before. And if i'm wrong why q4wine create file in ~/.config/menus/applications-merged/ with structure of icons?

@brezerk
Copy link
Owner Author

@brezerk brezerk commented Jul 12, 2016

Hi @Svadkos

why q4wine create file in ~/.config/menus/applications-merged/ with structure of icons?

It allows your DM to build q4wine's app menu structure:

screenshot_20160712_220453
screenshot_20160712_220510
screenshot_20160712_220528
screenshot_20160712_220551
screenshot_20160712_220741

@brezerk
Copy link
Owner Author

@brezerk brezerk commented Jul 12, 2016

Well, i'm pretty sure that it did before.

Nope :) afik wine itself is responsible for creating files associations:

[ himera ] brezerk@pts/0:1  ~ $
> 07/12/16 22:09:07 EEST > ls ~/.local/share/applications 
drwxr-xr-x  4 brezerk brezerk 4096 Jul  8 00:47 .
drwxr-xr-x 30 brezerk brezerk 4096 Jul 10 13:07 ..
-rw-------  1 brezerk brezerk  153 May 14 12:51 mimeapps.list
-rw-r--r--  1 brezerk brezerk  719 May  2 19:30 mimeinfo.cache
-rw-r--r--  1 brezerk brezerk  205 May  1 22:25 wine-extension-chm.desktop
-rw-r--r--  1 brezerk brezerk  212 May  1 22:25 wine-extension-gif.desktop
-rw-r--r--  1 brezerk brezerk  207 May  1 22:25 wine-extension-hlp.desktop
-rw-r--r--  1 brezerk brezerk  205 May  1 22:25 wine-extension-htm.desktop
-rw-r--r--  1 brezerk brezerk  219 May  1 22:26 wine-extension-ini.desktop
-rw-r--r--  1 brezerk brezerk  215 May  1 22:26 wine-extension-jfif.desktop
-rw-r--r--  1 brezerk brezerk  214 May  1 22:26 wine-extension-jpe.desktop
-rw-r--r--  1 brezerk brezerk  228 May  1 22:26 wine-extension-msp.desktop
-rw-r--r--  1 brezerk brezerk  212 May  1 22:26 wine-extension-png.desktop
-rw-r--r--  1 brezerk brezerk  213 May  2 19:30 wine-extension-rtf.desktop
-rw-r--r--  1 brezerk brezerk  197 May  1 22:26 wine-extension-txt.desktop
-rw-r--r--  1 brezerk brezerk  220 May  1 22:26 wine-extension-url.desktop
-rw-r--r--  1 brezerk brezerk  210 May  1 22:26 wine-extension-vbs.desktop
-rw-r--r--  1 brezerk brezerk  208 May  1 22:26 wine-extension-wri.desktop
-rw-r--r--  1 brezerk brezerk  210 May  1 22:26 wine-extension-xml.desktop

but q4wine is not really aware of any of them.

@brezerk
Copy link
Owner Author

@brezerk brezerk commented Jul 19, 2016

hi @Svadkos anything else needs to be fixed in this scope? can we close this issue?

@Svadkos
Copy link

@Svadkos Svadkos commented Jul 21, 2016

Sorry, couldn't answer before.

It allows your DM to build q4wine's app menu structure:

I see, maybe i broke something, or it's kde bug. Before i have exactly the same menu.
Now it's just empty structure in menu editor.
screenshot_20160721_155938

Nope :) afik wine itself is responsible for creating files associations:

I know, and don't like it, too much unnecessary trash, so i turn it off, or remove.

anything else needs to be fixed in this scope? can we close this issue?

In this scope, i think nothing, beside associations. But if you think that's a bad idea, so be it, i still can create them myself through DM.

@brezerk
Copy link
Owner Author

@brezerk brezerk commented Jul 21, 2016

ic. Well. It is up to you: if you think it will be good idea to have ability to create files association via q4wine's menu: feel free to create an separate ticket to discuss this feature.

I will close this ticket.

Thanks for the bug report, re open if needed.

@brezerk brezerk closed this Jul 21, 2016
@mg979
Copy link
Contributor

@mg979 mg979 commented Jan 14, 2018

Hello, I still have issues with this.

First: this is a desktop entry for MS Word

[Desktop Entry]
Exec=/usr/bin/q4wine-cli -p "Office"  -d "system"  -i "MS Word"  %f
Icon=/home/xxx/.PlayOnLinux/icones/full_size/WINWORD
Type=Application
StartupNotify=true
GenericName=MS Word
Name=MS Word
Path=/home/xxx/.PlayOnLinux/wineprefix/Office/drive_c/Program Files/Microsoft Office/OFFICE11/

If I try to open a .doc file with it (with direct file association), the file isn't loaded. That is, Word is started with an empty file. It works with wine desktop file, that is:

[Desktop Entry]
Type=Application
Name=Microsoft Office Word
MimeType=application/msword;
Exec=env WINEPREFIX="/home/xxx/.PlayOnLinux/wineprefix/Office" wine start /ProgIDOpen Word.Document.8 %f
NoDisplay=true
StartupNotify=true

Second, if the filename has spaces in it, not only it isn't loaded, but MS Word throws an error that it couldn't load the file. It doesn't if I add quotes to %f. but the file still isn't loaded:

Exec=/usr/bin/q4wine-cli -p "Office"  -d "system"  -i "MS Word"  "%f"
@brezerk
Copy link
Owner Author

@brezerk brezerk commented Jan 15, 2018

hi @mg979

Thanks for feedback.
I'll take a look on it tomorrow.

But just to confirm: which one q4wine version are you using?

@mg979
Copy link
Contributor

@mg979 mg979 commented Jan 16, 2018

It's version v1.3.3 using Qt 5.7.1, on latest MX Linux(Debian stable). I solved it by using wine start /ProgIDOpen command for now, even if it forces me to use default wine version.

Also, I have some other problems but I don't know if they depend on the q4wine version, if it's not the latest.

@mg979
Copy link
Contributor

@mg979 mg979 commented Jan 16, 2018

I could run them through q4wine (and a different wine version) with this custom command line:

%CONSOLE_BIN% %CONSOLE_ARGS% %ENV_BIN% %ENV_ARGS% /bin/sh -c "%WORK_DIR% %SET_NICE% %WINE_BIN% start %PROGRAM_ARGS%"

this .desktop file Exec fields (example for Excel):

Exec=/usr/bin/q4wine-cli -p "Office"  -d "system"  -i "MS Excel"  "%f"

and these arguments in the icon setup: /ProgIDOpen Excel.Sheet.8

But this only works when opening a file from the file manager, to launch the apps with no file loaded, I had to make other icons(with the EXE filename as argument, since it's not passed by the custom command line). So, it works but it must be configured manually.

@brezerk brezerk reopened this Jan 16, 2018
@brezerk
Copy link
Owner Author

@brezerk brezerk commented Jan 16, 2018

hi @mg979

Can you try some other app like embedded wordpad? Are you able to open documents via it?

This seems to be working for me:

q4wine-cli -p "Default" -d "system" -i "wordpad" ~/minicom.log

However, the issue with spaces confirmed:

q4wine-cli -p "Default" -d "system" -i "wordpad" ~/my\ inicom.log

Not sure if the two issues are related. But this one needs to be fixed :)

@brezerk
Copy link
Owner Author

@brezerk brezerk commented Jan 16, 2018

never mind. I had a typo in my command. Spaces are working for me fine too:

./q4wine-cli -p "Default" -d "system" -i "wordpad" ~/my\ minicom.log

and

./q4wine-cli -p "Default" -d "system" -i "wordpad" /home/brezerk/my minicom.log
@mg979
Copy link
Contributor

@mg979 mg979 commented Jan 17, 2018

Wordpad works, with Office 2003 it doesn't, but it works with wine start /ProgIDOpen.

This works (if I change the icons/command line as described above):

q4wine-cli -p "Office" -d "system" -i "MS Word" "~/my\ minicom.log"

These do not:

q4wine-cli -p "Office" -d "system" -i "MS Word" "~/my minicom.log"
q4wine-cli -p "Office" -d "system" -i "MS Word" ~/my\ minicom.log

Maybe it's also an old Office version (2003)? Anyway I got it working in one way or another. It would be nice if it were possible to adjust the command line also per app, not only per prefix. Thanks.

@brezerk
Copy link
Owner Author

@brezerk brezerk commented Jan 17, 2018

ic. well, adjusting command line per app will be possible in 2.x aka q4wine-next as 1.x code base is pretty old and not flexible.

however: did you had any luck with raw wine command like this:

env WINEPREFIX="/home/xxx/.PlayOnLinux/wineprefix/Office" wine <path_to_ms_word_binary.exe> <document>

?

@mg979
Copy link
Contributor

@mg979 mg979 commented Jan 17, 2018

Yes that works(but it uses the default wine version). It's not a trouble since I can launch it one way or another (either with default wine, or through q4wine with edited command line).

The only issue I have for now is that, since the command line that doesn't execute an EXE, but calls wine start /ProgIDOpen, I can't change the prefix configuration after I modify the command line, I get this message:
Istantanea.png

Not really important though. Maybe you could support custom command line per app and wine start /ProgIDOpen in .desktop files(for example, a q4wine-cli argument that automatically replaces %WINE_BIN% %PROGRAM_BIN% %PROGRAM_ARGS% with %WINE_BIN% start /ProgIDOpen %PROGRAM_ARGS%)

@brezerk
Copy link
Owner Author

@brezerk brezerk commented Jan 17, 2018

Interesting.

@mg979 would it be possible for you to build q4wine-git with -DDEBUG=ON option set? q4wine-cli \ q4wine-helper will provide a lot of debug info in this case, including the exact commands.

@mg979
Copy link
Contributor

@mg979 mg979 commented Jan 17, 2018

Can I install a debug-enabled version in another directory, without uninstalling the default one? I cloned q4wine in ~/Apps/q4wine/, then I tried this from ~/Apps/q4wine/build

$ cmake -DCMAKE_INSTALL_PREFIX=/home/gianmaria/Apps/q4wine-debug -DDEBUG=ON ..

but I get this error:

CMake Error at src/CMakeLists.txt:38 (find_package):
  By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Core", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Core" with any
  of the following names:

    Qt5CoreConfig.cmake
    qt5core-config.cmake

  Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
  "Qt5Core_DIR" to a directory containing one of the above files.  If
  "Qt5Core" provides a separate development package or SDK, be sure it has
  been installed.
@brezerk
Copy link
Owner Author

@brezerk brezerk commented Jan 17, 2018

hi @mg979 yes, you can have both at the same time. Just set -DCMAKE_INSTALL_PREFIX to different directory (just as you did).

It seems like you are missing the qt5-devel packages.

@mg979
Copy link
Contributor

@mg979 mg979 commented Jan 17, 2018

Ok I could install it, now the error window is this one:
Istantanea-2.png

Should I look for some error logs somewhere else? Also, are there changes in 1.3.6 that I should be aware of(compared to 1.3.3)?

@brezerk
Copy link
Owner Author

@brezerk brezerk commented Jan 17, 2018

No. This are fine. Try to bypass the regedit.exe.

It' this should be: wine start regedit.exe C:/temp/7996.reg

@ghost
Copy link

@ghost ghost commented Feb 17, 2018

I'm hitting the same issue after I added wine start EXCEL.exe to prefix template.
/usr/bin/q4wine-cli -p office -d office -i "Microsoft Excel 2010" /home/user/Documents/abc.xls doesn't work.

cd /home/user/Documents/ && /usr/bin/q4wine-cli -p office -d office -i "Microsoft Excel 2010" abc.xls works. Unfortunately opening file from file manager always executes the former command.

@brezerk
Copy link
Owner Author

@brezerk brezerk commented Mar 2, 2018

@FedericoYundt just wonder: will it work with full path specified in Windows notation?

i.e. something like this:

/usr/bin/q4wine-cli -p office -d office -i "Microsoft Excel 2010" C:\users\<username>\My Documents\abc.xls
@brezerk
Copy link
Owner Author

@brezerk brezerk commented Mar 2, 2018

also, assuming all other applications seems to be working as expected, this is really something to do with the way how MSO is handling the arguments.

There is an article: https://support.microsoft.com/en-us/help/210565/how-to-use-startup-command-line-switches-to-start-word-2010-word-2007

Maybe you can play around with the arguments i.e. something like:

/usr/bin/q4wine-cli -p office -d office -i "Microsoft Excel 2010" \f /home/user/Documents/abc.xls

will work

@ghost
Copy link

@ghost ghost commented Mar 2, 2018

Thanks for the reply. None of the above works. C:\users\<username>\My Documents\abc.xls is treated as wrong unix path.

/usr/bin/q4wine-cli -p office -d office -i "Microsoft Excel 2010" \f /home/user/Documents/abc.xls
Above should be:
/usr/bin/q4wine-cli -p office -d office -i "Microsoft Excel 2010" /t /home/user/Documents/abc.xls but it treats /t (or \f) as a filepath.

wine 'C:\\\\windows\\\\command\\\\start.exe' /Unix %U - this command works when I run wine directly without q4wine.

@brezerk brezerk modified the milestones: 1.3.1, Future Sep 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.