Skip to content

Commit 752c962

Browse files
committed
chore: update doc
1 parent 7d464fc commit 752c962

File tree

3 files changed

+142
-20
lines changed

3 files changed

+142
-20
lines changed

CLAUDE.md

Lines changed: 54 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ Open Sidenotes is a macOS menu bar application that provides a floating side pan
1616
- **Edge-triggered Activation**: Move mouse to right edge to toggle panel
1717
- **Auto-save**: Changes saved automatically after 1 second
1818
- **Drawer UI**: Slide-in note list overlay
19+
- **Settings Panel**: Comprehensive customization options
20+
- Dock icon visibility control
21+
- Auto-hide behavior with configurable delay (0-3s)
22+
- Custom keyboard shortcuts (default: ⌘⌃Space)
23+
- Storage location selection
24+
- **Session Persistence**: Automatically restores last opened note on launch
1925

2026
## Tech Stack
2127

@@ -57,6 +63,8 @@ Or use Xcode: Open `open-sidenotes.xcodeproj` and press Cmd+R to run.
5763
- Implements edge-triggered activation: moving mouse to right screen edge (within 2px) toggles window visibility
5864
- Uses global mouse event monitoring (`NSEvent.addGlobalMonitorForEvents`)
5965
- Animates window slide-in/out with 0.2s duration using `NSAnimationContext`
66+
- Auto-hide on mouse exit with configurable delay (0-3s)
67+
- Supports global keyboard shortcut for window toggle (default: ⌘⌃Space)
6068
- Window properties:
6169
- Width: 400px
6270
- Height: Full screen visible frame
@@ -97,29 +105,62 @@ Or use Xcode: Open `open-sidenotes.xcodeproj` and press Cmd+R to run.
97105
- On blur: When losing focus
98106
- Preserves cursor position during re-rendering
99107

108+
**Settings System**
109+
- `SettingsView`: Comprehensive settings panel with custom UI components
110+
- `CustomToggleStyle`: Sage green toggle switches
111+
- `CustomSlider`: Styled slider for delay adjustment (0-3s range)
112+
- Settings categories: Appearance, Storage, Window Behavior, Keyboard Shortcuts
113+
- `ShortcutSettings`: ObservableObject managing user preferences
114+
- `showDockIcon`: Toggle Dock icon visibility (requires restart)
115+
- `autoHideOnMouseExit`: Auto-hide window when mouse leaves
116+
- `hideDelay`: Configurable delay before auto-hide (0-3s)
117+
- `toggleWindowShortcut`: Custom global keyboard shortcut
118+
- Persisted via UserDefaults
119+
- `ShortcutRecorderView`: Custom keyboard shortcut recorder
120+
- Interactive key capture with visual feedback
121+
- Supports all modifier keys (⌘⌃⌥⇧)
122+
- Clear button to remove shortcuts
123+
- Real-time preview of recorded shortcut
124+
125+
**Session Management**
126+
- `LastOpenedNoteManager`: Persists and restores last active note
127+
- Saves note ID on selection change
128+
- Auto-restores on app launch
129+
- Uses UserDefaults for storage
130+
100131
### Data Flow
101132

102-
1. User moves mouse to right edge → `SideNotesWindowController` detects → Window slides in
103-
2. User selects note → Updates `selectedNote` state → Loads Markdown content from `NoteStore`
104-
3. User types Markdown → `MarkdownEditor` updates plain text binding
105-
4. Render trigger fires (space/newline/1s delay) → `MarkdownRenderer` applies styling to source
106-
5. Auto-save triggers (1s after edit) → `NoteStore.updateNote` persists to JSON
107-
6. Mouse moves to edge again → Window slides out
133+
1. **App Launch** → Loads `ShortcutSettings` and `LastOpenedNoteManager` → Restores last note if exists
134+
2. **Edge Trigger** → User moves mouse to right edge → `SideNotesWindowController` detects → Window slides in
135+
3. **Keyboard Toggle** → User presses shortcut (⌘⌃Space) → `ShortcutManager` triggers window toggle
136+
4. **Note Selection** → User selects note → Saves to `LastOpenedNoteManager` → Loads content from `NoteStore`
137+
5. **Markdown Editing** → User types → Render triggers (space/newline/1s delay) → `MarkdownRenderer` applies styling
138+
6. **Auto-save** → 1s after edit → `NoteStore.updateNote` persists to file
139+
7. **Auto-hide** → Mouse exits window → Delay timer (0-3s) → Window slides out (if enabled)
140+
8. **Settings Change** → User modifies preferences → `ShortcutSettings` persists to UserDefaults → Notifies observers
108141

109142
### Key Technical Patterns
110143

111144
- **Custom Markdown Rendering**: Regex-based parser applies styles without deleting source
112-
- **SwiftUI + AppKit Bridge**: Uses `NSViewRepresentable` to wrap NSTextView
145+
- **SwiftUI + AppKit Bridge**: Uses `NSViewRepresentable` to wrap NSTextView and custom controls
113146
- **Smart Debouncing**: Context-aware rendering triggers (immediate on space/newline, delayed otherwise)
114-
- **Global Event Monitoring**: Tracks mouse position system-wide to detect edge triggers
115-
- **File-based Persistence**: Markdown files with YAML front matter in Documents directory
116-
- **Stateful Window Management**: Tracks `isShown` and `lastAtRightEdge` to implement toggle behavior
147+
- **Global Event Monitoring**: Tracks mouse position and keyboard events system-wide
148+
- **File-based Persistence**: Markdown files in configurable storage directory
149+
- **Stateful Window Management**: Tracks `isShown`, `lastAtRightEdge`, and auto-hide timers
150+
- **Settings Persistence**: UserDefaults-based configuration with reactive updates
151+
- **Custom UI Components**: Hand-crafted toggle switches, sliders, and shortcut recorder
152+
- **Session Restoration**: Automatic recovery of last opened note on launch
153+
- **Hot Keys System**: Global keyboard shortcut registration using Carbon framework
117154

118155
## Development Notes
119156

120-
- The app runs without a dock icon or standard menu bar (menu bar utility pattern)
157+
- The app runs as a menu bar utility (Dock icon visibility is configurable)
121158
- Window appears across all spaces and during full-screen apps
122159
- Markdown editing preserves all syntax - fully reversible
123160
- Mouse edge detection threshold is 2px from right screen edge
124-
- Window background has 98% opacity for semi-transparency
125-
- **No external dependencies** - pure Swift/AppKit implementation (Down library removed)
161+
- Auto-hide delay is configurable from 0-3 seconds (default: 0.5s)
162+
- Default keyboard shortcut: ⌘⌃Space (customizable)
163+
- Settings require app restart for Dock icon changes to take effect
164+
- Last opened note is automatically restored on app launch
165+
- Custom storage directory selection with real-time reload
166+
- **No external dependencies** - pure Swift/AppKit implementation

DESIGN_SYSTEM.md

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Minimal, directional shadows create a sense of layering without being heavy-hand
132132
- **Secondary Text**: Smaller (12pt), lighter gray
133133
- **Centered vertically and horizontally**
134134

135-
### Drawer Layout (NEW)
135+
### Drawer Layout
136136
- **Window Width**: 400px (compact side panel)
137137
- **Drawer Width**: 280px
138138
- **Editor Width**: Full 400px (336px usable after 32px padding on each side)
@@ -153,6 +153,62 @@ Minimal, directional shadows create a sense of layering without being heavy-hand
153153
#### Design Rationale
154154
The drawer pattern maximizes editor space (336px usable width vs. previous 44px) while maintaining quick access to the note list. The semi-transparent overlay and slide-in animation clearly communicate the layered interaction model. This approach keeps the window compact (400px) suitable for a side panel application while providing full editing capability.
155155

156+
### Settings Window
157+
- **Window Size**: 450px × 570px (expands to 620px when auto-hide is enabled)
158+
- **Background**: Pure white (#FFFFFF)
159+
- **Content Padding**: 24px horizontal, 24px vertical top
160+
- **Section Spacing**: 20px between major sections
161+
- **Dividers**: Full-width horizontal lines between sections
162+
163+
#### Settings Components
164+
**Custom Toggle Switch**:
165+
- **Dimensions**: 48px × 28px rounded rectangle
166+
- **Off State**: Light gray background (#E0E0E0)
167+
- **On State**: Sage green background (#7C9885)
168+
- **Toggle Circle**: White with 2px shadow, 3px padding, slides with spring animation
169+
- **Animation**: Spring response 0.3, dampingFraction 0.7
170+
171+
**Custom Slider** (for delay adjustment):
172+
- **Track**: 4px height, 2px corner radius
173+
- **Track Color**: Light gray (#E0E0E0) inactive, sage green (#7C9885) active
174+
- **Thumb**: 16px white circle with shadow
175+
- **Range**: 0.0-3.0 seconds, 0.1 step increments
176+
- **Value Display**: Shows formatted delay (e.g., "0.5 s") in sage green
177+
178+
**Shortcut Recorder**:
179+
- **Dimensions**: Auto-width × 32px height
180+
- **Corner Radius**: 6px
181+
- **States**:
182+
- **Default**: Light gray background (#F5F5F5), placeholder "Click to record"
183+
- **Recording**: Light green background (#E8F5E9), sage green border (2px), "Press keys..." text
184+
- **Set**: Displays shortcut symbols (⌘⌃⌥⇧) + key name
185+
- **Clear Button**: 16px circle with "×" icon, appears on hover when shortcut is set
186+
- **Text**: 12pt system font, medium weight when active
187+
188+
#### Settings Categories
189+
1. **Appearance**
190+
- Show Dock Icon toggle
191+
- Note: "Requires app restart to take effect"
192+
193+
2. **Storage Location**
194+
- Current path display (gray box, 12px padding)
195+
- "Choose Folder" button (sage green)
196+
- Reload alert when path changes
197+
198+
3. **Window Behavior**
199+
- Auto-hide toggle
200+
- Hide delay slider (only visible when auto-hide enabled)
201+
- Smooth height animation (0.3s) when toggling
202+
203+
4. **Keyboard Shortcuts**
204+
- Toggle Window shortcut recorder
205+
- Custom key combination capture
206+
207+
**Reset Button**: Bottom-left, gray background (#F0F0F0), "Reset to Default" text
208+
209+
#### Design Rationale
210+
The settings window uses custom-styled components that match the app's editorial minimalism aesthetic while providing modern, intuitive controls. The sage green accent color creates visual consistency with the main interface. Inline help text (#999999) provides context without cluttering the design. The expandable layout (570→620px) accommodates conditional controls smoothly.
211+
156212
---
157213

158214
## Animation & Motion
@@ -168,6 +224,10 @@ The drawer pattern maximizes editor space (336px usable width vs. previous 44px)
168224
- **Drawer Slide**: 0.2s easeInOut with `.move(edge: .leading)` transition
169225
- **Background Overlay**: Fade in/out with drawer (automatic with SwiftUI animation)
170226
- **Menu Button Hover**: Instant opacity change from 8% to 15%
227+
- **Toggle Switch**: Spring animation (response 0.3, damping 0.7) for smooth toggle
228+
- **Settings Height**: 0.3s easeInOut when showing/hiding delay slider
229+
- **Auto-hide**: Configurable delay (0-3s) before window slides out
230+
- **Shortcut Recorder**: Instant visual feedback when entering recording state
171231

172232
### Future Enhancements (Optional)
173233
- Fade-in for newly created notes
@@ -188,6 +248,10 @@ The drawer pattern maximizes editor space (336px usable width vs. previous 44px)
188248
- **Hover feedback**: Visual change on all interactive elements
189249
- **Focus indicators**: System default for keyboard navigation
190250
- **Semantic colors**: Green for positive/active, red for destructive
251+
- **Keyboard navigation**: Full keyboard support in settings (Tab to navigate)
252+
- **Custom shortcuts**: User-configurable for accessibility needs
253+
- **Clear affordances**: Buttons and controls clearly indicate interactivity
254+
- **Shortcut recorder**: Visual state changes guide recording process
191255

192256
### Font Sizes
193257
- Minimum body text: 15pt (exceeds 12pt minimum recommendation)
@@ -243,6 +307,10 @@ Unlike typical note apps with cold blue accents or stark white backgrounds, Open
243307
- Minimal shadow usage (drawer and window only)
244308
- Efficient animation with SwiftUI transitions
245309
- No heavy animations or effects
310+
- UserDefaults-based settings persistence (lightweight)
311+
- Timer-based auto-hide with automatic invalidation
312+
- Global event monitors only active when needed
313+
- Custom NSView controls for optimal shortcut recording
246314

247315
### Future Enhancements
248316
- Dark mode support (charcoal background with warm accents)

README.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@
1616
## Features
1717

1818
- **Edge Activation** — Move your mouse to the right edge of the screen to reveal the notes panel
19+
- **Keyboard Shortcut** — Toggle window with customizable global shortcut (default: ⌘⌃Space)
1920
- **Live Markdown** — Typora-style editing with real-time rendering while preserving source syntax
2021
- **Auto Save** — Your notes are automatically saved as you type
22+
- **Smart Auto-Hide** — Configurable auto-hide when mouse exits (0-3s delay)
23+
- **Session Restore** — Automatically reopens your last note on launch
24+
- **Customizable Settings** — Control Dock icon, storage location, and window behavior
2125
- **Lightweight** — Native SwiftUI app with minimal resource usage
2226
- **Always Available** — Works across all spaces and during full-screen apps
23-
- **Local Storage** — Notes stored as Markdown files in `~/Documents/OpenSidenotes/`
27+
- **Local Storage** — Notes stored as Markdown files in customizable directory
2428

2529
## Installation
2630

@@ -43,19 +47,28 @@ xcodebuild -project open-sidenotes.xcodeproj -scheme open-sidenotes build
4347

4448
## Usage
4549

46-
1. Launch the app — it runs in the background without a dock icon
47-
2. Move your mouse to the **right edge** of the screen
48-
3. The notes panel slides in automatically
49-
4. Start writing in Markdown
50-
5. Move to the edge again to hide the panel
50+
1. Launch the app — it runs as a menu bar utility
51+
2. **Show panel**: Move mouse to the right edge OR press `⌘⌃Space`
52+
3. Start writing in Markdown with live rendering
53+
4. **Hide panel**: Move to edge again, press shortcut again, or let it auto-hide
54+
5. Access settings from the menu bar icon
5155

5256
### Keyboard Shortcuts
5357

5458
| Shortcut | Action |
5559
|----------|--------|
60+
| `⌘⌃Space` | Toggle Window (customizable) |
5661
| `⌘ F` | Find & Replace |
5762
| `⌘ N` | New Note |
5863

64+
### Settings
65+
66+
Access settings to customize:
67+
- **Appearance**: Show/hide Dock icon (requires restart)
68+
- **Storage Location**: Choose where notes are saved
69+
- **Window Behavior**: Enable auto-hide with custom delay (0-3s)
70+
- **Keyboard Shortcuts**: Record custom shortcut for window toggle
71+
5972
### Markdown Support
6073

6174
```markdown

0 commit comments

Comments
 (0)