Use number keys for faster switch between the first 10 servers from main menu

This commit is contained in:
Rainux Luo
2019-10-25 20:55:04 +08:00
parent aa3d9b566f
commit 21bd9a7617

View File

@ -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)