Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions apps/desktop/src/main/lib/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export function registerMenuHotkeyUpdates() {
export function createApplicationMenu() {
const closeAccelerator = getMenuAccelerator("CLOSE_WINDOW");
const showHotkeysAccelerator = getMenuAccelerator("SHOW_HOTKEYS");
const openSettingsAccelerator = getMenuAccelerator("OPEN_SETTINGS");

const template: Electron.MenuItemConstructorOptions[] = [
{
Expand Down Expand Up @@ -150,6 +151,14 @@ export function createApplicationMenu() {
label: app.name,
submenu: [
{ role: "about" },
{ type: "separator" },
{
label: "Settings...",
accelerator: openSettingsAccelerator,
click: () => {
menuEmitter.emit("open-settings");
},
},
{
label: "Check for Updates...",
click: () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export function OrganizationDropdown() {
const collections = useCollections();
const signOutMutation = electronTrpc.auth.signOut.useMutation();
const navigate = useNavigate();
const settingsHotkey = useHotkeyText("OPEN_SETTINGS");
const shortcutsHotkey = useHotkeyText("SHOW_HOTKEYS");
const showShortcut = shortcutsHotkey !== "Unassigned";

const activeOrganizationId = session?.session?.activeOrganizationId;

Expand Down Expand Up @@ -97,6 +97,9 @@ export function OrganizationDropdown() {
>
<HiOutlineCog6Tooth className="h-4 w-4" />
<span>Settings</span>
{settingsHotkey !== "Unassigned" && (
<DropdownMenuShortcut>{settingsHotkey}</DropdownMenuShortcut>
)}
</DropdownMenuItem>

<DropdownMenuItem
Expand Down Expand Up @@ -155,7 +158,7 @@ export function OrganizationDropdown() {
>
<LuKeyboard className="h-4 w-4" />
Keyboard Shortcuts
{showShortcut && (
{shortcutsHotkey !== "Unassigned" && (
<DropdownMenuShortcut>{shortcutsHotkey}</DropdownMenuShortcut>
)}
</DropdownMenuItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ function DashboardLayout() {
} = useWorkspaceSidebarStore();

// Global hotkeys for dashboard
useAppHotkey(
"OPEN_SETTINGS",
() => navigate({ to: "/settings/account" }),
undefined,
[navigate],
);

useAppHotkey(
"SHOW_HOTKEYS",
() => navigate({ to: "/settings/keyboard" }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function SettingsButton() {
</Button>
</TooltipTrigger>
<TooltipContent side="bottom" sideOffset={8}>
<HotkeyTooltipContent label="Open settings" hotkeyId="SHOW_HOTKEYS" />
<HotkeyTooltipContent label="Open settings" hotkeyId="OPEN_SETTINGS" />
</TooltipContent>
</Tooltip>
);
Expand Down
10 changes: 10 additions & 0 deletions apps/desktop/src/shared/hotkeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,16 @@ export const HOTKEYS = {
}),

// Help
OPEN_SETTINGS: defineHotkey({
keys: "meta+,",
label: "Open Settings",
category: "Help",
defaults: {
darwin: "meta+,",
win32: "ctrl+,",
linux: "ctrl+,",
},
}),
SHOW_HOTKEYS: defineHotkey({
keys: "meta+slash",
label: "Show Keyboard Shortcuts",
Expand Down
Loading