Skip to content

Commit

Permalink
misc: swift lint
Browse files Browse the repository at this point in the history
  • Loading branch information
yichengchen committed Feb 20, 2023
1 parent a7898d0 commit b9265b6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
13 changes: 6 additions & 7 deletions ClashX/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
SystemProxyManager.shared.disableProxy()
}
}



func buttonRectOnScreen() -> CGRect {
guard let button = statusItem.button else { return .zero }
guard let window = button.window else { return .zero }
Expand All @@ -199,17 +198,17 @@ class AppDelegate: NSObject, NSApplicationDelegate {

func leftScreenX() -> CGFloat {
let screens = NSScreen.screens

var left: CGFloat = 0

for screen in screens {
if screen.frame.origin.x < left {
left = screen.frame.origin.x
}
}
return left
}

func checkMenuIconVisable() {
guard let button = statusItem.button else {assertionFailure(); return }
guard let window = button.window else {assertionFailure(); return }
Expand All @@ -222,14 +221,14 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
}
let isMenuIconHidden = onScreenRect.midX < leftScreenX

var isCoverdByNotch = false
if #available(macOS 12, *), NSScreen.screens.count == 1, let screen = NSScreen.screens.first, let leftArea = screen.auxiliaryTopLeftArea, let rightArea = screen.auxiliaryTopRightArea {
if onScreenRect.minX > leftArea.maxX, onScreenRect.maxX<rightArea.minX {
isCoverdByNotch = true
}
}

Logger.log("checkMenuIconVisable: \(onScreenRect) \(leftScreenX), hidden: \(isMenuIconHidden), coverd by notch:\(isCoverdByNotch)")

if (isMenuIconHidden || isCoverdByNotch), !Settings.disableMenubarNotice {
Expand Down
4 changes: 2 additions & 2 deletions ClashX/General/Managers/Settings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ enum Settings {
"sequoia.apple.com",
"seed-sequoia.siri.apple.com"])
static var proxyIgnoreList: [String]
@UserDefault("disableMenubarNotice",defaultValue: false)

@UserDefault("disableMenubarNotice", defaultValue: false)
static var disableMenubarNotice: Bool
}
3 changes: 2 additions & 1 deletion ClashX/goClash/build_clash_universal.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ def get_version():
return line.split("-")[-1].strip()[:6]
return "unknown"

go_bin = "go"

def build_clash(version,build_time,arch):
clang = f"{os.getcwd()}/clangWrap.sh"
command = f"""
go build -trimpath -ldflags '-X "github.com/Dreamacro/clash/constant.Version={version}" \
{go_bin} build -trimpath -ldflags '-X "github.com/Dreamacro/clash/constant.Version={version}" \
-X "github.com/Dreamacro/clash/constant.BuildTime={build_time}"' \
-buildmode=c-archive -o goClash_{arch}.a """
envs = os.environ.copy()
Expand Down

0 comments on commit b9265b6

Please sign in to comment.