FEAT(client): Add option to inhibit system sleep while connected#7087
FEAT(client): Add option to inhibit system sleep while connected#7087nixietab wants to merge 2 commits intomumble-voip:masterfrom
Conversation
WalkthroughThis pull request implements a system sleep inhibition feature for Mumble. It introduces a new SleepInhibitor class with platform-specific implementations for Windows, macOS, and Linux (DBus) to prevent the system from sleeping while connected to a server. The feature includes a configuration UI checkbox in the settings, persistent storage of the preference through Settings and SettingsKeys, and integration with MainWindow to activate inhibition upon server connection and deactivate it upon disconnection. The implementation adds approximately 151 lines of new code across the build configuration, UI, settings infrastructure, and core feature classes. Possibly related issues
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (3)
src/mumble/LookConfig.ui (1)
144-153: Consider addingqcbInhibitSleepto the tabstops list.The new checkbox is not included in the
<tabstops>section (lines 1282-1329). For consistent keyboard navigation, add it afterqcbLockLayoutin the tabstop order:<tabstop>qcbLockLayout</tabstop> <tabstop>qcbInhibitSleep</tabstop> <tabstop>qcbHideTray</tabstop>🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/mumble/LookConfig.ui` around lines 144 - 153, Add the new QCheckBox widget id qcbInhibitSleep to the UI tab order by inserting a <tabstop> entry for qcbInhibitSleep in the existing <tabstops> block immediately after qcbLockLayout; update the sequence so it reads qcbLockLayout, qcbInhibitSleep, qcbHideTray to preserve keyboard navigation order and ensure qcbInhibitSleep is reachable via Tab.src/mumble/SleepInhibitor.h (1)
9-12: Consider adding<cstdint>foruint32_t.The header uses
uint32_t(lines 29 and 31) without explicitly including<cstdint>. While Qt headers often include this transitively, relying on indirect includes isn't guaranteed across all compilers/platforms.🔧 Proposed fix
`#include` <QtCore/QObject> +#include <cstdint> `#if` defined(USE_DBUS) # include <QtDBus/QDBusUnixFileDescriptor> `#endif`🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/mumble/SleepInhibitor.h` around lines 9 - 12, The header uses uint32_t in class SleepInhibitor but doesn't include <cstdint>; add an explicit `#include` <cstdint> at the top of SleepInhibitor.h (alongside the existing Qt includes) so uint32_t is defined reliably across platforms and compilers before any declarations that use it.src/mumble/SleepInhibitor.cpp (1)
6-7: Remove unused include.
Global.his included but not used anywhere in this file.🧹 Proposed fix
`#include` "SleepInhibitor.h" -#include "Global.h" `#if` defined(Q_OS_WIN)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/mumble/SleepInhibitor.cpp` around lines 6 - 7, Remove the unused include of "Global.h" from SleepInhibitor.cpp: delete the `#include` "Global.h" line at the top of the file (leaving `#include` "SleepInhibitor.h"), then rebuild to ensure no references in SleepInhibitor.cpp rely on symbols from Global.h; if compilation fails, add only the specific header(s) required by functions or members used in SleepInhibitor.cpp.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/mumble/LookConfig.ui`:
- Around line 144-153: Add the new QCheckBox widget id qcbInhibitSleep to the UI
tab order by inserting a <tabstop> entry for qcbInhibitSleep in the existing
<tabstops> block immediately after qcbLockLayout; update the sequence so it
reads qcbLockLayout, qcbInhibitSleep, qcbHideTray to preserve keyboard
navigation order and ensure qcbInhibitSleep is reachable via Tab.
In `@src/mumble/SleepInhibitor.cpp`:
- Around line 6-7: Remove the unused include of "Global.h" from
SleepInhibitor.cpp: delete the `#include` "Global.h" line at the top of the file
(leaving `#include` "SleepInhibitor.h"), then rebuild to ensure no references in
SleepInhibitor.cpp rely on symbols from Global.h; if compilation fails, add only
the specific header(s) required by functions or members used in
SleepInhibitor.cpp.
In `@src/mumble/SleepInhibitor.h`:
- Around line 9-12: The header uses uint32_t in class SleepInhibitor but doesn't
include <cstdint>; add an explicit `#include` <cstdint> at the top of
SleepInhibitor.h (alongside the existing Qt includes) so uint32_t is defined
reliably across platforms and compilers before any declarations that use it.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
src/mumble/CMakeLists.txtsrc/mumble/LookConfig.cppsrc/mumble/LookConfig.uisrc/mumble/MainWindow.cppsrc/mumble/MainWindow.hsrc/mumble/Settings.hsrc/mumble/SettingsKeys.hsrc/mumble/SettingsMacros.hsrc/mumble/SleepInhibitor.cppsrc/mumble/SleepInhibitor.h
As requested in #6899, this commit implements the ability to prevent the
computer from entering sleep mode while active in a call.
This feature is implemented via a new SleepInhibitor class that handles
the necessary platform-specific power management APIs:
block sleep/idle, with org.freedesktop.ScreenSaver as a fallback.
The setting "Inhibit system sleep while connected" has been added to the
"User Interface" settings tab under the "Application" section.
Tested successfully on my openSUSE Tumbleweed installation.
Checks