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

Double clicking extension icon to toggle the tab between suspended and not #179

Open
ghost opened this issue Apr 19, 2015 · 6 comments
Open

Comments

@ghost
Copy link

ghost commented Apr 19, 2015

Double clicking the button should toggle the tab between suspended and not.

@deanoemcke
Copy link
Collaborator

@zwaa-vengeance which 'button' are you referring to?

@ghost
Copy link
Author

ghost commented Oct 2, 2015

That 'button' would be the Great Suspender icon next to the options icon at top right corner as seen below.
I just think that a Double Clicking option would be great, it would save a lot of time using TGS.
Hope you agree. Sorry for late answer.
thegreatsuspender

@deanoemcke deanoemcke changed the title Double clicking the button should toggle the tab between suspended and not Double clicking extension icon to toggle the tab between suspended and not Oct 23, 2017
@deanoemcke
Copy link
Collaborator

The upcoming release has a new keyboard shortcut to toggle the suspended state of the current tab. I may implement double click at some point in a future release.

@ghost
Copy link
Author

ghost commented Apr 21, 2018 via email

@deanoemcke
Copy link
Collaborator

I dont think that chrome gives me the ability to detect a double click on the extension icon (or any tab icons either).
Also, I would have thought that having to move the mouse all the way to the browser icon would be much harder than simply clicking on the large space in the middle of a suspended tab?

@fwextensions
Copy link
Contributor

@deanoemcke it's possible for an extension to detect a double-click on the browser icon by checking the time between when the port between the popup and the background was opened vs. closed. My QuicKey extension uses a double-click to toggle between the two most recent tabs. (It's mostly triggered by double-pressing the alt-Q keyboard shortcut that opens the popup, but a double-click works the same.)

In the background script, in chrome.runtime.onConnect it adds a listener for port.onDisconnect: https://github.com/fwextensions/QuicKey/blob/master/src/js/background/background.js#L250

Then the first thing it does in the popup is call chrome.runtime.connect();:
https://github.com/fwextensions/QuicKey/blob/master/src/js/popup/init.js#L10

It tracks the time between the port connect and disconnect, and if it's < 450ms, it toggles to the previous tab. In the TGS case, it would toggle the suspend state.

It's not 100% reliable, especially on an old machine with Chrome running slowly, but it works well enough. Listening to the port close is the only way to detect the popup getting closed, since the beforeunload event usually doesn't fire, but the port disconnect does.

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

No branches or pull requests

2 participants