Skip to content

Commit

Permalink
fix: ignore loginwindow events
Browse files Browse the repository at this point in the history
workaround for #85
  • Loading branch information
iloveitaly committed Mar 7, 2023
1 parent 82d9673 commit ea5cf4d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions aw_watcher_window/macos.swift
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,17 @@ class MainThing {
var windowTitle: AnyObject?
AXUIElementCopyAttributeValue(axElement, kAXTitleAttribute as CFString, &windowTitle)

var data = NetworkMessage(app: frontmost.localizedName!, title: windowTitle as? String ?? "")
let applicationTitle = frontmost.localizedName!

if CHROME_BROWSERS.contains(frontmost.localizedName!) {
// https://github.com/ActivityWatch/aw-watcher-window/issues/85
guard applicationTitle != "loginwindow" else {
log("loginwindow detected, ignoring")
return
}

var data = NetworkMessage(app: applicationTitle, title: windowTitle as? String ?? "")

if CHROME_BROWSERS.contains(applicationTitle) {
debug("Chrome browser detected, extracting URL and title")

let chromeObject: ChromeProtocol = SBApplication.init(bundleIdentifier: bundleIdentifier)!
Expand All @@ -323,7 +331,7 @@ class MainThing {
}
}
}
} else if frontmost.localizedName == "Safari" {
} else if applicationTitle == "Safari" {
debug("Safari browser detected, extracting URL and title")

let safariObject: SafariApplication = SBApplication.init(bundleIdentifier: bundleIdentifier)!
Expand Down

0 comments on commit ea5cf4d

Please sign in to comment.