Add readme
This commit is contained in:
parent
dc557ec780
commit
763624a226
13
README.md
Normal file
13
README.md
Normal file
|
|
@ -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)
|
||||
10
src/main.rs
10
src/main.rs
|
|
@ -20,7 +20,7 @@ enum UserEvent {
|
|||
#[derive(Default)]
|
||||
struct App {
|
||||
tray_icon: Option<tray_icon::TrayIcon>,
|
||||
menu_push_now_id: Option<MenuId>,
|
||||
menu_backup_now_id: Option<MenuId>,
|
||||
menu_exit_id: Option<MenuId>,
|
||||
last_change_time: Option<Instant>,
|
||||
duration_threshold: Duration,
|
||||
|
|
@ -29,11 +29,11 @@ struct App {
|
|||
impl ApplicationHandler<UserEvent> 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<UserEvent> 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<UserEvent> 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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user