Show Real-Time CPS Score in Menubar#6
Open
O-mkar wants to merge 2 commits intoWorldOfBasti:masterfrom
Open
Conversation
…tive - AutoClicker: track click timestamps in a 1-second sliding window (recentClickTimes: [TimeInterval]) on the main thread; post .cpsUpdated notification with measured CPS = count of clicks in last 1 second after each timer tick; post cps: 0.0 and clear window when clicker stops - AutoClicker: dispatch stopClicker() to main thread when click limit is reached from background thread, ensuring safe access to recentClickTimes - AutoClicker: fix pre-existing bug where right mouse-up was sending leftMouseUp in both branches of the clicker timer ternary - AppDelegate: observe .cpsUpdated and set statusItem.button?.title to " N" (integer CPS) when active and "" when stopped; space provides visual separation from the icon Made-with: Cursor
…tive - AutoClicker: track clickStartTime (systemUptime) on startClicker and compute CPS = totalClicks / elapsedSeconds each timer tick — same cumulative-average formula used by cpstest.org (score / elapsed) - AutoClicker: reset clickStartTime and clickCount on stop, post cps: 0.0 via .cpsUpdated notification to clear the menubar title - AppDelegate: observe .cpsUpdated and set statusItem.button?.title to " X.XX" (2 decimal places) when active, "" when stopped Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Overview
Displays the live Clicks Per Second score next to the menubar icon while the auto-clicker is running. The score clears automatically when the clicker stops.
📐 Formula
Same cumulative-average approach used by cpstest.org. The value starts high on the first tick and converges smoothly — e.g.
1.03 → 5.48 → 9.97 → 10.02.🔧 Changes
2 files changed · 19 insertions · 3 deletions
AutoClicker.swiftclickStartTime: TimeInterval?— recordsProcessInfo.systemUptimewhen the clicker starts.cpsUpdatednotification with current CPS each tick; postscps: 0.0on stopNotification.Name.cpsUpdatedextension.leftMouseUpin both branches of the clicker timer ternarystopClicker()now dispatched to main thread when triggered from the click-limit background blockAppDelegate.swift.cpsUpdatedinapplicationDidFinishLaunchingstatusItem.button?.titleto" X.XX"when active,""when stopped