diff --git a/README.md b/README.md new file mode 100644 index 0000000..861c2eb --- /dev/null +++ b/README.md @@ -0,0 +1,45 @@ +kpsync +====== + +A small util to launch keepassXC while the database file is on a remote webDAV server (e.g. Nextcloud). + +# Usage + +1. simply start `kpsync` +2. On first start a example config in `~/.config/kpsync.json` will be created, probably needs to be edited +3. Afterwards start it again + +# Functionality + +kpsync starts by downloading the latest db file from the webDAV to the (configured) temp directory +(if there already exists a local file, matching with the server version (via ETag), the download will be skipped) + +If teh download fails, teh user gets the option to open a local (fallback) file (e.g. if the computer has no network) + +Then KeepassXC is launched. + +The temp directory is being watched (inotify) and on file changes they are uploaded to the server. + +If there are conflicts (e.g. two clients editing the file at the same time) we ask the user what to do (via `notify-send`) + +# Prerequisites + +Tested on Linux + Arch + KDE. + +Needs `notify-send` to send desktop notifications. +Needs `inotify` to watch the directory for changes. +Needs `keepassxc` to be installed. duh. + +# Config (example) + +```json +{ + "webdav_url": "https://cloud.example.com/remote.php/dav/files/YourUser/example.kdbx", + "webdav_user": "user", + "webdav_pass": "hunter2", + "local_fallback": "/home/user/example.kdbx", + "work_dir": "/tmp/kpsync", + "debounce": 3500, + "terminal_emulator": "konsole -e" +} +``` \ No newline at end of file diff --git a/app/tray.go b/app/tray.go index 7e45f33..0480c9d 100644 --- a/app/tray.go +++ b/app/tray.go @@ -16,20 +16,28 @@ func (app *Application) initTray() { systray.SetIcon(assets.IconInit) systray.SetTitle("KeepassXC Sync") - app.currSysTrayTooltip = "Initializing..." + app.currSysTrayTooltip = "KPSync | " + "Initializing..." systray.SetTooltip(app.currSysTrayTooltip) miSync := systray.AddMenuItem("Sync Now (checked)", "") miSyncForce := systray.AddMenuItem("Sync Now (forced)", "") miShowLogFifo := systray.AddMenuItem("Show Log (fifo)", "") miShowLogFile := systray.AddMenuItem("Show Log (file)", "") - systray.AddMenuItem("", "") + + systray.AddMenuItem("", "").Disable() + app.trayItemChecksum = systray.AddMenuItem("Checksum: {...}", "") app.trayItemETag = systray.AddMenuItem("ETag: {...}", "") app.trayItemLastModified = systray.AddMenuItem("LastModified: {...}", "") - systray.AddMenuItem("", "") + + systray.AddMenuItem("", "").Disable() + miQuit := systray.AddMenuItem("Quit", "") + app.trayItemChecksum.Disable() + app.trayItemETag.Disable() + app.trayItemLastModified.Disable() + app.LogDebug("SysTray initialized") app.LogLine() @@ -87,7 +95,8 @@ func (app *Application) setTrayState(txt string, icon []byte) func() { defer app.masterLock.Unlock() systray.SetIcon(icon) - systray.SetTooltip(txt) + app.currSysTrayTooltip = "KPSync | " + txt + systray.SetTooltip(app.currSysTrayTooltip) var finDone = false @@ -104,7 +113,7 @@ func (app *Application) setTrayState(txt string, icon []byte) func() { } systray.SetIcon(assets.IconDefault) - app.currSysTrayTooltip = "Sleeping..." + app.currSysTrayTooltip = "KPSync | " + "Sleeping..." systray.SetTooltip(app.currSysTrayTooltip) finDone = true @@ -122,7 +131,9 @@ func (app *Application) setTrayStateDirect(txt string, icon []byte) { defer app.masterLock.Unlock() systray.SetIcon(icon) - systray.SetTooltip(txt) + + app.currSysTrayTooltip = "KPSync | " + txt + systray.SetTooltip(app.currSysTrayTooltip) } func (app *Application) setTrayTooltip(txt string) { @@ -134,6 +145,6 @@ func (app *Application) setTrayTooltip(txt string) { defer app.masterLock.Unlock() systray.SetTooltip(txt) - app.currSysTrayTooltip = txt + app.currSysTrayTooltip = "KPSync | " + txt systray.SetTooltip(app.currSysTrayTooltip) } diff --git a/assets/icon.xcf b/assets/icon.xcf new file mode 100644 index 0000000..773988d Binary files /dev/null and b/assets/icon.xcf differ diff --git a/assets/iconDefault.png b/assets/iconDefault.png index d2c7c4b..a14488f 100644 Binary files a/assets/iconDefault.png and b/assets/iconDefault.png differ diff --git a/assets/iconDownload.png b/assets/iconDownload.png index 37f8840..176583d 100644 Binary files a/assets/iconDownload.png and b/assets/iconDownload.png differ diff --git a/assets/iconInit.png b/assets/iconInit.png index 2b77ac9..af1eb6e 100644 Binary files a/assets/iconInit.png and b/assets/iconInit.png differ diff --git a/assets/iconUpload.png b/assets/iconUpload.png index be2f92d..42064de 100644 Binary files a/assets/iconUpload.png and b/assets/iconUpload.png differ diff --git a/assets/iconUploadConflict.png b/assets/iconUploadConflict.png index 7fa0b0b..5bed2c2 100644 Binary files a/assets/iconUploadConflict.png and b/assets/iconUploadConflict.png differ