I am trying to create something like a quicklauncher that can be displayed on top of all other windows when a particular key combination is pressed and then minimized back into the system tray if that combination is pressed again.
My current code inside the keyPressed function is:
class ViewToggleKeyListener : public KeyListener{ public: bool keyPressed (const KeyPress &key, Component* originatingComponent); }; bool ViewToggleKeyListener::keyPressed (const KeyPress &key, Component* originatingComponent){ static KeyPress targetCombination('T', ModifierKeys::ctrlModifier, NULL); if(key == targetCombination){ originatingComponent->setVisible(!originatingComponent->isVisible()); originatingComponent->grabKeyboardFocus(); } return false; }
This works when the application is initially launched but the keyPressed function is not called again once the application is not visible anymore.
Is there a way to have a 'global' keypress listener so that I can toggle this application between a state where it is on top of all other windows and minimized into the system tray?
Thanks in advance!