···11+# Switchyard Browser Extension
22+33+A companion browser extension is available that allows you to open any page in Switchyard with one click. For now, the extension uses our URI scheme under the hood. It redirects the current tab to a `switchyard://open` URL, handing off to Switchyard for browser selection.
44+55+The extension lives in the `webextension/` directory and ships as a standard WebExtension compatible with both Firefox and Chromium browsers. It is included in GitHub releases as `switchyard-webextension.zip`.
66+77+The intent is to add deeper integration with the desktop app. Eventually, it will be submitted to the Chrome Web Store and Mozilla.
+22-4
justfile
···6666flatpak:
6767 flatpak run org.flatpak.Builder --user --install --force-clean --repo=build-repo build-dir flatpak/{{APPID}}.Devel.yml
68686969+# Bundle the browser extension into a zip archive
7070+bundle-extension:
7171+ #!/usr/bin/env bash
7272+ set -euo pipefail
7373+ root="{{justfile_directory()}}"
7474+ extdir="${root}/webextension"
7575+ outfile="${root}/switchyard-webextension.zip"
7676+ rm -f "${outfile}"
7777+ cd "${extdir}" && zip -r "${outfile}" . -x '.git*'
7878+ echo "Extension bundled: switchyard-webextension.zip"
7979+6980# Cut a new release: bump version, commit, tag, and push master + tag
7081release version:
7182 #!/usr/bin/env bash
···7384 version="{{version}}"
7485 tag="v${version}"
7586 metainfo="data/{{APPID}}.metainfo.xml"
8787+ manifest="webextension/manifest.json"
76887789 if ! [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then
7890 echo "error: '$version' is not valid semver (expected X.Y.Z)" >&2
···8597 exit 1
8698 fi
87998888- # Allow src/app.go and the metainfo file to be dirty; nothing else.
8989- dirty="$(git status --porcelain -- ':!src/app.go' ":!${metainfo}")"
100100+ # Allow src/app.go, metainfo, and extension manifest to be dirty; nothing else.
101101+ dirty="$(git status --porcelain -- ':!src/app.go' ":!${metainfo}" ":!${manifest}")"
90102 if [ -n "$dirty" ]; then
9191- echo "error: working tree has changes outside src/app.go and ${metainfo}:" >&2
103103+ echo "error: working tree has changes outside src/app.go, ${metainfo}, ${manifest}:" >&2
92104 echo "$dirty" >&2
93105 exit 1
94106 fi
···110122 exit 1
111123 fi
112124113113- git add src/app.go "${metainfo}"
125125+ sed -i -E 's/^(\s*"version"\s*:\s*)"[^"]+"/\1"'"${version}"'"/' "${manifest}"
126126+ if ! grep -qE '"version"\s*:\s*"'"${version}"'"' "${manifest}"; then
127127+ echo "error: failed to update version in ${manifest}" >&2
128128+ exit 1
129129+ fi
130130+131131+ git add src/app.go "${metainfo}" "${manifest}"
114132 git commit -m "update for ${tag}"
115133 git tag -a "${tag}" -m "${tag}"
116134 git push origin master