Skip to content

02 - Add Chrome bookmark backup and restore support #1

Description

@gardusig

Summary

Implement automation for exporting and importing Chrome bookmarks.

The goal is to provide a simple shell-based solution that allows bookmarks to be backed up into the repository and restored later with minimal user interaction.

This feature is intended for personal backup and synchronization workflows.


Goals

  • Implement using POSIX shell (.sh)
  • Avoid Python unless absolutely necessary
  • Support macOS as the primary platform
  • Keep implementation simple and transparent
  • Store exported bookmarks inside the repository
  • Allow restoring bookmarks from a previously exported file

Folder structure

scripts/

    chrome/

        export-bookmarks.sh

        import-bookmarks.sh

        wait-download.sh

data/

    bookmarks/

        bookmarks.html

Export workflow

close chrome (optional)

↓

open bookmark manager

↓

navigate to

Bookmarks Manager

↓

open overflow menu

↓

Export Bookmarks

↓

wait for download

↓

move downloaded html

↓

data/bookmarks/bookmarks.html

Import workflow

verify bookmarks.html exists

↓

open bookmark manager

↓

open overflow menu

↓

Import Bookmarks

↓

select bookmarks.html

↓

wait until completed

↓

done

Assumptions

  • User is already logged into Chrome
  • User uses the default Downloads directory
  • User has permission to automate Chrome
  • User can grant Accessibility permissions if required
  • Existing bookmarks may be merged by Chrome

The script does not attempt to manage synchronization conflicts.


Script responsibilities

export-bookmarks.sh

  • Open Chrome if necessary
  • Open the bookmark manager page
  • Trigger bookmark export
  • Wait until an HTML file appears in Downloads
  • Move the exported file to:
data/bookmarks/bookmarks.html
  • Replace the previous backup if one exists

import-bookmarks.sh

  • Verify backup exists
data/bookmarks/bookmarks.html
  • Open Chrome bookmark manager
  • Trigger bookmark import
  • Select the backup file
  • Wait for completion
  • Exit successfully

wait-download.sh

Utility script responsible for polling the Downloads directory.

Pseudo workflow:

loop

    if newest html file exists

        return path

    sleep 1

timeout after configurable period

Future improvements

  • Timestamped bookmark backups
bookmarks/

    2026-06-10.html

    2026-07-01.html

    latest.html
  • Compression into archive
bookmarks.zip
  • Automatic diff between backups

  • Restore specific snapshot

  • Multiple Chrome profiles

Default

Work

Personal
  • Chromium support

  • Brave support

  • Arc support


CLI

./scripts/chrome/export-bookmarks.sh

./scripts/chrome/import-bookmarks.sh

Later these can be wrapped by:

shuttle bookmarks export

shuttle bookmarks import

Definition of done

  • Export script creates data/bookmarks/bookmarks.html
  • Import script restores from data/bookmarks/bookmarks.html
  • Scripts are idempotent
  • Existing backup is overwritten safely
  • Errors are handled gracefully
  • Timeouts prevent infinite waiting
  • Scripts are documented and runnable from a fresh clone

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status
    done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions