fix(flatpak): skip runtime checks and fix desktop entry
- Add IsFlatpak() to env package for shared detection - Skip pkg-config runtime checks when in Flatpak sandbox - Fix desktop entry to launch browser (Exec=dumber browse) - Remove unnecessary env vars from Flatpak manifest
- commit
- 444762aae74d914f27f15d8acd86128b95d11b39
- author
- bnema · · 2025-12-30 20:27 UTC
- parent
- 8af2710
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
5 files · +25 -11
M dev.bnema.Dumber.desktop +1 -1
| @@ -1,7 +1,7 @@ | |||
| 1 | 1 | [Desktop Entry] | |
| 2 | 2 | Name=Dumber | |
| 3 | 3 | Comment=A minimal keyboard-driven browser for tiling WMs | |
| 4 | - | Exec=dumber | |
| 4 | + | Exec=dumber browse | |
| 5 | 5 | Icon=dev.bnema.Dumber | |
| 6 | 6 | Terminal=false | |
| 7 | 7 | Type=Application | |
| @@ -1,7 +1,7 @@ | |||||
| 1 | [Desktop Entry] | 1 | [Desktop Entry] | ||
| 2 | Name=Dumber | 2 | Name=Dumber | ||
| 3 | Comment=A minimal keyboard-driven browser for tiling WMs | 3 | Comment=A minimal keyboard-driven browser for tiling WMs | ||
| 4 | - | Exec=dumber | 4 | + | Exec=dumber browse |
| 5 | Icon=dev.bnema.Dumber | 5 | Icon=dev.bnema.Dumber | ||
| 6 | Terminal=false | 6 | Terminal=false | ||
| 7 | Type=Application | 7 | Type=Application | ||
M dev.bnema.Dumber.yml +4 -3
| @@ -7,14 +7,15 @@ command: dumber | |||
| 7 | 7 | finish-args: | |
| 8 | 8 | # Display (Wayland only) | |
| 9 | 9 | - --socket=wayland | |
| 10 | + | # GPU rendering and hardware video decoding (VA-API) | |
| 10 | 11 | - --device=dri | |
| 11 | 12 | # Network (browser) | |
| 12 | 13 | - --share=network | |
| 13 | - | # Audio/Video playback | |
| 14 | + | # Audio/Video playback via PulseAudio | |
| 14 | 15 | - --socket=pulseaudio | |
| 15 | - | # Camera/Webcam access (for video calls) | |
| 16 | + | # Camera/Webcam access (for video calls like Zoom, Meet, etc.) | |
| 16 | 17 | - --device=all | |
| 17 | - | # Downloads | |
| 18 | + | # Downloads folder | |
| 18 | 19 | - --filesystem=xdg-download | |
| 19 | 20 | # Open local HTML files | |
| 20 | 21 | - --filesystem=home:ro | |
| @@ -7,14 +7,15 @@ command: dumber | |||||
| 7 | finish-args: | 7 | finish-args: | ||
| 8 | # Display (Wayland only) | 8 | # Display (Wayland only) | ||
| 9 | - --socket=wayland | 9 | - --socket=wayland | ||
| 10 | + | # GPU rendering and hardware video decoding (VA-API) | |||
| 10 | - --device=dri | 11 | - --device=dri | ||
| 11 | # Network (browser) | 12 | # Network (browser) | ||
| 12 | - --share=network | 13 | - --share=network | ||
| 13 | - | # Audio/Video playback | 14 | + | # Audio/Video playback via PulseAudio |
| 14 | - --socket=pulseaudio | 15 | - --socket=pulseaudio | ||
| 15 | - | # Camera/Webcam access (for video calls) | 16 | + | # Camera/Webcam access (for video calls like Zoom, Meet, etc.) |
| 16 | - --device=all | 17 | - --device=all | ||
| 17 | - | # Downloads | 18 | + | # Downloads folder |
| 18 | - --filesystem=xdg-download | 19 | - --filesystem=xdg-download | ||
| 19 | # Open local HTML files | 20 | # Open local HTML files | ||
| 20 | - --filesystem=home:ro | 21 | - --filesystem=home:ro | ||
M internal/bootstrap/gui.go +10 -0
| @@ -15,6 +15,7 @@ import ( | |||
| 15 | 15 | "github.com/bnema/dumber/internal/infrastructure/colorscheme" | |
| 16 | 16 | "github.com/bnema/dumber/internal/infrastructure/config" | |
| 17 | 17 | "github.com/bnema/dumber/internal/infrastructure/deps" | |
| 18 | + | "github.com/bnema/dumber/internal/infrastructure/env" | |
| 18 | 19 | "github.com/bnema/dumber/internal/infrastructure/media" | |
| 19 | 20 | "github.com/bnema/dumber/internal/infrastructure/persistence/sqlite" | |
| 20 | 21 | "github.com/bnema/dumber/internal/logging" | |
| @@ -185,7 +186,16 @@ func RunDeferredInit(input DeferredInitInput) DeferredInitResult { | |||
| 185 | 186 | ||
| 186 | 187 | // CheckRuntimeRequirements verifies WebKitGTK and other runtime dependencies. | |
| 187 | 188 | // Returns error if requirements are not met; caller should log details and exit. | |
| 189 | + | // Note: When running in a Flatpak sandbox, runtime checks are skipped because | |
| 190 | + | // the Flatpak runtime provides all required libraries. | |
| 188 | 191 | func CheckRuntimeRequirements(ctx context.Context, cfg *config.Config) error { | |
| 192 | + | // Skip pkg-config checks in Flatpak - the runtime provides all dependencies | |
| 193 | + | if env.IsFlatpak() { | |
| 194 | + | log := logging.FromContext(ctx) | |
| 195 | + | log.Debug().Msg("running in Flatpak sandbox, skipping runtime dependency checks") | |
| 196 | + | return nil | |
| 197 | + | } | |
| 198 | + | ||
| 189 | 199 | probe := deps.NewPkgConfigProbe() | |
| 190 | 200 | checkRuntimeUC := usecase.NewCheckRuntimeDependenciesUseCase(probe) | |
| 191 | 201 | runtimeOut, err := checkRuntimeUC.Execute(ctx, usecase.CheckRuntimeDependenciesInput{ | |
| @@ -15,6 +15,7 @@ import ( | |||||
| 15 | "github.com/bnema/dumber/internal/infrastructure/colorscheme" | 15 | "github.com/bnema/dumber/internal/infrastructure/colorscheme" | ||
| 16 | "github.com/bnema/dumber/internal/infrastructure/config" | 16 | "github.com/bnema/dumber/internal/infrastructure/config" | ||
| 17 | "github.com/bnema/dumber/internal/infrastructure/deps" | 17 | "github.com/bnema/dumber/internal/infrastructure/deps" | ||
| 18 | + | "github.com/bnema/dumber/internal/infrastructure/env" | |||
| 18 | "github.com/bnema/dumber/internal/infrastructure/media" | 19 | "github.com/bnema/dumber/internal/infrastructure/media" | ||
| 19 | "github.com/bnema/dumber/internal/infrastructure/persistence/sqlite" | 20 | "github.com/bnema/dumber/internal/infrastructure/persistence/sqlite" | ||
| 20 | "github.com/bnema/dumber/internal/logging" | 21 | "github.com/bnema/dumber/internal/logging" | ||
| @@ -185,7 +186,16 @@ func RunDeferredInit(input DeferredInitInput) DeferredInitResult { | |||||
| 185 | 186 | ||||
| 186 | // CheckRuntimeRequirements verifies WebKitGTK and other runtime dependencies. | 187 | // CheckRuntimeRequirements verifies WebKitGTK and other runtime dependencies. | ||
| 187 | // Returns error if requirements are not met; caller should log details and exit. | 188 | // Returns error if requirements are not met; caller should log details and exit. | ||
| 189 | + | // Note: When running in a Flatpak sandbox, runtime checks are skipped because | |||
| 190 | + | // the Flatpak runtime provides all required libraries. | |||
| 188 | func CheckRuntimeRequirements(ctx context.Context, cfg *config.Config) error { | 191 | func CheckRuntimeRequirements(ctx context.Context, cfg *config.Config) error { | ||
| 192 | + | // Skip pkg-config checks in Flatpak - the runtime provides all dependencies | |||
| 193 | + | if env.IsFlatpak() { | |||
| 194 | + | log := logging.FromContext(ctx) | |||
| 195 | + | log.Debug().Msg("running in Flatpak sandbox, skipping runtime dependency checks") | |||
| 196 | + | return nil | |||
| 197 | + | } | |||
| 198 | + | ||||
| 189 | probe := deps.NewPkgConfigProbe() | 199 | probe := deps.NewPkgConfigProbe() | ||
| 190 | checkRuntimeUC := usecase.NewCheckRuntimeDependenciesUseCase(probe) | 200 | checkRuntimeUC := usecase.NewCheckRuntimeDependenciesUseCase(probe) | ||
| 191 | runtimeOut, err := checkRuntimeUC.Execute(ctx, usecase.CheckRuntimeDependenciesInput{ | 201 | runtimeOut, err := checkRuntimeUC.Execute(ctx, usecase.CheckRuntimeDependenciesInput{ | ||
M internal/infrastructure/env/manager.go +8 -0
| @@ -12,6 +12,14 @@ import ( | |||
| 12 | 12 | "github.com/bnema/dumber/internal/logging" | |
| 13 | 13 | ) | |
| 14 | 14 | ||
| 15 | + | // IsFlatpak returns true if the application is running inside a Flatpak sandbox. | |
| 16 | + | // The Flatpak runtime provides all required libraries, so host pkg-config checks | |
| 17 | + | // should be skipped when running in this environment. | |
| 18 | + | func IsFlatpak() bool { | |
| 19 | + | _, err := os.Stat("/.flatpak-info") | |
| 20 | + | return err == nil | |
| 21 | + | } | |
| 22 | + | ||
| 15 | 23 | // Manager implements port.RenderingEnvManager for configuring | |
| 16 | 24 | // environment variables for GStreamer, WebKit, and GTK/GSK. | |
| 17 | 25 | type Manager struct { | |
| @@ -12,6 +12,14 @@ import ( | |||||
| 12 | "github.com/bnema/dumber/internal/logging" | 12 | "github.com/bnema/dumber/internal/logging" | ||
| 13 | ) | 13 | ) | ||
| 14 | 14 | ||||
| 15 | + | // IsFlatpak returns true if the application is running inside a Flatpak sandbox. | |||
| 16 | + | // The Flatpak runtime provides all required libraries, so host pkg-config checks | |||
| 17 | + | // should be skipped when running in this environment. | |||
| 18 | + | func IsFlatpak() bool { | |||
| 19 | + | _, err := os.Stat("/.flatpak-info") | |||
| 20 | + | return err == nil | |||
| 21 | + | } | |||
| 22 | + | ||||
| 15 | // Manager implements port.RenderingEnvManager for configuring | 23 | // Manager implements port.RenderingEnvManager for configuring | ||
| 16 | // environment variables for GStreamer, WebKit, and GTK/GSK. | 24 | // environment variables for GStreamer, WebKit, and GTK/GSK. | ||
| 17 | type Manager struct { | 25 | type Manager struct { | ||
M internal/infrastructure/updater/applier.go +2 -7
| @@ -9,6 +9,7 @@ import ( | |||
| 9 | 9 | "golang.org/x/sys/unix" | |
| 10 | 10 | ||
| 11 | 11 | "github.com/bnema/dumber/internal/infrastructure/config" | |
| 12 | + | "github.com/bnema/dumber/internal/infrastructure/env" | |
| 12 | 13 | "github.com/bnema/dumber/internal/logging" | |
| 13 | 14 | ) | |
| 14 | 15 | ||
| @@ -63,7 +64,7 @@ func (a *Applier) CanSelfUpdate(ctx context.Context) bool { | |||
| 63 | 64 | log := logging.FromContext(ctx) | |
| 64 | 65 | ||
| 65 | 66 | // Flatpak sandboxed apps should not self-update; Flatpak handles updates. | |
| 66 | - | if isFlatpak() { | |
| 67 | + | if env.IsFlatpak() { | |
| 67 | 68 | log.Debug().Msg("running in Flatpak sandbox, self-update disabled") | |
| 68 | 69 | return false | |
| 69 | 70 | } | |
| @@ -88,12 +89,6 @@ func (a *Applier) CanSelfUpdate(ctx context.Context) bool { | |||
| 88 | 89 | return true | |
| 89 | 90 | } | |
| 90 | 91 | ||
| 91 | - | // isFlatpak returns true if the application is running inside a Flatpak sandbox. | |
| 92 | - | func isFlatpak() bool { | |
| 93 | - | _, err := os.Stat("/.flatpak-info") | |
| 94 | - | return err == nil | |
| 95 | - | } | |
| 96 | - | ||
| 97 | 92 | // GetBinaryPath returns the path to the currently running binary. | |
| 98 | 93 | func (*Applier) GetBinaryPath() (string, error) { | |
| 99 | 94 | path, err := os.Executable() | |
| @@ -9,6 +9,7 @@ import ( | |||||
| 9 | "golang.org/x/sys/unix" | 9 | "golang.org/x/sys/unix" | ||
| 10 | 10 | ||||
| 11 | "github.com/bnema/dumber/internal/infrastructure/config" | 11 | "github.com/bnema/dumber/internal/infrastructure/config" | ||
| 12 | + | "github.com/bnema/dumber/internal/infrastructure/env" | |||
| 12 | "github.com/bnema/dumber/internal/logging" | 13 | "github.com/bnema/dumber/internal/logging" | ||
| 13 | ) | 14 | ) | ||
| 14 | 15 | ||||
| @@ -63,7 +64,7 @@ func (a *Applier) CanSelfUpdate(ctx context.Context) bool { | |||||
| 63 | log := logging.FromContext(ctx) | 64 | log := logging.FromContext(ctx) | ||
| 64 | 65 | ||||
| 65 | // Flatpak sandboxed apps should not self-update; Flatpak handles updates. | 66 | // Flatpak sandboxed apps should not self-update; Flatpak handles updates. | ||
| 66 | - | if isFlatpak() { | 67 | + | if env.IsFlatpak() { |
| 67 | log.Debug().Msg("running in Flatpak sandbox, self-update disabled") | 68 | log.Debug().Msg("running in Flatpak sandbox, self-update disabled") | ||
| 68 | return false | 69 | return false | ||
| 69 | } | 70 | } | ||
| @@ -88,12 +89,6 @@ func (a *Applier) CanSelfUpdate(ctx context.Context) bool { | |||||
| 88 | return true | 89 | return true | ||
| 89 | } | 90 | } | ||
| 90 | 91 | ||||
| 91 | - | // isFlatpak returns true if the application is running inside a Flatpak sandbox. | |||
| 92 | - | func isFlatpak() bool { | |||
| 93 | - | _, err := os.Stat("/.flatpak-info") | |||
| 94 | - | return err == nil | |||
| 95 | - | } | |||
| 96 | - | ||||
| 97 | // GetBinaryPath returns the path to the currently running binary. | 92 | // GetBinaryPath returns the path to the currently running binary. | ||
| 98 | func (*Applier) GetBinaryPath() (string, error) { | 93 | func (*Applier) GetBinaryPath() (string, error) { | ||
| 99 | path, err := os.Executable() | 94 | path, err := os.Executable() | ||