Compare commits
12 Commits
v0.1.0-alp
...
v0.1.0-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
40fda06dbd | ||
|
|
694711ea07 | ||
|
|
2efebfdce8 | ||
|
|
02942f421a | ||
|
|
fd2186b14b | ||
|
|
2a4e13c58d | ||
|
|
33d8d1b64b | ||
|
|
5b849f9820 | ||
|
|
1c3d0a5320 | ||
|
|
97b0e0bf1e | ||
|
|
29ab78799c | ||
|
|
3b745dfba1 |
91
.github/workflows/aur-publish.yml
vendored
Executable file
91
.github/workflows/aur-publish.yml
vendored
Executable file
@@ -0,0 +1,91 @@
|
||||
name: Publish to AUR
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Tag to publish to AUR (e.g. v0.1.0-alpha.8)"
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
aur-publish:
|
||||
name: Publish deskify-bin
|
||||
runs-on: ubuntu-latest
|
||||
container: archlinux:latest
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pacman -Syu --noconfirm
|
||||
pacman -S --noconfirm --needed base-devel git openssh curl
|
||||
useradd -m -u 1000 builder || true
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.tag || github.ref_name }}
|
||||
|
||||
- name: Generate PKGBUILD (deskify-bin)
|
||||
run: bash packaging/generate-pkgbuild-bin.sh "${{ inputs.tag || github.ref_name }}"
|
||||
|
||||
- name: Generate .SRCINFO
|
||||
run: |
|
||||
rm -rf /home/builder/work
|
||||
mkdir -p /home/builder/work
|
||||
cp -R . /home/builder/work
|
||||
chown -R builder:builder /home/builder/work
|
||||
su - builder -c "cd /home/builder/work/packaging && makepkg --printsrcinfo > .SRCINFO"
|
||||
cp /home/builder/work/packaging/.SRCINFO packaging/.SRCINFO
|
||||
|
||||
- name: Configure SSH for AUR
|
||||
env:
|
||||
AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
||||
run: |
|
||||
test -n "${AUR_SSH_PRIVATE_KEY}" || { echo "Missing secret: AUR_SSH_PRIVATE_KEY" >&2; exit 1; }
|
||||
mkdir -p ~/.ssh
|
||||
chmod 700 ~/.ssh
|
||||
printf "%s\n" "${AUR_SSH_PRIVATE_KEY}" > ~/.ssh/aur
|
||||
chmod 600 ~/.ssh/aur
|
||||
touch ~/.ssh/known_hosts
|
||||
chmod 600 ~/.ssh/known_hosts
|
||||
# Ensure host key is present for non-interactive git/ssh.
|
||||
ssh-keyscan -t rsa,ecdsa,ed25519 aur.archlinux.org >> ~/.ssh/known_hosts 2>/dev/null
|
||||
cat >> ~/.ssh/config <<'EOF'
|
||||
Host aur.archlinux.org
|
||||
User aur
|
||||
IdentityFile ~/.ssh/aur
|
||||
IdentitiesOnly yes
|
||||
EOF
|
||||
|
||||
- name: Publish to AUR (deskify-bin)
|
||||
env:
|
||||
AUR_USERNAME: ${{ secrets.AUR_USERNAME }}
|
||||
AUR_EMAIL: ${{ secrets.AUR_EMAIL }}
|
||||
run: |
|
||||
export GIT_SSH_COMMAND="ssh -i ~/.ssh/aur -o IdentitiesOnly=yes -o UserKnownHostsFile=$HOME/.ssh/known_hosts -o StrictHostKeyChecking=yes"
|
||||
|
||||
git config --global user.name "${AUR_USERNAME:-deskify-bot}"
|
||||
git config --global user.email "${AUR_EMAIL:-noreply@example.invalid}"
|
||||
|
||||
rm -rf /tmp/aur-repo
|
||||
git clone ssh://aur@aur.archlinux.org/deskify-bin.git /tmp/aur-repo
|
||||
|
||||
cp packaging/PKGBUILD /tmp/aur-repo/PKGBUILD
|
||||
cp packaging/.SRCINFO /tmp/aur-repo/.SRCINFO
|
||||
|
||||
cd /tmp/aur-repo
|
||||
if git diff --quiet; then
|
||||
echo "No changes to publish."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git add PKGBUILD .SRCINFO
|
||||
git commit -m "Update deskify-bin to ${{ inputs.tag || github.ref_name }}"
|
||||
git push
|
||||
18
README.md
18
README.md
@@ -192,6 +192,16 @@ Notes:
|
||||
- The `tauri` backend still requires Tauri/WebKitGTK system dependencies to build wrappers locally.
|
||||
- The `chromium` backend does not require Tauri prerequisites (but it requires an installed Chromium-based browser).
|
||||
|
||||
### Arch Linux (AUR)
|
||||
|
||||
An AUR package is available (prebuilt binary package):
|
||||
|
||||
```bash
|
||||
yay -S deskify-bin
|
||||
```
|
||||
|
||||
⚠️ The AUR package tracks **alpha** tags (`v0.1.0-alpha.N`). Expect occasional breaking changes during early development.
|
||||
|
||||
### Option B: Build from source (Tauri mode)
|
||||
|
||||
### 1. System Dependencies
|
||||
@@ -352,6 +362,14 @@ Note for Chromium backend:
|
||||
|
||||
- `--no-decorations` is best-effort and may be ignored by the browser/window manager.
|
||||
- `--width` and `--height` are applied together (`--window-size`) only when both are provided.
|
||||
- Deskify auto-detects a Chromium-based browser from `PATH`, but some distros ship Chromium-based browser commands (Chrome/Chromium/Brave, etc.) as wrapper scripts or use different binary names/paths (for example on BigLinux). If launches fail, set `--browser-bin` to a real browser binary.
|
||||
|
||||
Troubleshooting (find the real browser binary):
|
||||
|
||||
```bash
|
||||
command -v chrome chromium google-chrome google-chrome-stable brave-browser 2>/dev/null
|
||||
ls -la /usr/bin/chrome /usr/bin/chromium /usr/bin/google-chrome /usr/bin/google-chrome-stable 2>/dev/null
|
||||
```
|
||||
|
||||
### Managing Apps (`list` & `remove`)
|
||||
You can view all applications generated by `deskify`:
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
pkgname=deskify-bin
|
||||
pkgver=0.1.0_alpha.6
|
||||
pkgver=0.1.0.alpha.8
|
||||
pkgrel=1
|
||||
pkgdesc="Turn websites into Linux desktop apps (prebuilt binary package)"
|
||||
arch=('x86_64')
|
||||
url="https://github.com/spalencsar/deskify"
|
||||
license=('MIT')
|
||||
depends=('glibc')
|
||||
optdepends=('chromium: for --backend chromium')
|
||||
provides=('deskify')
|
||||
conflicts=('deskify')
|
||||
|
||||
_tag="v0.1.0-alpha.6"
|
||||
_tag="v0.1.0-alpha.8"
|
||||
source=("deskify::https://github.com/spalencsar/deskify/releases/download/${_tag}/deskify-linux-x86_64"
|
||||
"LICENSE::https://raw.githubusercontent.com/spalencsar/deskify/${_tag}/LICENSE")
|
||||
|
||||
sha256sums=('6962571579b32fcf3119d0d749770b584ce57ef1efe4feea8813314d2ed61d7a'
|
||||
sha256sums=('7ab62ff193c2666983c72844c13f368a0ecc1fcd6da40fe95f544c9999e05f30'
|
||||
'd4e53458cd2dd461f234186497b6d9b21566c477737a4d31fa6f018ef610486f')
|
||||
|
||||
package() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## AUR package template (manual)
|
||||
## AUR package template (manual + CI)
|
||||
|
||||
This folder contains a minimal `PKGBUILD` template for a future AUR package:
|
||||
|
||||
@@ -9,7 +9,7 @@ Notes:
|
||||
- Update `_tag` and `pkgver` when you publish a new release tag.
|
||||
- Update `sha256sums` to match the release asset + LICENSE for that tag.
|
||||
|
||||
Local build test:
|
||||
### Local build test
|
||||
|
||||
```bash
|
||||
cd packaging
|
||||
@@ -19,8 +19,51 @@ makepkg -sf
|
||||
To compute sha256 sums for a tag:
|
||||
|
||||
```bash
|
||||
TAG="v0.1.0-alpha.6"
|
||||
TAG="v0.1.0-alpha.7"
|
||||
curl -fL -o /tmp/deskify-linux-x86_64 "https://github.com/spalencsar/deskify/releases/download/${TAG}/deskify-linux-x86_64"
|
||||
curl -fL -o /tmp/LICENSE "https://raw.githubusercontent.com/spalencsar/deskify/${TAG}/LICENSE"
|
||||
sha256sum /tmp/deskify-linux-x86_64 /tmp/LICENSE
|
||||
```
|
||||
|
||||
### Manual AUR publish (first time)
|
||||
|
||||
1. Create an AUR account and submit the `deskify-bin` package once via the AUR web UI.
|
||||
2. Configure SSH for AUR and test connectivity.
|
||||
3. Clone the AUR repo, copy `PKGBUILD` and `.SRCINFO`, then push.
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
ssh-keygen -t ed25519 -f ~/.ssh/aur -C "deskify-aur"
|
||||
# Add ~/.ssh/aur.pub to: aur.archlinux.org -> My Account -> SSH Keys
|
||||
|
||||
cat >> ~/.ssh/config <<'EOF'
|
||||
Host aur.archlinux.org
|
||||
IdentityFile ~/.ssh/aur
|
||||
User aur
|
||||
EOF
|
||||
|
||||
ssh -T aur@aur.archlinux.org
|
||||
|
||||
git clone ssh://aur@aur.archlinux.org/deskify-bin.git
|
||||
cd deskify-bin
|
||||
|
||||
cp /path/to/deskify/packaging/PKGBUILD .
|
||||
makepkg --printsrcinfo > .SRCINFO
|
||||
|
||||
git add PKGBUILD .SRCINFO
|
||||
git commit -m "Initial release: deskify-bin"
|
||||
git push
|
||||
```
|
||||
|
||||
### CI publish on tags
|
||||
|
||||
This repo includes a workflow that publishes `deskify-bin` on tag pushes (`v*`):
|
||||
|
||||
- `.github/workflows/aur-publish.yml`
|
||||
|
||||
Required GitHub secrets:
|
||||
|
||||
- `AUR_SSH_PRIVATE_KEY` (private key content for the AUR account)
|
||||
- `AUR_USERNAME` (optional, used for git commits)
|
||||
- `AUR_EMAIL` (optional, used for git commits)
|
||||
|
||||
73
packaging/generate-pkgbuild-bin.sh
Executable file
73
packaging/generate-pkgbuild-bin.sh
Executable file
@@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
TAG="${1:-}"
|
||||
if [[ -z "${TAG}" ]]; then
|
||||
TAG="$(git describe --tags --abbrev=0)"
|
||||
fi
|
||||
|
||||
if [[ "${TAG}" != v* ]]; then
|
||||
echo "Error: expected tag like v0.1.0-alpha.7, got: ${TAG}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION="${TAG#v}"
|
||||
|
||||
# Arch PKGBUILD pkgver must not contain '-'. Use dots instead.
|
||||
PKGVER="${VERSION//-/.}"
|
||||
|
||||
ASSET_URL="https://github.com/spalencsar/deskify/releases/download/${TAG}/deskify-linux-x86_64"
|
||||
LICENSE_URL="https://raw.githubusercontent.com/spalencsar/deskify/${TAG}/LICENSE"
|
||||
|
||||
tmp_dir="$(mktemp -d)"
|
||||
trap 'rm -rf "${tmp_dir}"' EXIT
|
||||
|
||||
asset_path="${tmp_dir}/deskify-linux-x86_64"
|
||||
license_path="${tmp_dir}/LICENSE"
|
||||
|
||||
wait_seconds="${WAIT_FOR_ASSET_SECONDS:-300}"
|
||||
interval_seconds="${WAIT_FOR_ASSET_INTERVAL_SECONDS:-5}"
|
||||
deadline=$((SECONDS + wait_seconds))
|
||||
|
||||
while ! curl -fsI "${ASSET_URL}" >/dev/null 2>&1; do
|
||||
if (( SECONDS >= deadline )); then
|
||||
echo "Error: release asset not available yet: ${ASSET_URL}" >&2
|
||||
echo "Tip: the GitHub Release workflow may still be building. Re-run the AUR workflow once the asset exists." >&2
|
||||
exit 1
|
||||
fi
|
||||
sleep "${interval_seconds}"
|
||||
done
|
||||
|
||||
curl -fL -o "${asset_path}" "${ASSET_URL}"
|
||||
curl -fL -o "${license_path}" "${LICENSE_URL}"
|
||||
|
||||
ASSET_SHA256="$(sha256sum "${asset_path}" | awk '{print $1}')"
|
||||
LICENSE_SHA256="$(sha256sum "${license_path}" | awk '{print $1}')"
|
||||
|
||||
cat > packaging/PKGBUILD <<EOF
|
||||
pkgname=deskify-bin
|
||||
pkgver=${PKGVER}
|
||||
pkgrel=1
|
||||
pkgdesc="Turn websites into Linux desktop apps (prebuilt binary package)"
|
||||
arch=('x86_64')
|
||||
url="https://github.com/spalencsar/deskify"
|
||||
license=('MIT')
|
||||
depends=('glibc')
|
||||
optdepends=('chromium: for --backend chromium')
|
||||
provides=('deskify')
|
||||
conflicts=('deskify')
|
||||
|
||||
_tag="${TAG}"
|
||||
source=("deskify::https://github.com/spalencsar/deskify/releases/download/\${_tag}/deskify-linux-x86_64"
|
||||
"LICENSE::https://raw.githubusercontent.com/spalencsar/deskify/\${_tag}/LICENSE")
|
||||
|
||||
sha256sums=('${ASSET_SHA256}'
|
||||
'${LICENSE_SHA256}')
|
||||
|
||||
package() {
|
||||
install -Dm755 "\${srcdir}/deskify" "\${pkgdir}/usr/bin/deskify"
|
||||
install -Dm644 "\${srcdir}/LICENSE" "\${pkgdir}/usr/share/licenses/\${pkgname}/LICENSE"
|
||||
}
|
||||
EOF
|
||||
|
||||
echo "Wrote packaging/PKGBUILD for ${TAG}"
|
||||
70
src/main.rs
70
src/main.rs
@@ -26,6 +26,7 @@ enum Backend {
|
||||
)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
enum ProfileScope {
|
||||
#[serde(alias = "default")]
|
||||
Isolated,
|
||||
Shared,
|
||||
}
|
||||
@@ -264,9 +265,17 @@ fn read_app_config(id: &str) -> Result<Option<DeskifyAppConfig>> {
|
||||
}
|
||||
let content = fs::read_to_string(&path)
|
||||
.with_context(|| format!("Failed to read app config {}", path.display()))?;
|
||||
let cfg: DeskifyAppConfig =
|
||||
serde_json::from_str(&content).context("Failed to parse app config JSON")?;
|
||||
Ok(Some(cfg))
|
||||
match serde_json::from_str::<DeskifyAppConfig>(&content) {
|
||||
Ok(cfg) => Ok(Some(cfg)),
|
||||
Err(err) => {
|
||||
eprintln!(
|
||||
"Warning: Failed to parse app config {} ({}). Falling back to desktop entry metadata.",
|
||||
path.display(),
|
||||
err
|
||||
);
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn write_app_config_from_args(args: &BuildArgs) -> Result<()> {
|
||||
@@ -396,10 +405,37 @@ fn find_binary_in_path(name: &str) -> Option<PathBuf> {
|
||||
None
|
||||
}
|
||||
|
||||
fn chromium_binary_works(path: &Path) -> Result<()> {
|
||||
let output = Command::new(path)
|
||||
.arg("--version")
|
||||
.output()
|
||||
.with_context(|| format!("Failed to execute browser binary {}", path.display()))?;
|
||||
if output.status.success() {
|
||||
return Ok(());
|
||||
}
|
||||
let stderr = String::from_utf8_lossy(&output.stderr).trim().to_string();
|
||||
let stdout = String::from_utf8_lossy(&output.stdout).trim().to_string();
|
||||
let details = if !stderr.is_empty() {
|
||||
stderr
|
||||
} else if !stdout.is_empty() {
|
||||
stdout
|
||||
} else {
|
||||
format!("exit code {}", output.status)
|
||||
};
|
||||
Err(anyhow!(
|
||||
"Browser binary exists but failed to run: {} ({})",
|
||||
path.display(),
|
||||
details
|
||||
))
|
||||
}
|
||||
|
||||
fn resolve_chromium_binary(explicit: Option<&str>) -> Result<PathBuf> {
|
||||
if let Some(path) = explicit {
|
||||
let candidate = PathBuf::from(path);
|
||||
if candidate.is_file() {
|
||||
chromium_binary_works(&candidate).with_context(|| {
|
||||
"The specified browser binary does not appear to be usable. If it's a wrapper script, ensure the underlying browser exists."
|
||||
})?;
|
||||
return Ok(candidate);
|
||||
}
|
||||
return Err(anyhow!(
|
||||
@@ -409,7 +445,9 @@ fn resolve_chromium_binary(explicit: Option<&str>) -> Result<PathBuf> {
|
||||
}
|
||||
|
||||
for candidate in chromium_candidates() {
|
||||
if let Some(path) = find_binary_in_path(candidate) {
|
||||
if let Some(path) = find_binary_in_path(candidate)
|
||||
&& chromium_binary_works(&path).is_ok()
|
||||
{
|
||||
return Ok(path);
|
||||
}
|
||||
}
|
||||
@@ -1435,6 +1473,8 @@ mod tests {
|
||||
is_deskify_desktop_entry, sanitize_app_id, validate_remove_id,
|
||||
};
|
||||
use std::path::Path;
|
||||
use std::{fs, os::unix::fs::PermissionsExt};
|
||||
use tempfile::tempdir;
|
||||
|
||||
#[test]
|
||||
fn sanitize_app_id_replaces_spaces_and_strips_symbols() {
|
||||
@@ -1525,4 +1565,26 @@ mod tests {
|
||||
assert!(exec.contains("--force-dark-mode"));
|
||||
assert!(exec.contains("--user-agent="));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn profile_scope_accepts_default_alias() {
|
||||
let scope: ProfileScope = serde_json::from_str("\"default\"").unwrap();
|
||||
assert_eq!(scope, ProfileScope::Isolated);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolve_chromium_binary_rejects_broken_explicit_path() {
|
||||
let dir = tempdir().unwrap();
|
||||
let script = dir.path().join("broken-browser");
|
||||
fs::write(&script, "#!/bin/sh\nexit 1\n").unwrap();
|
||||
let mut perms = fs::metadata(&script).unwrap().permissions();
|
||||
perms.set_mode(0o755);
|
||||
fs::set_permissions(&script, perms).unwrap();
|
||||
|
||||
let err = super::resolve_chromium_binary(Some(script.to_str().unwrap()))
|
||||
.err()
|
||||
.unwrap()
|
||||
.to_string();
|
||||
assert!(err.contains("failed to run") || err.contains("does not appear to be usable"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user