Skip to content

Commit

Permalink
support cotrl
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanCarloMachado committed Dec 7, 2024
1 parent f0d1282 commit 6763d14
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions python_search/shortcut/mac_karabiner_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def parse_mac_shortcut(self, shortcut: str, content: dict, key: str):
]
},
"""
print("Processing shortcut: ", shortcut)
print("Processing shortcut: ", shortcut, ' for key: ', key)
shortcut_dict = {}
shortcut_dict['description'] = f"RUN {key} with shortcut {shortcut}"
shortcut_dict['manipulators'] = [
Expand All @@ -79,16 +79,24 @@ def parse_mac_shortcut(self, shortcut: str, content: dict, key: str):
for character in shortcut:
if character == '⌘':
if 'modifiers' not in shortcut_dict['manipulators'][0]['from']:
shortcut_dict['manipulators'][0]['from']['modifiers'] = {'mandatory': []}
shortcut_dict['manipulators'][0]['from']['modifiers']['mandatory'].append('left_gui')
shortcut_dict['manipulators'][0]['from']['modifiers'] = {'mandatory': ['left_gui']}
else:
shortcut_dict['manipulators'][0]['from']['modifiers']['mandatory'].append('left_gui')
elif character == '⇧':
if 'modifiers' not in shortcut_dict['manipulators'][0]['from']:
shortcut_dict['manipulators'][0]['from']['modifiers'] = {'mandatory': []}
shortcut_dict['manipulators'][0]['from']['modifiers']['mandatory'].append('left_shift')
shortcut_dict['manipulators'][0]['from']['modifiers'] = {'mandatory': ['left_shift']}
else:
shortcut_dict['manipulators'][0]['from']['modifiers']['mandatory'].append('left_shift')
elif character == '⌥':
if 'modifiers' not in shortcut_dict['manipulators'][0]['from']:
shortcut_dict['manipulators'][0]['from']['modifiers'] = {'mandatory': []}
shortcut_dict['manipulators'][0]['from']['modifiers']['mandatory'].append('left_alt')
shortcut_dict['manipulators'][0]['from']['modifiers'] = {'mandatory': ['left_alt']}
else:
shortcut_dict['manipulators'][0]['from']['modifiers']['mandatory'].append('left_alt')
elif character == '⌃':
if 'modifiers' not in shortcut_dict['manipulators'][0]['from']:
shortcut_dict['manipulators'][0]['from']['modifiers'] = {'mandatory': ['left_control']}
else:
shortcut_dict['manipulators'][0]['from']['modifiers']['mandatory'].append('left_control')

# test if is alphanumeric
if character.isalnum():
Expand Down

0 comments on commit 6763d14

Please sign in to comment.