Use number keys for faster switch between the first 10 servers from main menu
This commit is contained in:
@ -595,6 +595,15 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
|||||||
item.title = profile.title()
|
item.title = profile.title()
|
||||||
item.state = (mgr.activeProfileId == profile.uuid) ? .on : .off
|
item.state = (mgr.activeProfileId == profile.uuid) ? .on : .off
|
||||||
item.isEnabled = profile.isValid()
|
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)
|
item.action = #selector(AppDelegate.selectServer)
|
||||||
|
|
||||||
menu.insertItem(item, at: beginIndex)
|
menu.insertItem(item, at: beginIndex)
|
||||||
|
Reference in New Issue
Block a user