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

Multipurpose commands not working... #632

Closed
ROBCON-Software opened this issue Jan 14, 2022 · 3 comments
Closed

Multipurpose commands not working... #632

ROBCON-Software opened this issue Jan 14, 2022 · 3 comments

Comments

@ROBCON-Software
Copy link

ROBCON-Software commented Jan 14, 2022

What I want to achieve: Create new blank tab without any other tabs (close all, not only close others, but don't close browser)

What does not work:
If multipurpose command is created for example: 1./ close other tabs + 2./ close tab -> the 2./ command doesn't execute because the last tab stays active and is not closed... This two command should have effect of "only one blank "new" tab".
Same happens by other combinations, eg. 1./ create new tab (right) + 2./ close all tabs on the left -> this should also end up with only new blank tab, but leaves all tabs living, and new one on the right - also command 2./ not working...

System:

  • Operating system: Windows 10 Pro - version 2004 - 19041.1415
  • Firefox version: 96.0 (64-bit)
  • Gesturefy version: 3.2.4
@Robbendebiene
Copy link
Owner

What you are trying to achieve is not possible with the multi purpose command, because it will only ever execute one command completely (more details here: https://github.com/Robbendebiene/Gesturefy/wiki/Multi-purpose-command). It is not designed to run multiple commands together. I mainly avoided adding this functionality because there are cases where it is unclear what the expected outcome would be. In theory your desired functionality can be implemented via a user script. However user scripts still suffer from a CSP problem which prevents their execution on some websites.

@ROBCON-Software
Copy link
Author

Hi, well, but I want to execute one command, and after completing, another command. Not running them together... Is there not some problem with "zero" pause between them ? Thanks.

@Robbendebiene
Copy link
Owner

Hi, well, but I want to execute one command, and after completing, another command. Not running them together... Is there not some problem with "zero" pause between them ?

You are right, running everything simultaneously would be problematic. That's why the "multi purpose command" executes the commands one after another till the first sub-command succeeds. So again, it is not designed to cover your use case.

After a long waiting period I decided not to implement a separate command for this.
Instead I coded the following user script which opens a new tab and closes all other tabs.
You can use it with the "user script command".

const queryTabs = API.tabs.query({
  hidden: false,
  currentWindow: true
});

const newTab = API.tabs.create({});

Promise.all([queryTabs, newTab]).then((results) => {
 const [tabs] = results;
 const tabIds = tabs.map((tab) => tab.id);
 API.tabs.remove(tabIds);
});

Be aware that user scripts currently don't work on some websites (#569). But there is a chance that this will be solved with a new Firefox release in about a year or so.

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