feat: Add keyboard shortcuts to switch main views and create posts
I added several keyboard shortcuts so users can switch between the main views of "Home", "DMs", "Search", and "Notifications" with the shortcuts "CMD+1", "CMD+2" etc.. Those shortcuts made the most sense to me but they're definitely up for discussion. Added a new keyboard shortcut to creat a new post. Unfortunately it had to be "SHIFT+CMD+N" because "CMD+N" already created a new window. Closes: #163 Changelog-Added: Cmd-{1,2,3,4} to switch between tabs on MacOS Changelog-Added: Shift-Cmd-N to create a post on MacOS
This commit is contained in:
committed by
William Casarin
parent
7c132675ac
commit
393745f67c
@@ -76,14 +76,11 @@ struct TabBar: View {
|
||||
VStack {
|
||||
Divider()
|
||||
HStack {
|
||||
TabButton(timeline: .home, img: "house", selected: $selected, new_events: $new_events, action: action)
|
||||
TabButton(timeline: .dms, img: "bubble.left.and.bubble.right", selected: $selected, new_events: $new_events, action: action)
|
||||
TabButton(timeline: .search, img: "magnifyingglass.circle", selected: $selected, new_events: $new_events, action: action)
|
||||
TabButton(timeline: .notifications, img: "bell", selected: $selected, new_events: $new_events, action: action)
|
||||
TabButton(timeline: .home, img: "house", selected: $selected, new_events: $new_events, action: action).keyboardShortcut("1")
|
||||
TabButton(timeline: .dms, img: "bubble.left.and.bubble.right", selected: $selected, new_events: $new_events, action: action).keyboardShortcut("2")
|
||||
TabButton(timeline: .search, img: "magnifyingglass.circle", selected: $selected, new_events: $new_events, action: action).keyboardShortcut("3")
|
||||
TabButton(timeline: .notifications, img: "bell", selected: $selected, new_events: $new_events, action: action).keyboardShortcut("4")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ func PostButton(action: @escaping () -> ()) -> some View {
|
||||
radius: 3,
|
||||
x: 3,
|
||||
y: 3)
|
||||
.keyboardShortcut("n", modifiers: [.command, .shift])
|
||||
}
|
||||
|
||||
func PostButtonContainer(action: @escaping () -> ()) -> some View {
|
||||
|
||||
Reference in New Issue
Block a user