Skip to content

A local-first personal finance app

Sync on ctrl+s (#1770)

Compositrbdf5c45cda9f
diff --git a/packages/desktop-client/src/components/Titlebar.tsx b/packages/desktop-client/src/components/Titlebar.tsx
index 77a51757b1..6c305f2378 100644
--- a/packages/desktop-client/src/components/Titlebar.tsx
+++ b/packages/desktop-client/src/components/Titlebar.tsx
@@ -32,6 +32,7 @@ import Link from './common/Link';
import Paragraph from './common/Paragraph';
import Text from './common/Text';
import View from './common/View';
+import { KeyHandlers } from './KeyHandlers';
import LoggedInUser from './LoggedInUser';
import { useServerURL } from './ServerContext';
import { useSidebar } from './sidebar';
@@ -173,30 +174,40 @@ export function SyncButton({ style, isMobile = false }: SyncButtonProps) {
: {};
return (
- <Button
- type="bare"
- style={{
- ...style,
- WebkitAppRegion: 'none',
- color: isMobile ? mobileColor : desktopColor,
- }}
- hoveredStyle={activeStyle}
- activeStyle={activeStyle}
- onClick={sync}
- >
- {syncState === 'error' ? (
- <AlertTriangle width={13} />
- ) : (
- <AnimatedRefresh animating={syncing} />
- )}
- <Text style={{ marginLeft: 3 }}>
- {syncState === 'disabled'
- ? 'Disabled'
- : syncState === 'offline'
- ? 'Offline'
- : 'Sync'}
- </Text>
- </Button>
+ <>
+ <KeyHandlers
+ keys={{
+ 'ctrl+s, cmd+s': () => {
+ sync();
+ },
+ }}
+ />
+
+ <Button
+ type="bare"
+ style={{
+ ...style,
+ WebkitAppRegion: 'none',
+ color: isMobile ? mobileColor : desktopColor,
+ }}
+ hoveredStyle={activeStyle}
+ activeStyle={activeStyle}
+ onClick={sync}
+ >
+ {syncState === 'error' ? (
+ <AlertTriangle width={13} />
+ ) : (
+ <AnimatedRefresh animating={syncing} />
+ )}
+ <Text style={{ marginLeft: 3 }}>
+ {syncState === 'disabled'
+ ? 'Disabled'
+ : syncState === 'offline'
+ ? 'Offline'
+ : 'Sync'}
+ </Text>
+ </Button>
+ </>
);
}
diff --git a/upcoming-release-notes/1770.md b/upcoming-release-notes/1770.md
new file mode 100644
index 0000000000..a73c4ca0ad
--- /dev/null
+++ b/upcoming-release-notes/1770.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [Compositr, shaankhosla]
+---
+
+Sync on Ctrl+S
\ No newline at end of file