addon to use space as a modifier?
It is possible for an addon to set override bindings via secure handlers to mimic using the spacebar as a modifier for key binding purposes, but it is still impossible for an in-game addon to make the spacebar recognized in a [mod] condition in a macro.
If anyone else reading wants to take a crack at releasing what could be the first addon of its kind, here's the basic approach to the technical bits: you would set up a SecureHandlerClickTemplate bound to the special modifier key (like "SPACE"). In the handler's click snippet, if down flag is set it does a handler:SetBinding for keys assigned to their configured action. If down flag is clear it does a handler:CearBinding. So the upshot is that holding the bound key will set a mass of override bindings for as long as the key is down and restore them when released.
The tricky bit is setting up a configuration that can work in the secure environment and having undefined keys use their old value. One approach is an initial handler:Execute snippet that defines a table of keys that can be modified. Can do CTRL- ALT- SHIFT- combos if you really want too since the binding isn't run until a non-modifier is hit. Then the configuration UI can assign attributes like handler:SetAttribute("bindingS","JUMP"). Then the click handler can do go down the table to see if any bindings are defined: if self:GetAttribute("binding"..key)) then handler:SetBinding(false,key,self:GetAttribute("binding"..key)) end. So it will leave unmodified keys alone. Maybe numeric attributes or frame references instead of attributes to minimize string concatenation.
Two important things to note that I forgot to mention earlier in the thread:
- If you turn space into a modifier, you can't continue to use it to jump. (but you can bind space+tab to jump or whatever)
- If your bar addon doesn't use the default key binding interface, the author of that bar addon would need to implement their own custom modifier.
I wonder if with the current issues with Secure Handlers if this would get broken occaisionally like Raid Frames etc...
Actually, stuff inside an addon's secure environment is very taint-resistant. It will never create a single byte of taint.log. It's when stuff outside the secure environment touches stuff inappropriately and things get tainted. In this addon's case, the binding override bit is taint-proof. The default key binding frame was touched by this addon so it itself is tainted but since you never bind keys in combat, it "shouldn't" be an issue.
Please report any Code of Conduct violations, including:
Threats of violence. We take these seriously and will alert the proper authorities.
Posts containing personal information about other players. This includes physical addresses, e-mail addresses, phone numbers, and inappropriate photos and/or videos.
Harassing or discriminatory language. This will not be tolerated.