Skip to content

FEAT(client): Add option to inhibit system sleep while connected#7087

Open
nixietab wants to merge 2 commits intomumble-voip:masterfrom
nixietab:master
Open

FEAT(client): Add option to inhibit system sleep while connected#7087
nixietab wants to merge 2 commits intomumble-voip:masterfrom
nixietab:master

Conversation

@nixietab
Copy link
Copy Markdown

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:

  • Windows: Uses SetThreadExecutionState to prevent system and display sleep.
  • macOS: Uses IOPMAssertionCreateWithDescription to create power claims.
  • Linux: Uses D-Bus to interface with org.freedesktop.login1 (Logind) to
    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

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 26, 2026

Walkthrough

This 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

  • Sleep Inhibitor #6899: Directly implements the sleep inhibitor feature with the SleepInhibitor class, UI settings checkbox, platform-specific implementations, and MainWindow integration for toggling inhibition on server connect/disconnect.
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main feature being added: an option to inhibit system sleep while connected to a server.
Description check ✅ Passed The description comprehensively covers the feature implementation, platform-specific details, testing, and includes the required commit guidelines checkbox marked as completed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (3)
src/mumble/LookConfig.ui (1)

144-153: Consider adding qcbInhibitSleep to the tabstops list.

The new checkbox is not included in the <tabstops> section (lines 1282-1329). For consistent keyboard navigation, add it after qcbLockLayout in 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> for uint32_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.h is 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

📥 Commits

Reviewing files that changed from the base of the PR and between 2459b8e and 1c82a42.

📒 Files selected for processing (10)
  • src/mumble/CMakeLists.txt
  • src/mumble/LookConfig.cpp
  • src/mumble/LookConfig.ui
  • src/mumble/MainWindow.cpp
  • src/mumble/MainWindow.h
  • src/mumble/Settings.h
  • src/mumble/SettingsKeys.h
  • src/mumble/SettingsMacros.h
  • src/mumble/SleepInhibitor.cpp
  • src/mumble/SleepInhibitor.h

@nixietab nixietab mentioned this pull request Mar 10, 2026
@Hartmnt Hartmnt added client feature-request This issue or PR deals with a new feature labels Mar 10, 2026
@Hartmnt Hartmnt added this to the 1.7.0 milestone Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client feature-request This issue or PR deals with a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants