powerful but friendly backup program that runs in your tray, powered by restic devins.page/restray
go restic system-tray
2

Configure Feed

Select the types of activity you want to include in your feed.

refactor: use humanize lib for formatsize

might as well since we already have the library available

intergrav (Jul 2, 2026, 3:40 AM EDT) 620ebc26 1e9906d6

+2 -14
+2 -14
cmd/restray/operations.go
··· 15 15 "time" 16 16 17 17 "fyne.io/systray" 18 + "github.com/dustin/go-humanize" 18 19 "github.com/gen2brain/beeep" 19 20 ) 20 21 ··· 98 99 return msg, err 99 100 } 100 101 101 - func formatSize(sz uint64) string { 102 - switch { 103 - case sz >= 1e9: 104 - return fmt.Sprintf("%.1f GB", float64(sz)/1e9) 105 - case sz >= 1e6: 106 - return fmt.Sprintf("%.1f MB", float64(sz)/1e6) 107 - case sz >= 1e3: 108 - return fmt.Sprintf("%.0f KB", float64(sz)/1e3) 109 - default: 110 - return fmt.Sprintf("%d bytes", sz) 111 - } 112 - } 113 - 114 102 func doBackupOnce(key profileKey, mStatus prefixedMenuItem, prof Profile, args []string) (bool, int) { 115 103 cmd := resticCmd(prof, args...) 116 104 stdoutPipe, _ := cmd.StdoutPipe() ··· 145 133 switch { 146 134 case msg.Total > 0: 147 135 mStatus.SetTitle(fmt.Sprintf("%d%% completed, %s of %s", 148 - int(msg.Percent*100), formatSize(msg.Bytes), formatSize(msg.Total))) 136 + int(msg.Percent*100), humanize.Bytes(msg.Bytes), humanize.Bytes(msg.Total))) 149 137 case msg.TotalFiles > 0: 150 138 mStatus.SetTitle(fmt.Sprintf("Scanning: %d / %d files", 151 139 msg.FilesDone, msg.TotalFiles))