Open sean256 opened 5 years ago
+1 This would be really helpful for us.
+1 This would be really nice
As a workaround you can create a script
to dispatch an event with new CSXSEvent()
to be able to catch it from your CEP Panel
An automate script
which you can bind to a keyboard shortcut, but you loose a bit the point of the CEP Panel
Hi @sean256 , when are you registering for the shortcut in your workflow? According to the documentation , you should be able to register. Please note, it says:
"This function works with modeless extensions and panel extensions. Generally all the key events will be sent to the host application for these two extensions if the current focused element is not text input or dropdown.
If you want to intercept some key events and you want them to be handled in the extension, please call this function in advance to prevent them being sent to the host application."
@prernavij I register key events immediately and it works, but only if the panel has focus. If it is supposed to behave in any other way then it's bugged.
There is another open issue where people are having multiple issues with the registration of key events. Most of the thread is about OS key codes being different but there are a few who spotted that it also needs focus which defeats the purpose. https://github.com/Adobe-CEP/CEP-Resources/issues/165
I got a bit of a convoluted hack working.
function sendEvent(type) {
new ExternalObject('lib:\PlugPlugExternalObject'); // The next line fails unless this is called
var event = new CSXSEvent();
event.type = type;
event.dispatch();
}
sendEvent('some-event-name-hotkey-thing');
csInterface.addEventListener('some-event-name-hotkey-thing', () => {
// do something here
})
I got a bit of a convoluted hack working.
Create a JSX script and save it somewhere.
function sendEvent(type) { new ExternalObject('lib:\PlugPlugExternalObject'); // The next line fails unless this is called var event = new CSXSEvent(); event.type = type; event.dispatch(); } sendEvent('some-event-name-hotkey-thing');
If you wanted to have the hotkey more customizable, you could copy it to the photoshop scripts folder and hotkey to the File->Scripts->SomeEventHotkey.jsx directly.
More importantly, I wonder if it would be possible to use this to pass focus to your panel so other hotkeys would then work?
Anyone found a workaround for keyboard events when the panel is not focused ?
Anyone found a workaround for keyboard events when the panel is not focused ?
Same here, it would be appreciated if anyone has any ideas regarding this
Use case
We have a panel which performs "action a" when user clicks on a button in the panel. Our users would like a keyboard shortcut which is always available to do "action a".
What we tried so far
registerKeyEventsInterest
This is a funny one. It works if the panel has focus, which requires the users to click into the panel so this doesn't work as a global keyboard shortcut. If the panel needs focus what is even the point of having us use
registerKeyEventsInterest
? I could see an interface likeregisterKeyEventsInterest
making sense if we want to capture key events outside of our panel focus.Panel Menus + Edit -> Keyboard Shortcuts...
Options?
Is there any option available to us and our users to give them globally available keyboard shortcuts?