diff --git a/ShadowsocksX-NG/AppDelegate.swift b/ShadowsocksX-NG/AppDelegate.swift index bc3df8f..470d9ff 100755 --- a/ShadowsocksX-NG/AppDelegate.swift +++ b/ShadowsocksX-NG/AppDelegate.swift @@ -595,6 +595,15 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele item.title = profile.title() item.state = (mgr.activeProfileId == profile.uuid) ? .on : .off item.isEnabled = profile.isValid() + // Use number keys for faster switch between the first 10 servers from main menu + if i < 10 { + var key = i + 1 + if key == 10 { + key = 0 + } + item.keyEquivalent = String(key) + item.keyEquivalentModifierMask = .init() + } item.action = #selector(AppDelegate.selectServer) menu.insertItem(item, at: beginIndex) diff --git a/ShadowsocksX-NG/Base.lproj/MainMenu.xib b/ShadowsocksX-NG/Base.lproj/MainMenu.xib index 178668c..daca7d0 100755 --- a/ShadowsocksX-NG/Base.lproj/MainMenu.xib +++ b/ShadowsocksX-NG/Base.lproj/MainMenu.xib @@ -34,26 +34,25 @@ - - + - + - + - + @@ -70,8 +69,7 @@ - - + @@ -105,8 +103,7 @@ - - +