Skip to content

Multi purpose command

Robin Thomas edited this page Feb 18, 2023 · 4 revisions

Multi purpose command

This command takes a sequence of commands, which are then run one after another till the first command succeeds. Therefore ultimately only one of the commands will take effect.

Use cases:

This command allows you to use the same gesture for multiple different contextual actions.

Benefits:

  • remember fewer gestures by grouping similar or seldom used commands (their conditions may overlap but should not be identical at best they are exclusive)
  • provide fallbacks for commands that might do nothing in certain conditions
  • create alternating commands

Examples:

  • Link To Bookmark > Toggle Bookmark
  • Search Text Selection > Search Clipboard
  • Copy Link URL > Copy Text Selection > Copy Image URL > Copy Tab URL
  • Reload Frame > Reload Tab
  • Open URL From Clipboard > Search Clipboard
  • Move Tab To End > Move Tab To Start (tab position will alternate between start and end)

When does a command succeed?

There is no single answer to that question since it depends on the command. Every command has different conditions and many of them e.g. "Close Tab" or "New Tab" will never fail respectively always succeed. If you think a command should fail when it does not and this command is not listed below feel free to create an issue.

User scripts

User scripts can call return false; to indicate that they failed, while every other return value indicates success. The user script command will also be treated as unsuccessful if the script fails with any kind of error.

Current limitations:

  • Page back/forth commands cannot fail which still makes Page Back > Close Tab impossible. (issue #69)