← Back to Pull requests

Add up held volume-key steps instead of racing on the volume #19818

Open
unknown opened this pull request with 229 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 22, 2026 20:40 UTC
Author

Fixes #19085

What changes

Holding the volume keys lost steps when they went through omarchy-audio-output-volume: key repeat starts a run every 25 ms, one run takes much longer, and each run reads the volume and writes back an absolute value, so overlapping runs overwrote each other and the OSD jumped around.

Each run now adds its step to a pending total, and only the run holding an apply lock reads and writes the volume. It keeps applying until the total is empty, and gives the lock up only then, both under the pending lock, so a step that arrives while it works is never left behind. Repeats that arrive mid-run are folded into the next write instead of being queued, so the volume stops moving as soon as the key is released. The OSD is shown after every write, so it keeps counting while the key is held. The mute path is unchanged apart from sharing the OSD helper.

On quattro the plain raise/lower keys are handled in the shell for alsa_output.* sinks, so this matters for the ALT precise-step bindings and for any other default sink (Bluetooth, DSP/EasyEffects), which still run the script.

Verification

  • Added a case to test/shell.d/audio-pactl-test.sh with a slow pactl stub that keeps the volume in a file: ten overlapping -1 runs from 50 must land on 40. It fails on quattro and passes with the change; the whole file passes.

  • In a QEMU VM on Omarchy 4.5.0-3 with real PipeWire/pactl, 20 runs of omarchy-audio-output-volume -1 started 25 ms / 10 ms apart from 70%:

  • - quattro: ended at 54% and 60% (4–10 steps lost).
    - This branch: 50% both times, OSD values strictly decreasing (69 68 66 63 61 58 56 54 52 50).
  • Clamping at 0: five -1 runs from 3% end at 0%.
  • Screenshots

    No visible change: the volume OSD looks the same; it now moves monotonically while a key is held.

    Diff: 229 lines (+171 / -58) across 2 files Reviewer: greptile-apps[bot] Review duration: 10m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.37) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 229 lines diff across 2 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.325
    Real PR Conversation Timeline
    1 comments
    "Review active on #19818"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 37.0% (MEDIUM) · Higher = larger blast radius
    37.0%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.7% · Safe to merge
    19.7%
    Repository