question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: non-global / focus-only shortcuts

See original GitHub issue

It would be great if when assigning shortcuts, that we could pass global: false or something so the active callback would only be called if the app is focused.

I guess we could check ourselves if the app is focused, but maybe it would more efficient not to catch the keys at all when the app is blurred on a lower level?

<bountysource-plugin>

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
adam-lynchcommented, Oct 20, 2014

@blazedd I understand how to bind key events, etc. It’s not that it’s technically impossible as is, I’m simply asking for the option to not make the shortcuts global, as a built-in option in the shortcuts API. If you don’t want it, that’s ok.

It would be handy. Otherwise, let’s say you don’t know how many windows will be open at once. You then need to:

  • Keep track of all open windows; maintain an array and bind a close event handler for each window.
  • Bind focus & blur event handlers to each window and store a isFocused Boolean somewhere for each window.
  • When the key event callback is triggered by the Shortcuts API, loop over the open windows
  • If and only if all windows are blurred, then run the custom logic.

global: false would be a lot nicer.

0reactions
stale[bot]commented, Sep 30, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's new in Shortcuts - Apple Support
Learn about the new features in Shortcuts for iOS, iPadOS, macOS, and watchOS. Get complete step-by-step instructions and information on all ...
Read more >
ability to disable the global keyboard shortcut invoking 1P mini
Is it possible to put a checkbox in the 1P settings to disable the global keyboard shortcut that invokes 1P mini?
Read more >
ability to add global keyboard shortcuts - chromium - Monorail
I wanted to create an extension that adds "screen" keybinding to Chrome for tab management, e.g., press ^a-^a to switch between recent tabs,...
Read more >
Creating and handling shortcuts - Slack API
Global shortcuts are not visible (and therefore usable) for all types of guest user. Please see our Help Center for an up-to-date breakdown...
Read more >
Speeding up workflows with keyboard shortcuts - Postman Blog
Without a shortcut, a user would have to select a request in the sidebar using their pointer every time they wanted to open...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found