summaryrefslogtreecommitdiff
path: root/internal/gui/app.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-07-19 23:35:44 +0300
committerPaul Buetow <paul@buetow.org>2025-07-19 23:35:44 +0300
commit6038d6e29d4878cccb46bf35bb9885ec7d376422 (patch)
treef7861a731ba20db54e4ca578d6cd586ad8a87ab0 /internal/gui/app.go
parent3a6c690230f769ad33bc26e2fc5d5662e38fe3d6 (diff)
feat: improve flashcard storage and audio regenerationv0.6.0
- Change default card storage from ~/Downloads to ~/.local/state/totalrecall/cards/ - Keep .apkg exports in ~/Downloads for user convenience - Fix audio regeneration to use random voice and speed (0.9-1.0) - Fix GNOME dock icon by updating StartupWMClass to "Totalrecall" - Fix navigation to properly find cards in new XDG state directory - Ensure config defaults are properly filled when using GUI mode - Bump version to 0.6.0 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'internal/gui/app.go')
-rw-r--r--internal/gui/app.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/internal/gui/app.go b/internal/gui/app.go
index 4e70970..3e256b8 100644
--- a/internal/gui/app.go
+++ b/internal/gui/app.go
@@ -100,7 +100,8 @@ type Config struct {
// DefaultConfig returns default GUI configuration
func DefaultConfig() *Config {
homeDir, _ := os.UserHomeDir()
- outputDir := filepath.Join(homeDir, "Downloads")
+ // Use XDG Base Directory specification for state data
+ outputDir := filepath.Join(homeDir, ".local", "state", "totalrecall", "cards")
return &Config{
OutputDir: outputDir,
@@ -113,6 +114,18 @@ func DefaultConfig() *Config {
func New(config *Config) *Application {
if config == nil {
config = DefaultConfig()
+ } else {
+ // Fill in missing fields with defaults
+ defaults := DefaultConfig()
+ if config.OutputDir == "" {
+ config.OutputDir = defaults.OutputDir
+ }
+ if config.AudioFormat == "" {
+ config.AudioFormat = defaults.AudioFormat
+ }
+ if config.ImageProvider == "" {
+ config.ImageProvider = defaults.ImageProvider
+ }
}
// Ensure output directory exists