Skip to content

CLI: Try to inhibit screensaver in fullscreen (Windows only) - #4507

Merged
gzotti merged 7 commits into
masterfrom
CLI/no-screensaver
Nov 13, 2025
Merged

gzotti merged 7 commits into
masterfrom
CLI/no-screensaver

Conversation

@gzotti

@gzotti gzotti commented Sep 10, 2025 •

Copy link
Copy Markdown
Member

Description

When running Stellarium in fullscreen mode for a presentation, it may annoy when the screensaver kicks in after a minute.
A new command-line option should inhibit this.

Idea taken from https://forum.qt.io/topic/38504/solved-qdialog-in-fullscreen-disable-os-screensaver/20

Enabled for Windows for now. I don't know how to do this in Mac/Linux. Some old Mac solution is on this website.

Fixes # (issue)

Screenshots (if appropriate):

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • This change requires a documentation update
  • Housekeeping

How Has This Been Tested?

Test Configuration:

  • Operating system: Windows 11
  • Graphics Card: irrelevant

Checklist:

  • My code follows the code style of this project.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (header file)
  • I have updated the respective chapter in the Stellarium User Guide
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@gzotti gzotti added this to the 25.3 milestone Sep 10, 2025
@gzotti gzotti self-assigned this Sep 10, 2025
@gzotti gzotti added the feature Entirely new feature label Sep 10, 2025
@gzotti gzotti added this to GUI Sep 10, 2025
@github-project-automation github-project-automation Bot moved this to Backlog in GUI Sep 10, 2025
@github-actions
github-actions Bot requested review from 10110111 and alex-w September 10, 2025 12:45
@github-actions

Copy link
Copy Markdown

Hello @gzotti!

Thank you for proposing of the feature.

@github-actions

github-actions Bot commented Sep 10, 2025 •

Copy link
Copy Markdown

Great PR! Please pay attention to the following items before merging:

Files matching src/**/*.cpp:

  • Are possibly unused includes removed?

Files matching guide/**:

  • Did you remember to update screenshots to match new updates?
  • Did you remember to grammar check in changed part of documentation?

This is an automatically generated QA checklist based on modified files.

@10110111

Copy link
Copy Markdown
Contributor

It would be better to put this code into a separate function, taking as a parameter whether the window is fullscreen, than to litter the two branches with platform-specific code.

On the Linux side you'll have to check what windowing system is in use. In Wayland there's the zwp_idle_inhibit_manager_v1, which seems to be controllable via Qt's QWaylandIdleInhibitManagerV1. In X11 there appears to be an Idle Inhibition Service Draft spec implemented by xssproxy that we could try using (not by installing the daemon, but simply by supporting the protocol it implements).

@gzotti

gzotti commented Sep 10, 2025 •

Copy link
Copy Markdown
Member Author

Seems it does not even work on the laptop where I need it. Maybe there are still other mechanisms.

maybe this works: https://gitlab.com/qt-goodies/qscreensaver

@alex-w

alex-w commented Sep 11, 2025

Copy link
Copy Markdown
Member

VLC has code for suppressing screensaver on all platforms.

@gzotti gzotti modified the milestones: 25.3, 25.4 Sep 12, 2025
@gzotti

gzotti commented Sep 13, 2025

Copy link
Copy Markdown
Member Author

https://github.com/Simbiat/SnoozeGuard works for now. An integrated solution may come later...

@gzotti gzotti removed this from the 25.4 milestone Sep 13, 2025
@gzotti
gzotti force-pushed the CLI/no-screensaver branch from 3420a4b to 6add7c4 Compare October 20, 2025 11:22
@gzotti

gzotti commented Oct 21, 2025

Copy link
Copy Markdown
Member Author

but simply by supporting the protocol it implements).

Wouldn't that finally require implementing D-Bus support? (It was a long-standing wish, but without the "killer app" to show off its capabilities. The RC plugin API is used instead...)

@10110111

Copy link
Copy Markdown
Contributor

Wouldn't that finally require implementing D-Bus support?

Yes it would. But given how tiny the use case is, the dependency on libdbus should be optional.

@gzotti
gzotti marked this pull request as ready for review October 22, 2025 23:01
@gzotti gzotti added this to the 25.4 milestone Oct 23, 2025
@gzotti gzotti moved this from Backlog to In review in GUI Oct 23, 2025
@gzotti

gzotti commented Nov 10, 2025

Copy link
Copy Markdown
Member Author

This works as originally intended, on Windows for now, and is ready to merge. It's a limited use case, if users on the other OSes are interested, somebody else working on those platforms might be able to do that later. (I am still waiting for somebody on Mac fulfilling the Syphon request that was answered on Windows with Spout...)

@10110111

Copy link
Copy Markdown
Contributor

I think the screensaver inhibition code should be moved to its own class, like ScreenSaverInhibitor, together with the timer and the methods.

@gzotti

gzotti commented Nov 10, 2025

Copy link
Copy Markdown
Member Author

This is just a timer and two short methods, one of them for the timer. Isn't that overengineering?

@10110111

Copy link
Copy Markdown
Contributor

Isn't that overengineering?

Well, this is a good question. Given that this is highly platform-specific and has a potential to get more platform-specific code for other platforms, I don't like having all this bunch of #ifdefs polluting StelMainView. This is why I wanted to isolate this a bit.

But I'm not insisting. If you feel it's not worth it, OK.

@gzotti

gzotti commented Nov 10, 2025

Copy link
Copy Markdown
Member Author

If it becomes clearer what has to be done on the other platforms (and maybe the methods need to expand?), it may be good to then move all these methods to another class later. Whoever does it: I can imagine it's something along similar OS specific calls on Mac, and two different paths for X11 and Wayland. I have no hardware for the first, and no time now (and need) for the latter. Are there then even more variations? For now I'd just squash and merge this little change.

@10110111

Copy link
Copy Markdown
Contributor

For now I'd just squash and merge this little change.

OK. But please change your new connect() calls to use function pointers instead of strings. This relic of the past is too problematic to maintain, since it breaks silently when functions get changed or removed.

Comment thread src/StelMainView.cpp Resolved
@gzotti

gzotti commented Nov 10, 2025

Copy link
Copy Markdown
Member Author

@alex-w any comments?

@gzotti
gzotti merged commit 4eced96 into master Nov 13, 2025
27 of 28 checks passed
@gzotti
gzotti deleted the CLI/no-screensaver branch November 13, 2025 10:48
@github-project-automation github-project-automation Bot moved this from In review to Done in GUI Nov 13, 2025
@alex-w alex-w added the state: published The fix has been published for testing in weekly binary package label Nov 19, 2025
@github-actions

Copy link
Copy Markdown

Hello @gzotti!

Please check the fresh version (development snapshot) of Stellarium:
https://github.com/Stellarium/stellarium-data/releases/tag/weekly-snapshot

@alex-w alex-w removed the state: published The fix has been published for testing in weekly binary package label Dec 29, 2025
@github-actions

Copy link
Copy Markdown

Hello @gzotti!

Please check the latest stable version of Stellarium:
https://github.com/Stellarium/stellarium/releases/latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Entirely new feature

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants