diff --git a/Evergreen.xcodeproj/project.pbxproj b/Evergreen.xcodeproj/project.pbxproj index 9fc66957e..4d165b2cf 100644 --- a/Evergreen.xcodeproj/project.pbxproj +++ b/Evergreen.xcodeproj/project.pbxproj @@ -25,6 +25,7 @@ 844B5B691FEA20DF00C7C76A /* SidebarKeyboardShortcuts.plist in Resources */ = {isa = PBXBuildFile; fileRef = 844B5B681FEA20DF00C7C76A /* SidebarKeyboardShortcuts.plist */; }; 84513F901FAA63950023A1A9 /* FeedListControlsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84513F8F1FAA63950023A1A9 /* FeedListControlsView.swift */; }; 845213231FCA5B11003B6E93 /* ImageDownloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845213221FCA5B10003B6E93 /* ImageDownloader.swift */; }; + 845479881FEB77C000AD8B59 /* TimelineKeyboardShortcuts.plist in Resources */ = {isa = PBXBuildFile; fileRef = 845479871FEB77C000AD8B59 /* TimelineKeyboardShortcuts.plist */; }; 845A29091FC74B8E007B49E3 /* SingleFaviconDownloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845A29081FC74B8E007B49E3 /* SingleFaviconDownloader.swift */; }; 845A29221FC9251E007B49E3 /* SidebarCellLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845A29211FC9251E007B49E3 /* SidebarCellLayout.swift */; }; 845A29241FC9255E007B49E3 /* SidebarCellAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845A29231FC9255E007B49E3 /* SidebarCellAppearance.swift */; }; @@ -431,6 +432,7 @@ 844B5B681FEA20DF00C7C76A /* SidebarKeyboardShortcuts.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = SidebarKeyboardShortcuts.plist; sourceTree = ""; }; 84513F8F1FAA63950023A1A9 /* FeedListControlsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedListControlsView.swift; sourceTree = ""; }; 845213221FCA5B10003B6E93 /* ImageDownloader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageDownloader.swift; sourceTree = ""; }; + 845479871FEB77C000AD8B59 /* TimelineKeyboardShortcuts.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = TimelineKeyboardShortcuts.plist; sourceTree = ""; }; 845A29081FC74B8E007B49E3 /* SingleFaviconDownloader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SingleFaviconDownloader.swift; sourceTree = ""; }; 845A29211FC9251E007B49E3 /* SidebarCellLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarCellLayout.swift; sourceTree = ""; }; 845A29231FC9255E007B49E3 /* SidebarCellAppearance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarCellAppearance.swift; sourceTree = ""; }; @@ -616,6 +618,7 @@ isa = PBXGroup; children = ( 844B5B5A1FEA00FB00C7C76A /* TimelineKeyboardDelegate.swift */, + 845479871FEB77C000AD8B59 /* TimelineKeyboardShortcuts.plist */, ); path = Keyboard; sourceTree = ""; @@ -1357,6 +1360,7 @@ 849A97951ED9EF7A007D329B /* IndeterminateProgressWindow.xib in Resources */, 844B5B651FEA11F200C7C76A /* GlobalKeyboardShortcuts.plist in Resources */, 849A978F1ED9EE72007D329B /* DefaultFeeds.plist in Resources */, + 845479881FEB77C000AD8B59 /* TimelineKeyboardShortcuts.plist in Resources */, 849A979D1ED9EFEB007D329B /* template.html in Resources */, 849A97A91ED9F9AA007D329B /* AddFeedSheet.xib in Resources */, 84AFBB3E1FBE770200BA41CF /* PanicButtonWindow.xib in Resources */, diff --git a/Evergreen/AppDelegate.swift b/Evergreen/AppDelegate.swift index 9bf744b34..7d922525e 100644 --- a/Evergreen/AppDelegate.swift +++ b/Evergreen/AppDelegate.swift @@ -409,7 +409,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations, @IBAction func openWebsite(_ sender: AnyObject) { - Browser.open("//ranchero.com/evergreen/", inBackground: false) + Browser.open("https://ranchero.com/evergreen/", inBackground: false) } @IBAction func openRepository(_ sender: AnyObject) { @@ -422,6 +422,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations, Browser.open("https://github.com/brentsimmons/Evergreen/issues", inBackground: false) } + @IBAction func openTechnotes(_ sender: Any?) { + + Browser.open("https://github.com/brentsimmons/Evergreen/tree/master/Technotes", inBackground: false) + } + @IBAction func showHelp(_ sender: AnyObject) { Browser.open("https://ranchero.com/evergreen/help/1.0/", inBackground: false) diff --git a/Evergreen/Base.lproj/Main.storyboard b/Evergreen/Base.lproj/Main.storyboard index b31f1c194..11343aea1 100644 --- a/Evergreen/Base.lproj/Main.storyboard +++ b/Evergreen/Base.lproj/Main.storyboard @@ -522,6 +522,12 @@ + + + + + + diff --git a/Evergreen/MainWindow/Keyboard/GlobalKeyboardShortcuts.plist b/Evergreen/MainWindow/Keyboard/GlobalKeyboardShortcuts.plist index 4611d1fc0..45965eadf 100644 --- a/Evergreen/MainWindow/Keyboard/GlobalKeyboardShortcuts.plist +++ b/Evergreen/MainWindow/Keyboard/GlobalKeyboardShortcuts.plist @@ -58,7 +58,7 @@ key l action - markReadAndGoToNextUnread: + markAllAsReadAndGoToNextUnread: key diff --git a/Evergreen/MainWindow/MainWindowController.swift b/Evergreen/MainWindow/MainWindowController.swift index c0397f3a7..2c4900ee2 100644 --- a/Evergreen/MainWindow/MainWindowController.swift +++ b/Evergreen/MainWindow/MainWindowController.swift @@ -186,6 +186,12 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations { timelineViewController?.markSelectedArticlesAsUnread(sender) } + @IBAction func markAllAsReadAndGoToNextUnread(_ sender: Any?) { + + markAllAsRead(sender) + nextUnread(sender) + } + @IBAction func markUnreadAndGoToNextUnread(_ sender: Any?) { markUnread(sender) @@ -212,6 +218,16 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations { appDelegate.markEverywhereAsRead(with: window!) } + + @IBAction func navigateToTimeline(_ sender: Any?) { + + timelineViewController?.focus() + } + + @IBAction func navigateToSidebar(_ sender: Any?) { + + sidebarViewController?.focus() + } } // MARK: - Private diff --git a/Evergreen/MainWindow/Timeline/Keyboard/TimelineKeyboardDelegate.swift b/Evergreen/MainWindow/Timeline/Keyboard/TimelineKeyboardDelegate.swift index 134269dbe..39ca4b3b3 100644 --- a/Evergreen/MainWindow/Timeline/Keyboard/TimelineKeyboardDelegate.swift +++ b/Evergreen/MainWindow/Timeline/Keyboard/TimelineKeyboardDelegate.swift @@ -14,13 +14,30 @@ import RSCore @objc final class TimelineKeyboardDelegate: NSObject, KeyboardDelegate { @IBOutlet weak var timelineViewController: TimelineViewController? + let shortcuts: Set override init() { + + let f = Bundle.main.path(forResource: "TimelineKeyboardShortcuts", ofType: "plist")! + let rawShortcuts = NSArray(contentsOfFile: f)! as! [[String: Any]] + + self.shortcuts = Set(rawShortcuts.flatMap { KeyboardShortcut(dictionary: $0) }) + super.init() } - + func keydown(_ event: NSEvent, in view: NSView) -> Bool { - return MainWindowKeyboardHandler.shared.keydown(event, in: view) + if MainWindowKeyboardHandler.shared.keydown(event, in: view) { + return true + } + + let key = KeyboardKey(with: event) + guard let matchingShortcut = KeyboardShortcut.findMatchingShortcut(in: shortcuts, key: key) else { + return false + } + + matchingShortcut.perform(with: view) + return true } } diff --git a/Evergreen/MainWindow/Timeline/Keyboard/TimelineKeyboardShortcuts.plist b/Evergreen/MainWindow/Timeline/Keyboard/TimelineKeyboardShortcuts.plist new file mode 100644 index 000000000..07b106ff3 --- /dev/null +++ b/Evergreen/MainWindow/Timeline/Keyboard/TimelineKeyboardShortcuts.plist @@ -0,0 +1,12 @@ + + + + + + key + [leftarrow] + action + navigateToSidebar: + + + diff --git a/Evergreen/Resources/KeyboardShortcuts/KeyboardShortcuts.html b/Evergreen/Resources/KeyboardShortcuts/KeyboardShortcuts.html index 4f404e820..a4984e930 100644 --- a/Evergreen/Resources/KeyboardShortcuts/KeyboardShortcuts.html +++ b/Evergreen/Resources/KeyboardShortcuts/KeyboardShortcuts.html @@ -45,7 +45,7 @@ Mark all as read, go to next unreadl (lowercase L) Mark as unread, go to next unreadm Mark as unreadu -Open in browserb or rightArrow or return or enter +Open in browserb or return or enter Move focus to SubscriptionsleftArrow Previous subscriptiona Next subscriptionz diff --git a/Frameworks/RSCore/RSCore/Keyboard.swift b/Frameworks/RSCore/RSCore/Keyboard.swift index ead55948d..81b64b114 100644 --- a/Frameworks/RSCore/RSCore/Keyboard.swift +++ b/Frameworks/RSCore/RSCore/Keyboard.swift @@ -20,7 +20,7 @@ public struct KeyboardConstant { public extension String { public var keyboardIntegerValue: Int { - return Int(utf8[utf8.startIndex]) + return Int(utf16[utf16.startIndex]) } }