Add Sidebar toggle

This commit is contained in:
Maurice Parker 2020-08-11 21:03:19 -05:00
parent d05b450cc5
commit 38d01eb151
2 changed files with 13 additions and 0 deletions

View File

@ -211,6 +211,11 @@ struct AppAssets {
return NSImage(systemSymbolName: "square.and.arrow.up", accessibilityDescription: nil)!
}()
@available(macOS 11.0, *)
static var sidebarToggleImage: RSImage = {
return NSImage(systemSymbolName: "sidebar.left", accessibilityDescription: nil)!
}()
@available(macOS 11.0, *)
static var starClosedImage: RSImage = {
return NSImage(systemSymbolName: "star.fill", accessibilityDescription: nil)!

View File

@ -695,6 +695,7 @@ extension MainWindowController : ScriptingMainWindowController {
// MARK: - NSToolbarDelegate
extension NSToolbarItem.Identifier {
static let sidebarToggle = NSToolbarItem.Identifier("sidebarToggle")
static let newFeed = NSToolbarItem.Identifier("newFeed")
static let newFolder = NSToolbarItem.Identifier("newFolder")
static let refresh = NSToolbarItem.Identifier("refresh")
@ -718,6 +719,10 @@ extension MainWindowController: NSToolbarDelegate {
switch itemIdentifier {
case .sidebarToggle:
let title = NSLocalizedString("Toggle Sidebar", comment: "Toggle Sidebar")
return buildToolbarButton(.toggleSidebar, title, AppAssets.sidebarToggleImage, "toggleTheSidebar:")
case .refresh:
let title = NSLocalizedString("Refresh", comment: "Refresh")
return buildToolbarButton(.refresh, title, AppAssets.refreshImage, "refreshAll:")
@ -792,6 +797,7 @@ extension MainWindowController: NSToolbarDelegate {
func toolbarAllowedItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] {
if #available(macOS 11.0, *) {
return [
.sidebarToggle,
.refresh,
.newSidebarItemMenu,
.sidebarTrackingSeparator,
@ -830,6 +836,8 @@ extension MainWindowController: NSToolbarDelegate {
func toolbarDefaultItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] {
if #available(macOS 11.0, *) {
return [
.sidebarToggle,
.flexibleSpace,
.refresh,
.newSidebarItemMenu,
.sidebarTrackingSeparator,