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

open select item links with zotero standalone (Linux) #47

Closed
rdiaz02 opened this issue Dec 18, 2015 · 4 comments
Closed

open select item links with zotero standalone (Linux) #47

rdiaz02 opened this issue Dec 18, 2015 · 4 comments

Comments

@rdiaz02
Copy link

rdiaz02 commented Dec 18, 2015

In the documentation it is said explilcitly for "Copy select item links": "Following links from other applications and having the links select items in the Zotero Standalone client may also be achievable but might require additional set up."

However, I wonder if there is any indication of how to proceed in Linux. I understand that I'd eventually need to define a URI handler for xdg-open. However, even before that, it seems that Zotero Standalone, in Linux, ignores any additional arguments when called, regardless of whether or not Zutilo is installed. So there seems to be no way of having Zotero Standalone to follow a link in Linux. (This is in contrast to Firefox, where a call from the shell as
firefox zotero://select/items/ID will do the expected thing, whether or not Zutilo is not installed).

(Note: for the record, I've asked this in the Zotero forum , but the question there did not involve Zutilo. I am asking here in case Zutilo provides some additional functionaly that might make this work with standalone).

@wshanks
Copy link
Owner

wshanks commented Dec 18, 2015

Hmm, looking at the forum thread, it seems like you have tried all of the first things to try. The next thing to try would be looking at the source code for Zotero Standalone to see if the zotero command can actually handle arguments. I tried zotero --help and zotero --version and neither of them worked, so it might not be possible to pass arguments to zotero. I think the OS X method might work differently. Rather than passing arguments to the zotero process, the AppleScript might be sending commands to the window manager to interact with the Zotero window (though I don't see an Open option under the File menu, so I'm not sure how it is telling Zotero to open something). It might be that at least some window manager / desktop environments allow scripting like this, but I am not familiar with one that does (maybe GNOME or Cinnamon could through an extension?) (and I'm not sure how Zotero is opening those links in OS X to know how to copy that method).

@rdiaz02
Copy link
Author

rdiaz02 commented Dec 18, 2015

Thanks for checking. Under Linux actually the run-zotero.sh script calls a zotero binary that itself seems to accept a URL and some options, but they are the same as those provided by the firefox binary and passing all possible variations of zotero://select, as well as bogus things, does nothing. So it seems that binary does the URL. Looking at the code so far has not helped me, and I've seen other claims, such as this one that the stand alone can't accept this.

Your comments about OS X, however, are rather interesting. So I'll try to figure out if via window manager scripting in Linux something is feasible (though I've been using xmonad for ages, so I am not sure it'd be of much help here : ). As a last resort, I can fire up Firefox for these things.

@wshanks
Copy link
Owner

wshanks commented Dec 19, 2015

I looked at this a little more....

The section of code of interest to you is https://github.com/zotero/zotero/blob/4.0/components/zotero-service.js#L406. That is where the --url command line option is defined for opening Zotero select links. On my Linux system, the main exectuable for Zotero is located at /usr/bin/zotero and this is a boilerplate wrapper script from Mozilla that utlimately calls /usr/lib/zotero/zotero. Calling /usr/bin/zotero --url zotero://select/... did not do anything for me but calling /usr/lib/zotero/zotero --url zotero://select/... worked as you would expect for me, as long as Zoero is already open (otherwise Zotero is opened but the item is not selected). So it seems like the wrapper script is not passing the command line options properly to Zotero.

Looking at that script, it looks like it is supposed to pass all of its arguments on to the main Zotero binary here: https://github.com/zotero/zotero-standalone-build/blob/master/linux/run-zotero.sh#L398 but it is processing the first argument to use as the program to call here: https://github.com/zotero/zotero-standalone-build/blob/master/linux/run-zotero.sh#L239. Passing the binary as the first argument like zotero /usr/lib/zotero/zotero --url zotero://select/... works for me the same as calling /usr/lib/zotero/zotero directly.

You might want open an issue or two at https://github.com/zotero/zotero-standalone-build/issues since it seems like the argument handling of /usr/bin/zotero is not correct and also that /usr/lib zotero/zotero should be able to handle a zotero://select/... link passed on start up.

@rdiaz02
Copy link
Author

rdiaz02 commented Dec 19, 2015

Thanks a lot. I just submitted two issues. I also added an entry in the zotero forum thread.

Since the documentation for Zutilo mentions the handling of the zotero://select in "Copy select item links", maybe a reference to that forum could be appropriate? Something like "It is possible to get this to work under Linux with xdg-open; see, for instance, https://forums.zotero.org/discussion/8306/testing-zoteroselect/#Item_15 and https://forums.zotero.org/discussion/8306/testing-zoteroselect/#Item_22". I can submit a pull request if you'd prefer that.

I am closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants