added icons + README, MVP finished

This commit is contained in:
Mike Schwörer 2025-08-20 14:45:46 +02:00
parent fb5d408a01
commit 99bcd5a30c
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
8 changed files with 63 additions and 7 deletions

45
README.md Normal file
View File

@ -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"
}
```

View File

@ -16,20 +16,28 @@ func (app *Application) initTray() {
systray.SetIcon(assets.IconInit) systray.SetIcon(assets.IconInit)
systray.SetTitle("KeepassXC Sync") systray.SetTitle("KeepassXC Sync")
app.currSysTrayTooltip = "Initializing..." app.currSysTrayTooltip = "KPSync | " + "Initializing..."
systray.SetTooltip(app.currSysTrayTooltip) systray.SetTooltip(app.currSysTrayTooltip)
miSync := systray.AddMenuItem("Sync Now (checked)", "") miSync := systray.AddMenuItem("Sync Now (checked)", "")
miSyncForce := systray.AddMenuItem("Sync Now (forced)", "") miSyncForce := systray.AddMenuItem("Sync Now (forced)", "")
miShowLogFifo := systray.AddMenuItem("Show Log (fifo)", "") miShowLogFifo := systray.AddMenuItem("Show Log (fifo)", "")
miShowLogFile := systray.AddMenuItem("Show Log (file)", "") miShowLogFile := systray.AddMenuItem("Show Log (file)", "")
systray.AddMenuItem("", "")
systray.AddMenuItem("", "").Disable()
app.trayItemChecksum = systray.AddMenuItem("Checksum: {...}", "") app.trayItemChecksum = systray.AddMenuItem("Checksum: {...}", "")
app.trayItemETag = systray.AddMenuItem("ETag: {...}", "") app.trayItemETag = systray.AddMenuItem("ETag: {...}", "")
app.trayItemLastModified = systray.AddMenuItem("LastModified: {...}", "") app.trayItemLastModified = systray.AddMenuItem("LastModified: {...}", "")
systray.AddMenuItem("", "")
systray.AddMenuItem("", "").Disable()
miQuit := systray.AddMenuItem("Quit", "") miQuit := systray.AddMenuItem("Quit", "")
app.trayItemChecksum.Disable()
app.trayItemETag.Disable()
app.trayItemLastModified.Disable()
app.LogDebug("SysTray initialized") app.LogDebug("SysTray initialized")
app.LogLine() app.LogLine()
@ -87,7 +95,8 @@ func (app *Application) setTrayState(txt string, icon []byte) func() {
defer app.masterLock.Unlock() defer app.masterLock.Unlock()
systray.SetIcon(icon) systray.SetIcon(icon)
systray.SetTooltip(txt) app.currSysTrayTooltip = "KPSync | " + txt
systray.SetTooltip(app.currSysTrayTooltip)
var finDone = false var finDone = false
@ -104,7 +113,7 @@ func (app *Application) setTrayState(txt string, icon []byte) func() {
} }
systray.SetIcon(assets.IconDefault) systray.SetIcon(assets.IconDefault)
app.currSysTrayTooltip = "Sleeping..." app.currSysTrayTooltip = "KPSync | " + "Sleeping..."
systray.SetTooltip(app.currSysTrayTooltip) systray.SetTooltip(app.currSysTrayTooltip)
finDone = true finDone = true
@ -122,7 +131,9 @@ func (app *Application) setTrayStateDirect(txt string, icon []byte) {
defer app.masterLock.Unlock() defer app.masterLock.Unlock()
systray.SetIcon(icon) systray.SetIcon(icon)
systray.SetTooltip(txt)
app.currSysTrayTooltip = "KPSync | " + txt
systray.SetTooltip(app.currSysTrayTooltip)
} }
func (app *Application) setTrayTooltip(txt string) { func (app *Application) setTrayTooltip(txt string) {
@ -134,6 +145,6 @@ func (app *Application) setTrayTooltip(txt string) {
defer app.masterLock.Unlock() defer app.masterLock.Unlock()
systray.SetTooltip(txt) systray.SetTooltip(txt)
app.currSysTrayTooltip = txt app.currSysTrayTooltip = "KPSync | " + txt
systray.SetTooltip(app.currSysTrayTooltip) systray.SetTooltip(app.currSysTrayTooltip)
} }

BIN
assets/icon.xcf Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 323 B

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 307 B

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 B

After

Width:  |  Height:  |  Size: 905 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 B

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 448 B

After

Width:  |  Height:  |  Size: 1.7 KiB