Skip to content

Commit

Permalink
fixed focus issue
Browse files Browse the repository at this point in the history
  • Loading branch information
twocanoes committed Apr 18, 2023
1 parent 534be3e commit e3c87a5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 25 deletions.
41 changes: 22 additions & 19 deletions XCreds Login Overlay/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,26 +69,29 @@ class AppDelegate: NSObject, NSApplicationDelegate {
*/
func applicationDidFinishLaunching(_ aNotification: Notification) {
if AuthorizationDBManager.shared.rightExists(right: "loginwindow:login") == true {

var statusWindowRect=window.frame
let screenRect = NSScreen.screens[0].visibleFrame
statusWindowRect.size.width=screenRect.size.width
statusWindowRect.origin=screenRect.origin;
window.setFrame(statusWindowRect, display: true, animate: false)
window.canBecomeVisibleWithoutLogin=true
window.hidesOnDeactivate=false
window.isOpaque=false
window.level = .modalPanel
// Timer.scheduledTimer(withTimeInterval: 3, repeats: true) { timer in
// NSApp.activate(ignoringOtherApps: true)
// self.window.orderFrontRegardless()
// }

NSApp.activate(ignoringOtherApps: true)
window.orderFrontRegardless()
if let ud = UserDefaults(suiteName: "com.twocanoes.xcreds"), let customTextString = ud.value(forKey: "cloudLoginText") {
cloudLoginTextField.stringValue = customTextString as! String
cloudLoginTextField.sizeToFit()

var statusWindowRect=window.frame
let screenRect = NSScreen.screens[0].visibleFrame
statusWindowRect.size.width=screenRect.size.width
statusWindowRect.origin=screenRect.origin;
window.setFrame(statusWindowRect, display: true, animate: false)
window.canBecomeVisibleWithoutLogin=true
window.hidesOnDeactivate=false
window.isOpaque=false
window.level = .modalPanel
// Timer.scheduledTimer(withTimeInterval: 3, repeats: true) { timer in
// NSApp.activate(ignoringOtherApps: true)
// self.window.orderFrontRegardless()
// }
NSApp.activate(ignoringOtherApps: true)
window.orderFrontRegardless()
if let ud = UserDefaults(suiteName: "com.twocanoes.xcreds"), let customTextString = ud.value(forKey: "cloudLoginText") {
cloudLoginTextField.stringValue = customTextString as! String
cloudLoginTextField.sizeToFit()

}
}
}

Expand Down
12 changes: 6 additions & 6 deletions xCreds.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3605;
CURRENT_PROJECT_VERSION = 3607;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1042,7 +1042,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3605;
CURRENT_PROJECT_VERSION = 3607;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1107,7 +1107,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3605;
CURRENT_PROJECT_VERSION = 3607;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1143,7 +1143,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3605;
CURRENT_PROJECT_VERSION = 3607;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1292,7 +1292,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3605;
CURRENT_PROJECT_VERSION = 3607;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1327,7 +1327,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3605;
CURRENT_PROJECT_VERSION = 3607;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down
Binary file not shown.

0 comments on commit e3c87a5

Please sign in to comment.