diff --git a/Mac/Base.lproj/Main.storyboard b/Mac/Base.lproj/Main.storyboard
index 64ecd1357..dcccfcf9c 100644
--- a/Mac/Base.lproj/Main.storyboard
+++ b/Mac/Base.lproj/Main.storyboard
@@ -496,6 +496,12 @@
+
diff --git a/Mac/Browser.swift b/Mac/Browser.swift
index 335a1a560..e633589c6 100644
--- a/Mac/Browser.swift
+++ b/Mac/Browser.swift
@@ -6,14 +6,16 @@
// Copyright © 2016 Ranchero Software, LLC. All rights reserved.
//
-import Foundation
+import AppKit
import RSWeb
struct Browser {
static func open(_ urlString: String) {
+ let shouldInvertPreference = NSApp.currentEvent?.modifierFlags.contains(.shift) ?? false
+
// Opens according to prefs.
- open(urlString, inBackground: AppDefaults.openInBrowserInBackground)
+ open(urlString, inBackground: shouldInvertPreference ? !AppDefaults.openInBrowserInBackground : AppDefaults.openInBrowserInBackground)
}
static func open(_ urlString: String, inBackground: Bool) {
@@ -23,3 +25,13 @@ struct Browser {
}
}
+extension Browser {
+
+ static var titleForOpenInBrowserInverted: String {
+ let openInBackgroundPref = AppDefaults.openInBrowserInBackground
+
+ return openInBackgroundPref ?
+ NSLocalizedString("Open in Browser in Foreground", comment: "Open in Browser in Foreground menu item title") :
+ NSLocalizedString("Open in Browser in Background", comment: "Open in Browser in Background menu item title")
+ }
+}
diff --git a/Mac/MainWindow/MainWindowController.swift b/Mac/MainWindow/MainWindowController.swift
index 01e7335c2..9633142ef 100644
--- a/Mac/MainWindow/MainWindowController.swift
+++ b/Mac/MainWindow/MainWindowController.swift
@@ -179,6 +179,10 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
public func validateUserInterfaceItem(_ item: NSValidatedUserInterfaceItem) -> Bool {
if item.action == #selector(openArticleInBrowser(_:)) {
+ if let item = item as? NSMenuItem, item.keyEquivalentModifierMask.contains(.shift) {
+ item.title = Browser.titleForOpenInBrowserInverted
+ }
+
return currentLink != nil
}
diff --git a/Mac/MainWindow/Timeline/TimelineViewController.swift b/Mac/MainWindow/Timeline/TimelineViewController.swift
index ab1e9642d..00a2301ce 100644
--- a/Mac/MainWindow/Timeline/TimelineViewController.swift
+++ b/Mac/MainWindow/Timeline/TimelineViewController.swift
@@ -725,6 +725,10 @@ extension TimelineViewController: NSUserInterfaceValidations {
func validateUserInterfaceItem(_ item: NSValidatedUserInterfaceItem) -> Bool {
if item.action == #selector(openArticleInBrowser(_:)) {
+ if let item = item as? NSMenuItem, item.keyEquivalentModifierMask.contains(.shift) {
+ item.title = Browser.titleForOpenInBrowserInverted
+ }
+
let currentLink = oneSelectedArticle?.preferredLink
return currentLink != nil
}