From ba735c554b313bc730226816558207c6b6c86072 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sun, 22 Dec 2024 14:49:31 -0500 Subject: [PATCH] Try to fix sleep mode so it is actually detected. --- src/cthulhu/cmdnames.py | 3 +++ src/cthulhu/common_keyboardmap.py | 2 +- src/cthulhu/scripts/default.py | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/cthulhu/cmdnames.py b/src/cthulhu/cmdnames.py index 66afd7a..f62959c 100644 --- a/src/cthulhu/cmdnames.py +++ b/src/cthulhu/cmdnames.py @@ -460,6 +460,9 @@ TOGGLE_SPEECH = _("Toggle the silencing of speech") # This string describes that command. TOGGLE_SPEECH_VERBOSITY = _("Toggle speech verbosity level") +# Translators: this string is associated with the keyboard shortcut to toggle sleepmode +TOGGLE_SLEEP_MODE = _("Toggle sleep mode") + # Translators: this string is associated with the keyboard shortcut to quit # Cthulhu. QUIT_CTHULHU = _("Quit the screen reader") diff --git a/src/cthulhu/common_keyboardmap.py b/src/cthulhu/common_keyboardmap.py index 400ae0a..d768a86 100644 --- a/src/cthulhu/common_keyboardmap.py +++ b/src/cthulhu/common_keyboardmap.py @@ -57,7 +57,7 @@ keymap = ( ("BackSpace", defaultModifierMask, CTHULHU_MODIFIER_MASK, "bypassNextCommandHandler"), - ("q", defaultModifierMask, CTHULHU_CTRL_ALT_MODIFIER_MASK | SHIFT_ALT_MODIFIER_MASK, + ("q", defaultModifierMask, CTHULHU_CTRL_ALT_MODIFIER_MASK | CTHULHU_SHIFT_MODIFIER_MASK, "toggleSleepModeHandler"), ("q", defaultModifierMask, CTHULHU_MODIFIER_MASK, diff --git a/src/cthulhu/scripts/default.py b/src/cthulhu/scripts/default.py index 5a19f7a..f0607bf 100644 --- a/src/cthulhu/scripts/default.py +++ b/src/cthulhu/scripts/default.py @@ -204,6 +204,11 @@ class Script(script.Script): Script.processBrailleCutLine, cmdnames.PROCESS_BRAILLE_CUT_LINE) + self.inputEventHandlers["toggleSleepModeHandler"] = \ + input_event.InputEventHandler( + Script.toggleSleepMode, + cmdnames.TOGGLE_SLEEP_MODE) + self.inputEventHandlers["shutdownHandler"] = \ input_event.InputEventHandler( cthulhu.quitCthulhu,