Rules-based browser launcher for TUI + GNOME. switchyard.aly.codes
tui gnome bowser go
0

Configure Feed

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

launch: fix launching incognito modes in chromium browsers with semi-broken desktop files

Aly Raffauf (Jan 25, 2026, 10:02 PM EST) fa148f73 9de8a1b8

+10
+10
src/launch.go
··· 14 14 // launchCommand executes a desktop file command line with URL substitution 15 15 // and proper activation token handling for window raising on Wayland. 16 16 func launchCommand(cmdline, url string, appInfo *gio.AppInfo) error { 17 + hasFieldCode := strings.Contains(cmdline, "%u") || 18 + strings.Contains(cmdline, "%U") || 19 + strings.Contains(cmdline, "%f") || 20 + strings.Contains(cmdline, "%F") 21 + 17 22 // Replace %u, %U, %f, %F with URL 18 23 cmdline = strings.ReplaceAll(cmdline, "%u", url) 19 24 cmdline = strings.ReplaceAll(cmdline, "%U", url) ··· 27 32 28 33 // Parse the command line 29 34 parts := strings.Fields(cmdline) 35 + 36 + // Chromium-based desktop files are essentially broken, they include no logic for a URL to pass using typical means. In this case, we work aorund by appending our URL. 37 + if !hasFieldCode && url != "" && len(parts) > 0 { 38 + parts = append(parts, url) 39 + } 30 40 if len(parts) == 0 { 31 41 return nil 32 42 }