Skip to content

Commit

Permalink
Use number keys for faster switch between the first 10 servers from m…
Browse files Browse the repository at this point in the history
…ain menu
  • Loading branch information
rainux committed Oct 25, 2019
1 parent 634ff22 commit 95dc825
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ShadowsocksX-NG/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 95dc825

Please sign in to comment.