{"id":13486640,"url":"https://github.com/dibsonthis/keyboard_listener","last_synced_at":"2025-03-27T21:30:43.281Z","repository":{"id":62574035,"uuid":"243763110","full_name":"dibsonthis/keyboard_listener","owner":"dibsonthis","description":"Keyboard Listener is a module that allows you to create custom hotkeys (combinations) or custom keywords and bind them to custom functions in Python","archived":false,"fork":false,"pushed_at":"2020-12-14T11:03:15.000Z","size":3374,"stargazers_count":79,"open_issues_count":3,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-24T23:18:44.708Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dibsonthis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-28T12:59:30.000Z","updated_at":"2024-03-10T19:32:10.000Z","dependencies_parsed_at":"2022-11-03T18:32:43.237Z","dependency_job_id":null,"html_url":"https://github.com/dibsonthis/keyboard_listener","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dibsonthis%2Fkeyboard_listener","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dibsonthis%2Fkeyboard_listener/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dibsonthis%2Fkeyboard_listener/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dibsonthis%2Fkeyboard_listener/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dibsonthis","download_url":"https://codeload.github.com/dibsonthis/keyboard_listener/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245927115,"owners_count":20695171,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T18:00:49.368Z","updated_at":"2025-03-27T21:30:43.262Z","avatar_url":"https://github.com/dibsonthis.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# keyboard_listener\n\nKeyboard Listener is a module that allows you to create custom hotkeys (combinations) or custom keywords and bind them to custom functions in Python.\n\n**Combinations** are custom hotkeys that are bound to functions. When the combination is pressed, the function is executed. Combos are really easy to set up and can be seen in the example below.\n\n**Keywords** are custom strings that when entered (or rather, when their characters are entered in sequence) trigger a function to be executed. Keywords are also shown in the example below.\n\n**KeyboardListener** object needs to be instantiated with the custom combinations and custom keywords dictionaries before running. Please refer to the below example to see how to set those up. If no dictionaries are passed, the program will assume no combinations or keywords are set up.\n\nA demo video can be found here: https://www.reddit.com/r/Python/comments/fbavjd/change_text_in_place_with_custom_hotkeys_python\n\n## Example:\n\n```python\nfrom keyboard_listener import KeyboardListener, Combo, KeyWord\n\ndef function_1(string):\n  print(f'This function prints {string}')\n  \ndef function_2(string):\n  print(f'This function prints {string}')\n \n\ncombinations = {\n\n      'function 1': Combo(['alt'], 'f', function_1, 'hello world'), \n        #Function 1 is executed when the user presses Alt+F\n      'function 2': Combo(['ctrl','alt'], 'g', function_2, 'goodbye world'), \n        #Function 2 is executed when the user presses Alt+G\n      'function 3': Combo(['shift','alt'], 'H', function_2, 'hello again world'), \n        #Be mindful when setting up Combos that include 'shift'. If the Combo includes the shift key, the character must be uppercase.\n}\n\nkeywords = {\n\n    'keyword_1': KeyWord('keyword1', function_1, 'hello world'),\n      #Function 1 is executed when the user types 'keyword1'\n    'keyword_2': KeyWord('keyword2', function_2, 'goodbye world') \n      #Function 2 is executed when the user types 'keyword2'\n}\n\nkeyboard_listener = KeyboardListener(combinations=combinations, keywords=keywords)\nkeyboard_listener.run()\n```\n\nTo see it in action, please take a look at the video titled **keyboard_listener_full_demo.mp4**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdibsonthis%2Fkeyboard_listener","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdibsonthis%2Fkeyboard_listener","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdibsonthis%2Fkeyboard_listener/lists"}