zeitlings Posted February 7, 2023 Share Posted February 7, 2023 (edited) Hey, I found a way to implement modifier palettes and double-tap hotkeys, i.e. a way to invoke actions on consecutive keystrokes. The core idea is to inject environment variables into the workflow configuration and to modify them with some delay. For example, you could use ⌥K to do multiple things. On its own, the hotkey would do nothing, but when activated shortly after hitting another hotkey that activates some palette, it will trigger a specific action: ⌥O, ⌥K To trigger action A (e.g. launch an app)⌥I, ⌥K To trigger action B. (e.g. launch a different app) Double-tap hotkeys work according to the same mechanism. I have uploaded a demo and spelled out some more details over here: https://github.com/zeitlings/alfred-workflows#21-extended-hotkeys Disclaimer: Alfred may crash if you get the timing of the keystrokes just right. This is due to a data race where the same variable (“gate”) is accessed and modified by different threads at the same time. I don’t know how the Scripting Bridge is implemented behind the scenes, but perhaps setting environment variables could be wrapped in a mutex to ensure exclusive access to those variables in a future update? Edited February 7, 2023 by zeitlings Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now