diff --git a/CHANGELOG.md b/CHANGELOG.md index 938dbc7..212ff2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# v1.0.8 (pre-release) +- Improved input box background color handling, fixed display issues in Linux Wayland. +- Better sleep state handling for Linux. + # v1.0.7 - Improve chaptered audio generation by outputting directly as `m4b` instead of converting from `wav`. - Ignore chapter markers and single newlines when calculating text length, improving the accuracy of the text length calculation. diff --git a/abogen/utils.py b/abogen/utils.py index 6536102..07a8930 100644 --- a/abogen/utils.py +++ b/abogen/utils.py @@ -227,29 +227,26 @@ def prevent_sleep_start(): system = platform.system() if system == "Windows": import ctypes - ctypes.windll.kernel32.SetThreadExecutionState( 0x80000000 | 0x00000001 | 0x00000040 - ) # ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_AWAYMODE_REQUIRED + ) elif system == "Darwin": - _sleep_procs["Darwin"] = create_process("caffeinate") + _sleep_procs["Darwin"] = create_process(["caffeinate"]) elif system == "Linux": - try: - _sleep_procs["Linux"] = create_process( - "systemd-inhibit --what=sleep --why=TextToAudiobook conversion sleep 999999" - ) - except Exception: - try: - create_process("xdg-screensaver reset") - except Exception: - pass + # use a sleep that never exits so inhibition stays active + _sleep_procs["Linux"] = create_process([ + "systemd-inhibit", + "--what=handle-lid-switch:sleep", + "--mode=block", + "sleep", + "infinity", + ]) def prevent_sleep_end(): system = platform.system() if system == "Windows": import ctypes - ctypes.windll.kernel32.SetThreadExecutionState(0x80000000) # ES_CONTINUOUS elif system in ("Darwin", "Linux") and _sleep_procs[system]: try: