Skip to content
This repository has been archived by the owner on Dec 10, 2018. It is now read-only.

Mime-type launcher #94

Closed
tresf opened this issue Sep 25, 2015 · 14 comments
Closed

Mime-type launcher #94

tresf opened this issue Sep 25, 2015 · 14 comments

Comments

@tresf
Copy link
Contributor

tresf commented Sep 25, 2015

A placeholder to add a mimetype/URI launcher for the web browsers which allows QZ Tray to be launched by URL, i.e.

image

Original request: "[Since] JS wont allow for waking the app, would it not be possible to define a MIME-type during the installation and just use that in order to wake the application from a website, just to get the connection for the two-way up and spinning"

I think this is doable at install time via a URL like

qz:launch

tresf added a commit that referenced this issue Nov 5, 2015
Support is currently Windows only
Partial support for #94
@tresf
Copy link
Contributor Author

tresf commented Nov 5, 2015

Initial support added via 66185b2, 4c40812 (Windows only). Linux and Mac will require some more research.

@klabarge if you're interested in researching the Linux side of things, please do and post your findings here.

tresf added a commit that referenced this issue Nov 5, 2015
Per #94

Allows qz to be launched on apple via URL "qz:launch"
@tresf
Copy link
Contributor Author

tresf commented Nov 5, 2015

Apple support added via b57c573.

@tresf tresf closed this as completed in 5eb78bf Nov 5, 2015
@tresf
Copy link
Contributor Author

tresf commented Nov 5, 2015

Linux support added via 5eb78bf which closes this issue out.

@lite1979 @klabarge can you test this out? The easiest way is to add this to an HTML file:

<a href="qz:launch">Launch QZ Tray</a>

@klabarge
Copy link
Member

klabarge commented Nov 5, 2015

I compiled and installed the latest version on Ubuntu 14.04

I added the line:

<a href="qz:launch">Launch QZ Tray</a>

to sample.html to create a link.

When clicking the link in Chrome, the following dialogue appears:

image

When clicking "Launch Application," another instance of Chrome is launched. QZ Tray is not launched.

Doing this in Firefox results in the following:

image

@tresf
Copy link
Contributor Author

tresf commented Nov 6, 2015

Thanks Kyle. Can you try the following command please?

xdg-mime default qz-tray.desktop x-scheme-handler/qz

This will only affect the current logged in user but was the first approach I had tried.

@tresf
Copy link
Contributor Author

tresf commented Nov 6, 2015

Actually Kyle... instead can you try to run this command interactively, perhaps there's a bug with the way I'm calling it in our install script...

sudo update-desktop-database

@klabarge
Copy link
Member

klabarge commented Nov 6, 2015

I first ran: sudo update-desktop-database and tried launching QZ Tray from both Chrome and Firefox.

  1. Chrome
    • Even after restarting the browser, a second instance of Chrome was launched. QZ Tray was not launched
  2. Firefox
    • A refresh of the page brought the dialogue below. After selecting "OK," QZ Tray was launched.
      image

I then ran xdg-mime default qz-tray.desktop x-scheme-handler/qz

  • Chrome still did not launch QZ Tray
  • Firefox still worked

@tresf
Copy link
Contributor Author

tresf commented Nov 6, 2015

Chrome works fine for me on both 14.04 and 12.04 so as long as I use that sudo update-desktop-database after install. I'm still perplexed as to why it needs to be run again...

In regards to it not launching for you in Chrome, try launching Google Chrome from command line via google-chrome and see if the error console says anything about why it won't launch.

@tresf
Copy link
Contributor Author

tresf commented Nov 6, 2015

Testing results (I will update this post for other distros):

  • Ubuntu 12.04 x64

    Launcher Version Test Results
    chromium-browser 37 ✅ Pass
    google-chrome 46 ✅ Pass
    xdg-open 1.0.2 ✅ Pass
    firefox 23 ⛔ Fail
    firefox 42 ✅ Pass
  • Ubuntu 14.04 x64

    Launcher Version Test Results
    chromium-browser 37 ⛔ Fail
    google-chrome 46 ⛔ Fail
    xdg-open 1.0.2 ⛔ Fail
    firefox 34 ⛔ Fail
    firefox 42 ⛔ Fail
    • Note: All tests ✅ Pass in 14.04 after sudo update-desktop-database is run manually after install. This shouldn't be needed. What is special about Ubuntu 14.04?
    • Edit: Running the 12.04 built package seems to fix this issue on 14.04. Is the bug with Ubuntu or makeself?

tresf added a commit that referenced this issue Nov 6, 2015
Fixes packaging on Ubuntu 14.04 via #94
Closes upstream bug report megastep/makeself#58
@tresf
Copy link
Contributor Author

tresf commented Nov 6, 2015

Ubuntu 14.04 fixed via ba51664.

klabarge pushed a commit to klabarge/qz-print that referenced this issue Dec 2, 2015
Support is currently Windows only
Partial support for qzind#94
klabarge pushed a commit to klabarge/qz-print that referenced this issue Dec 2, 2015
Per qzind#94

Allows qz to be launched on apple via URL "qz:launch"
klabarge pushed a commit to klabarge/qz-print that referenced this issue Dec 2, 2015
Allows qz:launch URLs to automatically launch the QZ Tray software.

Closes qzind#94
klabarge pushed a commit to klabarge/qz-print that referenced this issue Dec 2, 2015
Fixes packaging on Ubuntu 14.04 via qzind#94
Closes upstream bug report megastep/makeself#58
@tresf
Copy link
Contributor Author

tresf commented Jan 4, 2016

This seems to be broken for Firefox on OSX. Reopening.

@tresf tresf reopened this Jan 4, 2016
@tresf
Copy link
Contributor Author

tresf commented Jan 4, 2016

Some more details about Firefox 43 + OS X 10.7:

Edit: Upstream bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=718422

Although Chrome and Safari work, Firefox seems to be pickier.

  1. The behavior between <a href="javascript:window.location("qz:launch");">... and <a href="qz:launch"> differs in Firefox on Mac which means we may need to change the code in sample.html to accommodate.

  2. If the following keys are added to about:config (Firefox on Mac), it shows the launch dialog, but doesn't have QZ Tray auto-filled as the application to launch.

    # Boolean
    network.protocol-handler.expose.qz=false
    network.protocol-handler.external.qz=true
    # String
    network.protocol-handler.app.qz=/Applications/QZ Tray.app
  3. Furthermore, selecting QZ Tray from the list of possible applications does not update the keys in about:config, so capturing the proper settings is proving difficult.

I've reached out to Mike Kaply for assistance. Perhaps he knows a trick to get this working. Note, this problem doesn't occur with mailto: links, which is what I used for my baseline when testing.

Edit: Update, this seems to remedy the problem... I've no idea how to automate this though.

  1. Open Firefox/Profiles/<current profile>.default/mimeTypes.rdf

  2. Add the following lines:

    <RDF:Description RDF:about="urn:scheme:handler:qz" NC:useSystemDefault="true" NC:alwaysAsk="false"/>
    <RDF:Description RDF:about="urn:scheme:qz" NC:value="qz">
      <NC:handlerProp RDF:resource="urn:scheme:handler:qz"/>
    </RDF:Description>
    <!-- FIND 
    <RDF:Seq RDF:about="urn:schemes:root">
      <RDF:li RDF:resource="urn:scheme:webcal"/>
      <RDF:li RDF:resource="urn:scheme:ircs"/>
      <RDF:li RDF:resource="urn:scheme:mailto"/>
      <RDF:li RDF:resource="urn:scheme:irc"/>
      APPEND -->
      <RDF:li RDF:resource="urn:scheme:qz" />
      <!--
    </RDF:Seq> -->

@tresf
Copy link
Contributor Author

tresf commented Jan 7, 2016

I think I figured out a fix. Ready to test via dd5956e.

@tresf
Copy link
Contributor Author

tresf commented Jan 7, 2016

Works so as long as preference network.protocol-handler.expose.qz is set to false, but only for physical qz:launch links, not for window.location.assign("qz:launch"); (how we recommend launching it).

Mike's offered to write a protocol handler... I think this is quite overkill, but I don't think we have an option at this point if we want our "Launch QZ Tray" button to work.

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

No branches or pull requests

2 participants