Jamie Lawrence

Pepper

A small volleyball that lives on your Mac desktop and tempts you to take breaks. Every 25 minutes it rolls in along the bottom of the screen; click to serve, press space to bump, set and spike, and after three points it rolls away again.

Source on GitHub ↗

Built with: Swift · AppKit · Core Animation · Core Graphics · Swift Package Manager · Swift Testing

My daughter saw a small productivity app in an Instagram reel and thought it was cute. “Can’t you put your programming skills to good use and build something like this?”. Yes. Yes, I can.

I thought something with a volleyball theme would suit her with Pomodoro slant to make it sort of productive.

Pepper is a small animated volleyball with a face. Every 25 minutes it rolls in along the bottom of the screen and waits. Click it to serve, then press space to bump, set and spike. You can’t miss. After three points it celebrates, rolls away, and leaves you alone for another 25 minutes. It bounces off the screen edges and lands on the top edges of your open windows, and a menu bar item counts down the minutes until it returns. [A pepper is a volleyball warm-up drill, which is the only reason for the name]

I pasted one prompt and went swimming. Thirty-five minutes later the app was built, tested and running. When I got back I tried it, liked it, and the only things I asked for after that were about shipping it: a build for Intel and Apple Silicon, a public repo with screenshots and a demo, and a licence. I didn’t ask for a single change to how it plays.

How it was built

Swift, with no third-party dependencies and no Xcode project, so it builds with the command line tools alone. The game is its own library with no AppKit in it: physics at a fixed 1/240 second step, and the drill as a small state machine. Speeds are fractions of the screen height so it feels the same on any display. The ball is drawn in code with Core Animation layers, no image assets, and the sounds are synthesised in code too.

“You can’t miss” is the one design rule. A press of space is remembered for a moment rather than judged on the instant, and the ball waits until it is within reach before the touch happens. If you wander off mid-rally the ball settles and goes back to waiting.

public func press() {
    if phase == .rally { pressedAt = clock }
}

case .rally:
    if let pressed = pressedAt, clock - pressed > 0.6 { pressedAt = nil }
    if pressedAt != nil, canTouch {
        touch()
    } else if support != nil, abs(velocity.dx) < 5 {
        restTime += h
        if restTime > 8 { setPhase(.waiting) }
    } else {
        restTime = 0
    }

The overlay is a click-through panel that never becomes the active app, so your window stays in front. It only accepts clicks while the pointer is over the ball, and space reaches it through an invisible non-activating panel. The edges of your windows come from the window server’s list of window frames, so no screen recording permission is needed.

It isn’t signed with an Apple developer account or notarised, so macOS blocks the first launch until you allow it. And since it was built while my screen was locked, the first handover was verified by tests, offscreen renders and a run where the ball played by itself. The demo and the screenshots are that same self-playing mode on a made-up desktop with blank boxes for windows, so nothing private could appear in them.

About 2,900 lines of Swift including the tests. Open source under MIT.