diff --git a/README.md b/README.md new file mode 100644 index 0000000..463395a --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# Obsidian Git Backup + +This script automates the process of backing up your Obsidian vault to a Git repository. It ensures that all changes are tracked automatically and can be easily restored if needed. + +## Features + +- [x] Trigger backup after file changes with delay +- [ ] Push changes to remote repository +- [ ] Maintain git repo in a seperate folder to not have the repo synced by syncthing (copy changed files over) +- [x] Tray Menu + - [x] Exit + - [x] Backup now + - [ ] See current status (Time after last file change, backup in progress) diff --git a/src/main.rs b/src/main.rs index f0fb1b0..2791100 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,7 +20,7 @@ enum UserEvent { #[derive(Default)] struct App { tray_icon: Option, - menu_push_now_id: Option, + menu_backup_now_id: Option, menu_exit_id: Option, last_change_time: Option, duration_threshold: Duration, @@ -29,11 +29,11 @@ struct App { impl ApplicationHandler for App { fn resumed(&mut self, _event_loop: &ActiveEventLoop) { // Create and show the tray icon - let menu_item_push_now = MenuItem::new("Push Now", true, None); + let menu_item_backup_now = MenuItem::new("Backup Now", true, None); let menu_item_exit = MenuItem::new("Exit", true, None); let tray_menu = Menu::new(); - tray_menu.append(&menu_item_push_now).unwrap(); + tray_menu.append(&menu_item_backup_now).unwrap(); tray_menu.append(&menu_item_exit).unwrap(); let icon_path = Path::new("D:/Dev/obsidian-git-backup/sync.ico"); @@ -46,7 +46,7 @@ impl ApplicationHandler for App { .unwrap(); self.tray_icon = Some(tray_icon); - self.menu_push_now_id = Some(menu_item_push_now.id().clone()); + self.menu_backup_now_id = Some(menu_item_backup_now.id().clone()); self.menu_exit_id = Some(menu_item_exit.id().clone()); // Set the duration threshold (e.g., 5 minutes) @@ -58,7 +58,7 @@ impl ApplicationHandler for App { match event { UserEvent::MenuEvent(menu_event) => { match menu_event.id() { - id if id == self.menu_push_now_id.as_ref().unwrap() => { + id if id == self.menu_backup_now_id.as_ref().unwrap() => { // Handle push now menu item self.last_change_time = None; backup_changes();