Add Sidebar toggle
This commit is contained in:
parent
d05b450cc5
commit
38d01eb151
|
@ -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)!
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue