Swiftpack.co - curzel-it/WindowsDetector as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by curzel-it.
curzel-it/WindowsDetector v1.0.4
Provides a list of all windows running on the user macOS system
⭐️ 1
🕓 3 weeks ago
iOS macOS
.package(url: "https://github.com/curzel-it/WindowsDetector.git", from: "v1.0.4")


Swift Package to list all windows running on the user macOS system.

This solution is App Store-compliant and does not require user actions, nor special permissions.

This is being used in production by my Desktop Pets app (which is also here on GitHub).

The package will return a mocked, empty, list of windows on iOS, support has been added to ease development of multiplatform apps.


You can use a WindowsDetector instance like any other ObservableObject, like in the state of your view:

import SwiftUI
import WindowsDetector

struct WindowsListView: View {
    @StateObject var windowsDetector = WindowsDetector().started(pollInterval: 1)
    var body: some View {
        List(windowsDetector.userWindows) { window in
                .background(window.isFrontmost ? Color.red : Color.clear)

Or, you can use the underlying service as you need:

import WindowsDetector

let service = WindowsDetectionService()
let windows = service.listCurrentWindows()


Stars: 1
Last commit: 3 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

30 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics