IceCubes/IceCubesApp/App/Main/IceCubesApp+Menu.swift

59 lines
1.9 KiB
Swift
Raw Normal View History

2023-10-26 06:23:00 +02:00
import Env
2023-11-01 18:58:44 +01:00
import SwiftUI
2023-10-26 06:23:00 +02:00
extension IceCubesApp {
@CommandsBuilder
var appMenu: some Commands {
CommandGroup(replacing: .newItem) {
Button("menu.new-window") {
openWindow(id: "MainWindow")
}
.keyboardShortcut("n", modifiers: .shift)
Button("menu.new-post") {
2023-12-18 08:22:59 +01:00
#if targetEnvironment(macCatalyst)
openWindow(value: WindowDestinationEditor.newStatusEditor(visibility: userPreferences.postVisibility))
#else
sidebarRouterPath.presentedSheet = .newStatusEditor(visibility: userPreferences.postVisibility)
#endif
2023-10-26 06:23:00 +02:00
}
.keyboardShortcut("n", modifiers: .command)
}
CommandGroup(replacing: .textFormatting) {
Menu("menu.font") {
Button("menu.font.bigger") {
if theme.fontSizeScale < 1.5 {
theme.fontSizeScale += 0.1
}
}
Button("menu.font.smaller") {
if theme.fontSizeScale > 0.5 {
theme.fontSizeScale -= 0.1
}
}
}
}
CommandMenu("tab.timeline") {
Button("timeline.latest") {
NotificationCenter.default.post(name: .refreshTimeline, object: nil)
}
.keyboardShortcut("r", modifiers: .command)
Button("timeline.home") {
NotificationCenter.default.post(name: .homeTimeline, object: nil)
}
.keyboardShortcut("h", modifiers: .shift)
Button("timeline.trending") {
NotificationCenter.default.post(name: .trendingTimeline, object: nil)
}
.keyboardShortcut("t", modifiers: .shift)
Button("timeline.federated") {
NotificationCenter.default.post(name: .federatedTimeline, object: nil)
}
.keyboardShortcut("f", modifiers: .shift)
Button("timeline.local") {
NotificationCenter.default.post(name: .localTimeline, object: nil)
}
.keyboardShortcut("l", modifiers: .shift)
}
}
}