I’m working on a project (gomics, a comic book viewer) that has a menubar, with various accelerators for menu items. The application has a fullscreen mode that hides everything except the current page, including the menubar. Since the menubar is hidden in fullscreen mode, the accelerators directly attached to the menu items do not work.
My first approach was capturing key events for the top level window that mirror the accelerators, only respond in fullscreen mode. This added a lot of code duplication and didn’t directly support accelerator maps.
I also tried having just a single top-level accelerator group, but then the accelerator mapping labels do not appear on the menu items, since they aren’t attached to them.
In the current iteration I have two mirrored accel groups, one for fullscreen attached to the top-level window, and one for non-fullscreen attached to the menu items. The groups are swapped out depending on which mode is active.
What would be the best way to solve this problem? Ideally I’d also like the accelerators to be user remappable via accelerator maps.
A small test case is at: https://gitlab.com/nyxb71/gtk-accels-test/blob/master/test.go