Is it possible to create a keymap item / something similar and assign it to a simultaneous left / right mous button press?

Explanation: I need an easy-to-access shortcut for my addon. It should work across all areas and contexts (right now I'm using Shift+Ctrl+Alt+Right-mouse, which is crazy and fails in several contexts, e.g edit mode.

I've tried things like

addon_keymaps = []
def register():
wm = bpy.context.window_manager
km = wm.keyconfigs.addon.keymaps.new(name='Window', space_type='EMPTY', region_type='WINDOW')
kmi = km.keymap_items.new(
    key_modifier = 'LEFTMOUSE',
addon_keymaps.append((km, kmi))

but it does not work. Is it possible at all? (and if so, what am I doing wrong?)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.