dotfiles/.local/bin/gnome-shell-extension-forge-install

49 lines
1.1 KiB
Shell
Executable file

#!/bin/sh
# Install `forge` from source into the same place that
# https://extensions.gnome.org/extension/4481/forge/ would use
#
# The released version may break "window-toggle-float"
# (see https://github.com/forge-ext/forge/issues/492)
# and is not maintained at the moment
#
# A re-login is required afterwards,
# because `gnome-shell` only scans the extensions directory on startup
set -eu
_UUID=forge@jmmaranan.com
_REPO=https://github.com/forge-ext/forge.git
_TARGET="${XDG_DATA_HOME:-$HOME/.local/share}/gnome-shell/extensions/$_UUID"
for _tool in git make glib-compile-schemas msgfmt xgettext; do
command -v "$_tool" >/dev/null || {
echo "ERROR: $_tool is missing (try: apt install git make libglib2.0-bin gettext)" >&2
exit 1
}
done
_workdir=$(mktemp -d)
trap 'rm -rf "$_workdir"' EXIT
git clone --depth 1 "$_REPO" "$_workdir"
_commit=$(git -C "$_workdir" rev-parse --short HEAD)
make -C "$_workdir" build
rm -rf "$_TARGET"
make -C "$_workdir" install
echo "Installed $_UUID from $_commit into $_TARGET"
echo "Log out and back in, then: gnome-extensions enable $_UUID"