Skip to content

Commit

Permalink
chore: Update shortcut_listener.py to handle special keys on differen…
Browse files Browse the repository at this point in the history
…t platforms
  • Loading branch information
AndersonBY committed Jul 9, 2024
1 parent f4c2abb commit ea82cd0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions backend/utilities/shortcuts/shortcut_listener.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# @Author: Bi Ying
# @Date: 2024-06-11 14:39:59
import string
import platform

from pynput import keyboard

Expand Down Expand Up @@ -37,13 +38,16 @@
keyboard.Key.f12.value.vk: keyboard.Key.f12,
keyboard.Key.home.value.vk: keyboard.Key.home,
keyboard.Key.end.value.vk: keyboard.Key.end,
keyboard.Key.insert.value.vk: keyboard.Key.insert,
keyboard.Key.pause.value.vk: keyboard.Key.pause,
keyboard.Key.print_screen.value.vk: keyboard.Key.print_screen,
keyboard.Key.scroll_lock.value.vk: keyboard.Key.scroll_lock,
keyboard.Key.num_lock.value.vk: keyboard.Key.num_lock,
}

if platform.system() == "Windows":
special_key_values[keyboard.Key.insert.value.vk] = keyboard.Key.insert
special_key_values[keyboard.Key.pause.value.vk] = keyboard.Key.pause
special_key_values[keyboard.Key.print_screen.value.vk] = keyboard.Key.print_screen
special_key_values[keyboard.Key.scroll_lock.value.vk] = keyboard.Key.scroll_lock
special_key_values[keyboard.Key.num_lock.value.vk] = keyboard.Key.num_lock


normal_keys_names = set(string.ascii_lowercase + string.digits + string.punctuation + string.whitespace)


Expand Down

0 comments on commit ea82cd0

Please sign in to comment.