Adding Browsers
This document explains how to add support for new browsers to the gosuki project, focusing on Chromium-based and Firefox-based browsers. It covers locating browser data directories, modifying code for package-specific paths, and verifying functionality.
This will require build dependencies and minimal knowledge of building the GoSuki from the source code.
Available Browser Families
The following browser families are currently supported:
Family | Example Browsers | Notes |
---|---|---|
ChromeBased |
Chrome, Chromium, Edge | Uses ChromeBrowser definition |
Mozilla |
Firefox, Librewolf | Uses MozBrowser definition |
Qutebrowser |
Qutebrowser | Uses manual definition |
These families are defined in pkg/browsers/base.go
and configured in platform-specific files (defined_linux.go
, defined_darwin.go
).
Adding a Firefox-Based Browser
Example: Adding Mozilla Firefox Support
Edit defined_linux.go
or defined_darwin.go
Add a new entry for Firefox with paths for default, snap, and flatpak installations:
Firefox = MozBrowser(
"firefox", // Browser name (will be used as module ID)
"~/.mozilla/firefox", // Default path
"~/snap/firefox/common/.mozilla/firefox", // Snap path
"~/.var/app/org.mozilla.firefox/.mozilla/firefox", // Flatpak path
)
"/nonexistent"
if a snap or flatpak is not available for your browser.Verify Paths
After installing Firefox, locate its data directory:
- Default:
~/.mozilla/firefox
- Snap:
~/snap/firefox/common/.mozilla/firefox
- Flatpak:
~/.var/app/org.mozilla.firefox/.mozilla/firefox
Testing
- Run Firefox and add a bookmark
firefox --profile-manager # To check/create new profiles
- Check that gosuki detects the browser module
go run ./cmd/gosuki --debug=0 profile detect
output
loading 6 modules ...
detected browsers:
chrome /home/spike/.config/google-chrome
chromium /home/spike/.config/chromium
firefox /home/spike/.mozilla/firefox
librewolf /home/spike/.librewolf
qutebrowser /home/spike/.config/qutebrowser
At this step
- Build and Run: assuming you are at the root of the project repo.
go run ./cmd/gosuki --debug=0 --tui start
--debug=0
to reduce clutter and spot the new browser module.- Add a bookmark on Firefox, it should be automatically captured by GoSuki.
- Check on the webui , your bookmark should appear in the results
Example for Brave (Chrome based browser)
Chrome = ChromeBrowser(
"brave",
"~/.config/BraveSoftware/Brave-Browser",
"~/snap/brave/current/.config/BraveSoftware/Brave-Browser",
"~/.var/app/com.brave.Browser/config/BraveSoftware/Brave-Browser",
)
Manual Browser Definition Example
Manual Browser Definition
If a browser does not fit the standard MozBrowser
or ChromeBrowser
patterns, you can define it manually:
// Define a new browser manually
var MyBrowser = BrowserDef{
Name: "mybrowser",
Family: {BrowserFamily}
baseDir: "~/.mybrowser",
snapDir: "~/snap/mybrowser/common/.config/mybrowser", // or "/nonexistent"
flatDir: "~/.var/app/org.mybrowser/config/mybrowser", // or "/nonexistent"
}
// Add to the list of defined browsers
DefinedBrowsers = append(DefinedBrowsers, MyBrowser)
This approach is useful for custom or niche browsers that lack standard installation paths.
Finding the Base Directory
This is a manual step. After installing a browser, locate its data directory where it stores bookmarks and profiles:
Linux
- Default: Usually in
~/.<browser>
or~/.config/<browser>
(e.g.,~/.mozilla/firefox
) - Snap:
~/snap/<browser>/common/<subdir>
- Flatpak:
~/.var/app/<bundle-id>/<subdir>
macOS
- Default:
~/Library/Application Support/<browser>
Example: For Firefox, look for .mozilla
in your home directory.
Detection Logic
The detection logic is handled in platform-specific files:
- Linux:
pkg/browsers/basedir_linux.go
- macOS:
pkg/browsers/basedir_darwin.go
Do not modify detection logic unless:
- The package type (snap/flatpak) does not exist for the browser
- You need to extend the
BrowserDef
struct (e.g., add new fields for custom paths)
Note: The BrowserDef
struct in pkg/browsers/base.go
defines how browsers are detected and configured.
- Always test new browser additions by running the browser and verifying bookmark synchronization with gosuki.