golang-design/hotkey

Allow unregister hotkeys

Closed this issue · 6 comments

There seems to be a TODO for Darwin and an UnregisterHotKey already for Windows. Any plans on adding implementation for Darwin and using the one available for Windows?

Hi. Thanks for the feature request. I was initially thought this is a feature but didn't implement this because I can't imagine a need of frequently register, deregister, register, ... loop. Could you explain the necessarily of unregistering a hotkey?

A GUI for the user to set/edit global shortcuts for commands while an application is running.

A GUI for the user to set/edit global shortcuts for commands while an application is running.

But that does not necessarily needed to be implemented at runtime. For example, Hotkey combination setting is registered at boot time, which can be stored in a config file. When a user needs added the hotkey, application rewrite the configuration and require a reboot to make it possible to be activated.

The required restart is exactly what I am trying to avoid. Just for better UX. I am making myself an app launcher with fyne.

BTW I am aware of the limitation - #5 and have workaround it by allowing the runOnMain method from fyne to be passed on the register method, leaving the mainthread package usage up to the client - ventsislav-georgiev@bdab820

Made it work via restart like you proposed for now:
shortcuts

On another note I had issue on Mac where sometime the app would fail to start and I think it was caused by the runApp/stopApp code. I've removed it as it does not seem necessary in my use-case trough fyne. - ventsislav-georgiev@060ae7d

I implemented the unregister feature and now available on v0.3.0-alpha.

Note that the new version breaks the existing APIs slightly.