damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 393745f67c43f57f7b75cfb205ea8fc270af2863
parent 7c132675acadc6b28f6ca9796d2046d10419e8c0
Author: Jonathan Milligan <logouts.deco-0e@icloud.com>
Date:   Tue, 27 Dec 2022 12:05:02 -0600

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

Diffstat:
Mdamus/Views/MainTabView.swift | 11++++-------
Mdamus/Views/PostButton.swift | 1+
2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/damus/Views/MainTabView.swift b/damus/Views/MainTabView.swift @@ -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") } } } } - - - diff --git a/damus/Views/PostButton.swift b/damus/Views/PostButton.swift @@ -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 {