Haven't tested this myself, but you could try something like this:
init:
Code:
local keybindButtonDescriptor = KEYBIND_STRIP.keybinds["UI_SHORTCUT_PRIMARY"]
local oldEnabled = keybindButtonDescriptor.enabled
disable:
Code:
keybindButtonDescriptor.enabled = false -- can also be a function that returns a boolean
KEYBIND_STRIP:UpdateKeybindButton(keybindButtonDescriptor)
enable:
Code:
keybindButtonDescriptor.enabled = oldEnabled
KEYBIND_STRIP:UpdateKeybindButton(keybindButtonDescriptor)
if this does not work, you could also replace keybindButtonDescriptor.callback with an empty function