Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkgbuilds/slap-notes-bin/.omarchy/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"source": "local",
"release_ring": "fast"
}
41 changes: 41 additions & 0 deletions pkgbuilds/slap-notes-bin/.omarchy/upstream.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash
# Slap Notes publishes SHA256SUMS beside every release, so the new version and
# its checksum both come from the release feed and nothing has to be downloaded
# to hash it.
set -euo pipefail

REPO="Onefailatatime/slap-notes"

release=$(curl -fsSL -H 'Accept: application/vnd.github+json' \
"https://api.github.com/repos/${REPO}/releases/latest")
version=$(jq -r '.tag_name // ""' <<<"$release" | sed 's/^v//')

if [[ -z "$version" ]]; then
echo "Upstream feed carried no version" >&2
exit 1
fi

current=$(awk -F= '/^pkgver=/ { print $2; exit }' PKGBUILD)
if [[ -n "$current" ]] && [[ "$(vercmp "$version" "$current")" -le 0 ]]; then
echo '{}'
exit 0
fi

asset="slap-notes-${version}-linux-x64.tar.zst"

# The checksums file is published with the release, so a rename upstream shows
# up as a missing line here rather than as a checksum pinned to a URL that will
# never be fetched.
sums=$(curl -fsSL "https://github.com/${REPO}/releases/download/${version}/SHA256SUMS")
sha256=$(awk -v a="$asset" '$2 == a { print $1; exit }' <<<"$sums")

if [[ -z "$sha256" ]]; then
echo "Release ${version} has no checksum for ${asset}" >&2
exit 1
fi

# The key names the PKGBUILD array to rewrite: the vendor tarball lives in
# source_x86_64/sha256sums_x86_64, leaving the launcher's own plain sha256sums
# alone.
jq -n --arg pkgver "$version" --arg sha256 "$sha256" \
'{pkgver: $pkgver, sha256sums: {x86_64: [$sha256]}}'
88 changes: 88 additions & 0 deletions pkgbuilds/slap-notes-bin/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Maintainer: FunnelFix <linda@sayhellotolinda.com>

# Slap Notes publishes a plain Electron tree rather than an AppImage, so this
# repackages the vendor tarball as-is. .omarchy/upstream.sh rewrites the version
# and checksum below from the release feed the app updates itself from.

pkgname=slap-notes-bin
_appname=slap-notes
pkgver=0.2.3
pkgrel=1
pkgdesc="Local-first block notes with a wiki-link graph and a built-in AI research agent"
arch=('x86_64')
url="https://slapnotes.com"
license=('LicenseRef-proprietary')
depends=(
'alsa-lib'
'at-spi2-core'
'cairo'
'dbus'
'expat'
'gcc-libs'
'glib2'
'glibc'
'gtk3'
'hicolor-icon-theme'
'libcups'
'libdrm'
# Both are opened by name at runtime rather than linked, so nothing else in
# this list pulls them in: libnotify carries desktop notifications and
# libsecret backs Electron's encrypted storage.
'libnotify'
'libsecret'
'libx11'
'libxcb'
'libxcomposite'
'libxdamage'
'libxext'
'libxfixes'
'libxkbcommon'
'libxrandr'
'mesa'
'nspr'
'nss'
'pango'
'systemd-libs'
'xdg-utils'
)
provides=("${_appname}=${pkgver}")
conflicts=("${_appname}")
replaces=("${_appname}")
# Electron ships prebuilt binaries: stripping them breaks the bundle.
options=('!strip' '!debug')
install="${pkgname}.install"
_tarball="${_appname}-${pkgver}-linux-x64.tar.zst"
source=("${_appname}-launcher.sh")
source_x86_64=("${pkgname}-${pkgver}.tar.zst::https://github.com/Onefailatatime/slap-notes/releases/download/${pkgver}/${_tarball}")
sha256sums=('9d208c06717906b74c41874bdd3fdba0f0dc5b31d239ae00d19472e6eab2ea29')
sha256sums_x86_64=('56cb7606f41051ba10d088ed8e1ae85a17b20692f4b45c0c6a6e6cec6669a5e2')

package() {
cd "${srcdir}/${_appname}-${pkgver}"

install -dm755 "${pkgdir}/opt/${_appname}"
cp -a app/. "${pkgdir}/opt/${_appname}/"
chmod -R a+rX "${pkgdir}/opt/${_appname}"

# Arch ships Chromium's and Electron's own sandbox helper setuid, which is
# what keeps the sandbox up on a kernel that denies unprivileged user
# namespaces -- linux-hardened, mainly -- instead of aborting the app.
chmod 4755 "${pkgdir}/opt/${_appname}/chrome-sandbox"

install -Dm755 "${srcdir}/${_appname}-launcher.sh" "${pkgdir}/usr/bin/${_appname}"

# Upstream's entry points straight into /opt, which would step around the
# launcher and hand every desktop-started window to XWayland.
sed -e "s|^Exec=.*|Exec=${_appname} %U|" "${_appname}.desktop" \
> "${srcdir}/${_appname}.desktop.arch"
install -Dm644 "${srcdir}/${_appname}.desktop.arch" \
"${pkgdir}/usr/share/applications/${_appname}.desktop"

local size
for size in 16 32 48 64 128 256 512 1024; do
install -Dm644 "icons/${size}.png" \
"${pkgdir}/usr/share/icons/hicolor/${size}x${size}/apps/${_appname}.png"
done

install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
12 changes: 12 additions & 0 deletions pkgbuilds/slap-notes-bin/slap-notes-bin.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
post_install() {
cat <<'MSG'
Slap Notes keeps your notes on this machine:
~/.config/slap-notes app data (notes live here)
~/.config/slap-notes/workspace.json plain-JSON copy of your vault

Extra Chromium flags go in ~/.config/slap-notes-flags.conf, one per line.

The top bar auto-hides -- move the cursor to the top edge to bring it back.
Press Alt for the window menu.
MSG
}
32 changes: 32 additions & 0 deletions pkgbuilds/slap-notes-bin/slap-notes-launcher.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
set -euo pipefail

user_flags=()
config_home="${XDG_CONFIG_HOME:-}"
[[ -n "$config_home" || -z "${HOME:-}" ]] || config_home="$HOME/.config"
flags_file="${config_home:+$config_home/slap-notes-flags.conf}"

if [[ -n "$flags_file" && -f "$flags_file" && -r "$flags_file" ]]; then
while IFS= read -r line || [[ -n "$line" ]]; do
line="${line%%#*}"
[[ -n "${line//[[:space:]]/}" ]] || continue
read -r -a flags <<<"$line"
user_flags+=("${flags[@]}")
done <"$flags_file"
fi

# Chromium's own Ozone detection falls back to XWayland often enough to matter,
# and the result is a blurry window on every scaled display. Ask for Wayland
# directly, unless the user has already picked a platform themselves.
platform_flags=()
if [[ -n "${WAYLAND_DISPLAY:-}" || "${XDG_SESSION_TYPE:-}" == wayland ]]; then
platform_flags=(--ozone-platform=wayland)

for flag in "${user_flags[@]}" "$@"; do
case "$flag" in
--ozone-platform=* | --ozone-platform-hint=*) platform_flags=() ;;
esac
done
fi

exec /opt/slap-notes/slap-notes "${platform_flags[@]}" "${user_flags[@]}" "$@"