Browse Source

numbered key equivs (dev)

tags/v1.2.0
boB Rudis 5 years ago
parent
commit
4bdcd8b3f6
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 4
      NEWS.md
  2. 6
      README.md
  3. 4
      RSwitch.xcodeproj/project.pbxproj
  4. 10
      RSwitch/AppDelegate.swift

4
NEWS.md

@ -1,3 +1,7 @@
# 1.2.0
- numbered key equivalents (up to 9)
# 1.1.0
- About dialog (to ensure icon author gets credit)

6
README.md

@ -56,12 +56,12 @@ This codebase has been uploaded to the following authoritative social coding sit
## TODO
- Allow hiding of the app icon (not sure this is a good idea, tho…pls discuss in an issue!)
- Add Cmd-1, -2, -3, (etc) key equivalents in the menu bar for fast selection (one reason why ^^ might not be a good idea)
- Clean up the icon (which is "dial" by IconMark from the Noun Project). This means having it look better in the menu bar in dark/light mode _including_ the highlight mode for it. Possibly means getting a visible "R" on it somewhere.
- Better/prettier alerting (which also means more sanity checks)
- <strike>Add an "about" box (mostly to ensure IconMark gets more credit than a comment and README)</strike>
- Allow hiding of the app icon? (not sure this is a good idea, tho&hellip;pls discuss in an issue!)
- (add your own TODO suggestions via PR)
- <strike>Add Cmd-1, -2, -3, (etc) key equivalents in the menu bar for fast selection (one reason why ^^ might not be a good idea)</strike>
- <strike>Add an "about" box (mostly to ensure IconMark gets more credit than a comment and README)</strike>
## License

4
RSwitch.xcodeproj/project.pbxproj

@ -285,7 +285,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 1.1.0;
MARKETING_VERSION = 1.2.0;
PRODUCT_BUNDLE_IDENTIFIER = is.rud.bob.RSwitch;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -308,7 +308,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 1.1.0;
MARKETING_VERSION = 1.2.0;
PRODUCT_BUNDLE_IDENTIFIER = is.rud.bob.RSwitch;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";

10
RSwitch/AppDelegate.swift

@ -84,7 +84,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
//
// Show about dialog
@objc func about(_ sender: NSMenuItem?) {
abtController.showWindow(self)
}
@ -120,9 +120,10 @@ extension AppDelegate: NSMenuDelegate {
// retrieves all versions (excludes hidden files and the Current alias
let versions = entries.sorted().filter { !($0.hasPrefix(".")) && !($0 == "Current") }
let hasCurrent = entries.filter { $0 == "Current" }
// if there was a Current alias (prbly shld alert if not)
if ((entries.filter { $0 == "Current" })[0] == "Current") {
if (hasCurrent.count > 0) {
// get where Current points to
let furl = NSURL(fileURLWithPath: macos_r_framework_dir + "/" + "Current")
@ -138,12 +139,15 @@ extension AppDelegate: NSMenuDelegate {
// populate menu items with all installed R versions, ensuring we
// put a checkbox next to the one that is Current
var i = 1
for version in versions {
let item = NSMenuItem(title: version, action: #selector(handleSwitch), keyEquivalent: "")
let keynum = (i < 10) ? String(i) : ""
let item = NSMenuItem(title: version, action: #selector(handleSwitch), keyEquivalent: keynum)
item.isEnabled = true
if (version == targetPath) { item.state = NSControl.StateValue.on }
item.representedObject = version
menu.addItem(item)
i = i + 1
}
}

Loading…
Cancel
Save