Skip to content

core/qmlscreen: expose the screen refresh rate - #961

Draft
khughitt wants to merge 1 commit into
quickshell-mirror:masterfrom
khughitt:feat/shellscreen-refresh-rate
Draft

khughitt wants to merge 1 commit into
quickshell-mirror:masterfrom
khughitt:feat/shellscreen-refresh-rate

Conversation

@khughitt

Copy link
Copy Markdown

ShellScreen exposes a screen's geometry and density characteristics but not
its refresh rate, so QML has no way to find out how often a screen refreshes.
Shells that pace animations, budget work per frame, or reason about frame
timing currently have to get it from the compositor over an out-of-band
channel, if they can get it at all.

QScreen already tracks the value and emits a change signal for it, and it is
populated on Wayland. This forwards both, in the same shape as the surrounding
properties: a nullptr guard returning 0.0 for the dangling-screen case, and
a signal-to-signal connection alongside the existing ones in the constructor.

The doc comment notes that this is the rate reported for the current mode
rather than a measurement of when frames are actually presented, since the two
diverge under variable refresh and the distinction matters for the timing use
case that motivates the property.

Testing

  • just fmt produces no changes; clang-format -Werror --dry-run passes on both files.
  • just lint-changed equivalent (clang-tidy with tidyfox) reports no warnings in
    either file. Verified the lint was actually running on them by temporarily
    dropping a this-> in the new getter and confirming tidyfox-explicit-thisptr
    caught it.
  • just test passes 9/9.
  • Checked at runtime under niri: ShellScreen.refreshRate reads 59.999 for a
    DP-1 output whose mode niri reports as 59.999 Hz. It read undefined before.

QScreen::refreshRate and refreshRateChanged are unguarded and long predate
Qt 6, so this needs no version gating against the 6.6.0 minimum.

Contributions

  • Claude Opus 5 + GPT 5.6-sol helped with the initial investigation, authoring the patch,
    testing / validation, and write the commit message + PR draft description
  • The lazy human (me) reviewed the code line-by-line, checked to make sure we are abiding by the
    contributers guidelines and added this section to provide some clarity on who did what, and
    handled the actual PR submission.

ShellScreen surfaces the geometry and density characteristics of a screen
but not its refresh rate, so QML has no way to learn how often a screen
refreshes. Shells that pace animations or reason about frame timing
currently have to obtain it from the compositor over an out of band
channel, if at all.

QScreen already provides the value and a change signal, and it is
populated on Wayland. Forward both, following the existing properties.

The documentation notes that this reports the current mode's rate rather
than measured presentation, since the two diverge under variable refresh.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant