New Feature: external file monitoring #164
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This Pull Request implements External File Change Detection for notes.json.
Overview
Adds real-time detection of external changes to notes.json with user prompts when the file is modified by external processes, sync services, other instances of sticky, or manual edits. Includes confirmation dialogs to prevent data loss. Includes an optional auto-reload preference for frictionless multi-device synchronization.
Evidence of Need
Requests for a feature similar to this appear multiple times in the current open issues list:
#154 #102 #63 #2
Users who install Sticky on multiple machines would like to synchronize their notes using cloud storage (Dropbox, Syncthing, etc.) or shared network folders. By detecting changes to notes.json the user can be presented with a confirmation prompt to reload the notes being displayed in the UI.
This implementation also handles conflict resolution in the rare situation where external changes conflict with user edits to a note.
Technical Implementation
Key Components:
File Monitoring (in common.py):
setup_file_monitor()- Monitors notes.json fileon_file_changed()- Handles external change eventsDialog Handling (in sticky.py):
a. External changes detected (no conflicts) → Options for "Reload" / "Cancel"
b. (Edge case) External changes with unsaved local changes (race condition) → "Reload from disk" / "Keep my changes"
c. (Edge case) File modified before save → "Don't Save" / "Backup and Save" / "Save Anyway"
Auto-Reload Preference:
Changes Made
Modified Files:
usr/lib/sticky/common.py- FileHandler class with monitoring logicusr/lib/sticky/sticky.py- Application class with dialog handlersusr/share/glib-2.0/schemas/org.x.sticky.gschema.xml- New preference keyNew Files:
docs/external-change-detection-manual-tests.md- Manual test scenariosTesting Performed
All 17 manual test scenarios are passing.
Known Limitations
Screenshots
Dialog examples:
External Change Detected (no conflicts):

File Modified (conflict at save time):

Note on use of generative AI
Most of the implementation was performed with an AI coding assistant. Every line of code was inspected and verified by the contributor and a comprehensive set of tests was performed by hand.