diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 992a5a52c..3ac46f899 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -89,7 +89,7 @@ jobs: with: files: ClashX.dmg # draft: true - prerelease: true + # prerelease: true - name: update gitpage if: startsWith(github.ref, 'refs/tags/') diff --git a/ClashX/AppDelegate.swift b/ClashX/AppDelegate.swift index ee8d544b3..c4999edce 100644 --- a/ClashX/AppDelegate.swift +++ b/ClashX/AppDelegate.swift @@ -227,6 +227,17 @@ class AppDelegate: NSObject, NSApplicationDelegate { self, selector: #selector(resetProxySettingOnWakeupFromSleep), name: NSWorkspace.didWakeNotification, object: nil ) + + ConfigManager.shared + .isProxySetByOtherVariable + .asObservable() + .filter { _ in ConfigManager.shared.proxyPortAutoSet } + .distinctUntilChanged() + .filter { $0 }.bind { _ in + let rawProxy = NetworkChangeNotifier.getRawProxySetting() + Logger.log("proxy changed to no clashX setting: \(rawProxy)", level: .warning) + NSUserNotificationCenter.default.postProxyChangeByOtherAppNotice() + }.disposed(by: disposeBag) } func updateProxyList() { diff --git a/ClashX/Extensions/NSUserNotificationCenter+Extension.swift b/ClashX/Extensions/NSUserNotificationCenter+Extension.swift index a6e1f6007..ba25edffc 100644 --- a/ClashX/Extensions/NSUserNotificationCenter+Extension.swift +++ b/ClashX/Extensions/NSUserNotificationCenter+Extension.swift @@ -52,6 +52,11 @@ extension NSUserNotificationCenter { post(title: NSLocalizedString("Benchmark", comment: ""), info: NSLocalizedString("Benchmark Finished!", comment: "")) } + + func postProxyChangeByOtherAppNotice() { + post(title: NSLocalizedString("System Proxy Changed", comment: ""), + info: NSLocalizedString("Proxy settings are changed by another process. ClashX is no longer the default system proxy.", comment: "")) + } } class UserNotificationCenterDelegate: NSObject, NSUserNotificationCenterDelegate { diff --git a/ClashX/Support Files/en.lproj/Localizable.strings b/ClashX/Support Files/en.lproj/Localizable.strings index 9918f4c95..ff85d7424 100644 --- a/ClashX/Support Files/en.lproj/Localizable.strings +++ b/ClashX/Support Files/en.lproj/Localizable.strings @@ -74,6 +74,9 @@ /* No comment provided by engineer. */ "Proxy Mode" = "Proxy Mode"; +/* No comment provided by engineer. */ +"Proxy settings are changed by another process. ClashX is no longer the default system proxy." = "Proxy settings are changed by another process. ClashX is no longer the default system proxy."; + /* No comment provided by engineer. */ "Quit" = "Quit"; @@ -110,6 +113,9 @@ /* No comment provided by engineer. */ "Success!" = "Success!"; +/* No comment provided by engineer. */ +"System Proxy Changed" = "System Proxy Changed"; + /* No comment provided by engineer. */ "Tap to reload config" = "Tap to reload config"; diff --git a/ClashX/Support Files/zh-Hans.lproj/Localizable.strings b/ClashX/Support Files/zh-Hans.lproj/Localizable.strings index 0962b3b66..c35cf123f 100644 --- a/ClashX/Support Files/zh-Hans.lproj/Localizable.strings +++ b/ClashX/Support Files/zh-Hans.lproj/Localizable.strings @@ -74,6 +74,9 @@ /* No comment provided by engineer. */ "Proxy Mode" = "出站模式"; +/* No comment provided by engineer. */ +"Proxy settings are changed by another process. ClashX is no longer the default system proxy." = "系统代理设置已被另一个进程修改,ClashX不再是系统默认代理"; + /* No comment provided by engineer. */ "Quit" = "退出"; @@ -110,6 +113,9 @@ /* No comment provided by engineer. */ "Success!" = "成功!"; +/* No comment provided by engineer. */ +"System Proxy Changed" = "系统代理设置已修改"; + /* No comment provided by engineer. */ "Tap to reload config" = "点击重载配置文件";