39 Commits

Author SHA1 Message Date
Sebastian
a45d6abb6e Merge pull request #1 from shocklateboy92/fix/chromium-icon-tempdir-drop
Fix chromium backend icon write failing with ENOENT
2026-05-25 14:05:50 +02:00
Lasath Fernando
7fc81ececa Fix chromium backend icon write failing with ENOENT
The chromium build path created a TempDir via `tempdir()?.path().join(...)`,
which dropped the TempDir at the end of the statement and deleted the
directory before fetch_or_create_icon could write into it. Every
`deskify build --backend chromium` failed with:

    Error: Failed to write RGBA PNG icon to /tmp/.tmpXXXXXX/icon.png
    Caused by: No such file or directory (os error 2)

Bind the TempDir to a local like the tauri branch already does so it
lives until the icon has been written and copied to its final location.
2026-05-18 20:44:16 -05:00
Sebastian Palencsar
557cd4dc2d Update PKGBUILD for v0.1.1-alpha.1 2026-05-09 07:12:04 +02:00
Sebastian Palencsar
cc09b629a3 Update GitHub Actions to use actions/checkout@v5 (Node.js 24 compatible) 2026-05-04 19:06:55 +02:00
Sebastian Palencsar
dec6c8f503 Update README.md with test coverage badge 2026-05-04 18:28:30 +02:00
Sebastian Palencsar
1fafa13e4a Refactor code into modular structure and add comprehensive tests
- Split main.rs into 10 focused modules for better maintainability
- Add 37 unit tests covering desktop entry, Tauri config, validation,
  Chromium backend, and app config serialization
- Update version to v0.1.1-alpha.1
2026-05-04 18:25:42 +02:00
Sebastian Palencsar
00ada512b5 Update changelog and document flatpak browser limitation 2026-02-25 20:10:23 +01:00
Sebastian Palencsar
40fda06dbd Update packaging PKGBUILD template for alpha.8 2026-02-25 20:00:38 +01:00
Sebastian Palencsar
694711ea07 Clarify chromium browser wrapper caveat applies to multiple browsers 2026-02-25 19:59:30 +01:00
Sebastian Palencsar
2efebfdce8 Document chromium backend browser-bin troubleshooting 2026-02-25 19:58:52 +01:00
Sebastian Palencsar
02942f421a Validate chromium browser binary before installing desktop entry 2026-02-25 19:52:59 +01:00
Sebastian Palencsar
fd2186b14b Handle legacy profile_scope=default in app config 2026-02-25 19:43:06 +01:00
Sebastian Palencsar
2a4e13c58d Document AUR deskify-bin install and alpha warning 2026-02-23 13:31:02 +01:00
Sebastian Palencsar
33d8d1b64b Fix AUR host key verification in publish workflow 2026-02-23 13:19:36 +01:00
Sebastian Palencsar
5b849f9820 Allow manual AUR publish reruns via workflow_dispatch 2026-02-23 13:13:53 +01:00
Sebastian Palencsar
1c3d0a5320 Run makepkg as non-root in AUR publish workflow 2026-02-23 13:10:48 +01:00
Sebastian Palencsar
97b0e0bf1e Wait for GitHub release asset before generating AUR PKGBUILD 2026-02-23 13:08:54 +01:00
Sebastian Palencsar
29ab78799c Add AUR publish workflow and PKGBUILD generator 2026-02-23 12:34:13 +01:00
Sebastian Palencsar
3b745dfba1 Update deskify-bin PKGBUILD for v0.1.0-alpha.7 2026-02-23 12:28:43 +01:00
Sebastian Palencsar
ba846aa2db Finalize AUR deskify-bin PKGBUILD checksums 2026-02-23 12:23:59 +01:00
Sebastian Palencsar
19a402be4d Improve quick start PATH hint and clarify install tracks 2026-02-23 12:20:37 +01:00
Sebastian Palencsar
b10db23311 Remove reviewer reply/roadmap drafts from repo 2026-02-23 12:17:20 +01:00
Sebastian Palencsar
1bc4ac4bc9 Persist app config, add list --verbose, and improve quick start/install 2026-02-23 12:15:10 +01:00
Sebastian Palencsar
4c1b350583 Clarify backend choice and chromium update usage in README 2026-02-23 11:32:20 +01:00
Sebastian Palencsar
57ab313150 Fix changelog version for alpha.6 tag 2026-02-23 11:30:29 +01:00
Sebastian Palencsar
df89b049de Add changelog entry for alpha.5 chromium backend release 2026-02-23 11:26:37 +01:00
Sebastian Palencsar
0c8687eb00 Add chromium compatibility backend with per-app profiles 2026-02-23 11:25:28 +01:00
Sebastian Palencsar
7e0771c9e0 Document DRM/protected-media limitation 2026-02-23 10:42:36 +01:00
Sebastian Palencsar
ec229db303 Remove Netflix/DRM examples from README 2026-02-23 10:41:03 +01:00
Sebastian Palencsar
f2799d5deb Add doctor/update commands, dry-run/print-config, and improve icon fallback 2026-02-23 09:22:14 +01:00
Sebastian Palencsar
e3d377462d Clarify fullscreen vs no-decorations README examples 2026-02-23 09:12:45 +01:00
Sebastian Palencsar
a7f0795818 Add manual trigger for release workflow 2026-02-23 09:11:12 +01:00
Sebastian Palencsar
f25a93da67 Update changelog for icon fix, no-decorations, and screenshots 2026-02-23 09:05:58 +01:00
Sebastian Palencsar
6b9e73cc9d Fix icon RGBA conversion, add no-decorations option, and add KDE screenshots 2026-02-23 09:05:14 +01:00
Sebastian Palencsar
f5c8f71095 Fix favicon icons by converting to RGBA PNG and refine README 2026-02-23 08:45:57 +01:00
Sebastian Palencsar
ec77654450 Fix favicon icons by converting to RGBA PNG refine README 2026-02-23 08:43:40 +01:00
Sebastian Palencsar
8d0e46a846 Refine README positioning with comparison and focus sections 2026-02-23 08:23:40 +01:00
Sebastian Palencsar
7869b61836 Improve README framing and add issue/label maintainer tooling 2026-02-23 08:17:59 +01:00
Sebastian Palencsar
2aca752a51 Add changelog entry for v0.1.0-alpha.2 2026-02-23 07:59:44 +01:00
32 changed files with 2851 additions and 487 deletions

92
.github/ISSUE_TEMPLATE/bug-report.yml vendored Executable file
View File

@@ -0,0 +1,92 @@
name: Bug report
description: Report incorrect behavior, regressions, or build/install failures
title: "[bug] "
labels:
- bug
body:
- type: markdown
attributes:
value: |
Thanks for reporting an issue. Please provide enough detail to reproduce the problem.
- type: dropdown
id: issue_area
attributes:
label: Area
description: Which area best fits this issue?
options:
- distro-compat
- integration
- icons
- architecture/runtime
- ci
- docs
- other
validations:
required: true
- type: input
id: deskify_version
attributes:
label: Deskify version
description: For example `v0.1.0-alpha.2` or commit SHA
placeholder: v0.1.0-alpha.2
validations:
required: true
- type: input
id: distro
attributes:
label: Linux distribution
description: Include distro + version
placeholder: Fedora 41 / Arch Linux / Ubuntu 24.04
validations:
required: true
- type: input
id: desktop_environment
attributes:
label: Desktop environment / session
description: Include DE/WM and Wayland/X11 if relevant
placeholder: GNOME (Wayland), KDE Plasma (X11), Hyprland
- type: textarea
id: command
attributes:
label: Command used
description: Exact command that triggered the issue
placeholder: |
deskify build --url "https://example.com" --name "Example"
render: bash
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected behavior
validations:
required: true
- type: textarea
id: actual
attributes:
label: Actual behavior / error output
description: Paste the relevant error message or describe what happened
validations:
required: true
- type: textarea
id: repro_steps
attributes:
label: Steps to reproduce
placeholder: |
1. Install prerequisites...
2. Run `deskify ...`
3. Observe ...
validations:
required: true
- type: checkboxes
id: checks
attributes:
label: Before submitting
options:
- label: I checked the README/known limitations and prerequisites
required: true
- label: I included distro/environment details
required: true
- label: I included the exact command and error output
required: true

11
.github/ISSUE_TEMPLATE/config.yml vendored Executable file
View File

@@ -0,0 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: Deskify README
url: https://github.com/spalencsar/deskify/blob/master/README.md
about: Check installation requirements, known limitations, usage examples, and release notes first.
- name: Contributing Guide
url: https://github.com/spalencsar/deskify/blob/master/CONTRIBUTING.md
about: Read local checks, smoke-test guidance, and contribution expectations before opening work-related issues/PRs.
- name: Maintainer Notes (Labels / Triage)
url: https://github.com/spalencsar/deskify/blob/master/docs/maintainer-notes.md
about: Reference label categories and alpha-phase triage conventions.

72
.github/ISSUE_TEMPLATE/feature-request.yml vendored Executable file
View File

@@ -0,0 +1,72 @@
name: Feature request
description: Suggest a user-facing improvement, integration idea, or architectural direction
title: "[feature] "
labels:
- enhancement
body:
- type: markdown
attributes:
value: |
Thanks for the suggestion. Feature requests are most helpful when they describe the problem first, then the proposed solution.
- type: dropdown
id: request_area
attributes:
label: Area
description: Which area best fits this request?
options:
- integration
- icons
- architecture/runtime
- distro-compat
- docs
- ci
- other
validations:
required: true
- type: checkboxes
id: design_signal
attributes:
label: Design impact
description: Tick this if the request changes long-term project direction
options:
- label: This likely affects architecture or long-term product direction (`design decision`)
required: false
- type: textarea
id: problem
attributes:
label: Problem statement
description: What problem are you trying to solve?
placeholder: |
I want to ...
The current limitation is ...
validations:
required: true
- type: textarea
id: proposed_solution
attributes:
label: Proposed solution
description: Describe the behavior/API/CLI change you would like to see
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Alternatives considered
description: What are you doing today, or what other options did you consider?
placeholder: PWAs, Flatpak web apps, manual `.desktop` entries, etc.
- type: textarea
id: scope
attributes:
label: Scope / rollout thoughts (optional)
description: If relevant, suggest MVP scope or phased rollout
placeholder: Could start as..., later evolve into...
- type: checkboxes
id: checks
attributes:
label: Before submitting
options:
- label: I described the problem, not only the implementation idea
required: true
- label: I checked existing issues/discussions for duplicates
required: true

91
.github/workflows/aur-publish.yml vendored Executable file
View 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@v5
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

View File

@@ -11,7 +11,7 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Install Rust toolchain - name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable

View File

@@ -4,6 +4,7 @@ on:
push: push:
tags: tags:
- "v*" - "v*"
workflow_dispatch:
permissions: permissions:
contents: write contents: write
@@ -15,7 +16,7 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Install Rust toolchain - name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable

View File

@@ -7,6 +7,100 @@ and this project follows early MVP/alpha versioning with tags like `v0.1.0-alpha
## [Unreleased] ## [Unreleased]
## [v0.1.1-alpha.1] - 2026-05-04
### Added
- Comprehensive unit test suite (37 tests covering desktop entry escaping, Tauri config generation, validation, Chromium backend, and app config serialization)
- Module refactoring: code split into 10 focused modules (types, validation, tauri, chromium, icon, desktop, install, app, doctor)
### Fixed
- Test coverage gaps resolved with tests for:
- `desktop_exec_escape` handling of empty strings, whitespace, quotes, and backslashes
- `validate_remove_id` rejection of uppercase, special characters, and path traversal attempts
- Tauri config generation (fullscreen, no-decorations, dark-mode, user-agent, window dimensions, CSP)
- App config serialization roundtrip
### Changed
- Split `main.rs` (~1900 lines) into modular structure:
- `src/types.rs` - CLI definitions and types
- `src/validation.rs` - ID sanitization and validation
- `src/tauri.rs` - Tauri config and project generation
- `src/chromium.rs` - Browser detection and exec building
- `src/icon.rs` - Icon fetching and processing
- `src/desktop.rs` - Desktop entry utilities
- `src/install.rs` - App installation logic
- `src/app.rs` - App management (list/remove/config)
- `src/doctor.rs` - Diagnostics
- `src/main.rs` - Entry point and orchestration
## [v0.1.0-alpha.9] - 2026-02-25
### Fixed
- Accept legacy `profile_scope=default` in persisted app configs (treated as `isolated`) and fall back to desktop metadata when a config is invalid
- Validate Chromium browser binaries before installing `.desktop` entries (prevents silent failures with wrapper scripts)
### Added
- AUR publish automation (PKGBUILD generator + GitHub Actions workflow) for `deskify-bin`
### Documentation
- Quick Start improvements and Chromium backend troubleshooting notes
- AUR install instructions and alpha warning (`yay -S deskify-bin`)
## [v0.1.0-alpha.8] - 2026-02-25
### Added
- Persisted app metadata under `~/.local/share/deskify/apps/<id>.json`
- `deskify list --verbose` to show URL/backend when metadata is available
### Changed
- `deskify update <id>` no longer requires `--url` when metadata exists (migrates older installs on first update/build)
## [v0.1.0-alpha.7] - 2026-02-25
### Added
- AUR `deskify-bin` packaging template with checksums
## [v0.1.0-alpha.6] - 2026-02-23
### Added
- `chromium` compatibility backend via `--backend chromium` using an installed Chromium-based browser in app mode (no local Tauri build for generated apps)
- `build` / `update` flags for Chromium backend selection and runtime control:
- `--backend <tauri|chromium>`
- `--browser-bin <PATH>`
- `--profile-scope <isolated|shared>`
- Chromium app install flow with XDG `.desktop` launchers and per-app metadata (`X-Deskify-Backend=chromium`)
- Optional isolated Chromium profiles under `~/.local/share/deskify/profiles/<id>`
- `doctor` now reports whether a Chromium-based browser is available in `PATH`
### Changed
- `update <id>` now keeps the internal app ID stable even when the display name changes
- `list` now derives the internal ID from the `.desktop` filename (works for both Tauri and Chromium backends)
- `remove` now also cleans up Chromium profile directories (when present)
- `update` keeps Chromium isolated profiles by default to preserve sessions/cookies during reinstall
### Fixed
- Tauri wrapper generation now consistently uses the existing internal ID for generated app identifiers (prevents accidental ID drift during updates)
- `.desktop` command generation for Chromium backend now escapes arguments (URLs / user agents with spaces or special characters)
### Documentation
- README now documents backend modes (`tauri` vs `chromium`) and recommends `--backend chromium` for sites that fail in the system WebView backend
- Added Chromium backend usage examples (`--browser-bin`, `--profile-scope`) and updated compatibility notes
### Added
- `build --no-decorations` option to create frameless windows (`decorations: false`) for kiosk/dashboard-style setups
- README screenshots for KDE/Arch showing launcher integration, running app window, and `deskify list` workflow
### Fixed
- Icon handling now normalizes downloaded and custom icons to RGBA PNG before Tauri build (prevents `icon ... is not RGBA` build failures)
## [v0.1.0-alpha.2] - 2026-02-23
### Fixed
- Resolved a CI failure caused by Clippy (`items_after_test_module`) by moving the test module to the end of `src/main.rs`
### Changed
- No functional CLI behavior changes; this is a release/CI correctness follow-up to `v0.1.0-alpha.1`
## [v0.1.0-alpha.1] - 2026-02-23 ## [v0.1.0-alpha.1] - 2026-02-23
### Added ### Added

View File

@@ -46,6 +46,10 @@ cargo test
cargo check cargo check
``` ```
## Maintainer Notes (Repo Meta / Triage)
Maintainers can use `docs/maintainer-notes.md` for the current label strategy and issue triage conventions during the alpha phase.
## Manual Smoke Test (Recommended for Behavior Changes) ## Manual Smoke Test (Recommended for Behavior Changes)
If your change affects build/install/list/remove behavior, run a quick smoke test: If your change affects build/install/list/remove behavior, run a quick smoke test:

2
Cargo.lock generated
View File

@@ -351,6 +351,7 @@ dependencies = [
"directories", "directories",
"image", "image",
"regex", "regex",
"serde",
"serde_json", "serde_json",
"tempfile", "tempfile",
"ureq", "ureq",
@@ -1334,6 +1335,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
dependencies = [ dependencies = [
"serde_core", "serde_core",
"serde_derive",
] ]
[[package]] [[package]]

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "deskify" name = "deskify"
version = "0.1.0" version = "0.1.1-alpha.1"
edition = "2024" edition = "2024"
[dependencies] [dependencies]
@@ -9,6 +9,7 @@ clap = { version = "4.5.60", features = ["derive"] }
directories = "6.0.0" directories = "6.0.0"
image = "0.25.9" image = "0.25.9"
regex = "1.12.3" regex = "1.12.3"
serde = { version = "1.0.218", features = ["derive"] }
serde_json = "1.0.149" serde_json = "1.0.149"
tempfile = "3.25.0" tempfile = "3.25.0"
ureq = "2.9" ureq = "2.9"

5
Makefile Executable file
View File

@@ -0,0 +1,5 @@
REPO ?= spalencsar/deskify
.PHONY: labels
labels:
./scripts/setup-github-labels.sh $(REPO)

317
README.md
View File

@@ -1,8 +1,8 @@
<h1 align="center">deskify</h1> <h1 align="center">deskify</h1>
<p align="center"> <p align="center">
<b>A blazing fast, lightweight Nativefier alternative written in Rust & Tauri.</b><br> <b>Turn websites into first-class Linux desktop applications with Rust, Tauri, and the system WebView.</b><br>
Instantly turn any website or web app into a native, standalone Linux desktop application. Build native-feeling, standalone web app wrappers with CLI-first Linux integration.
</p> </p>
<p align="center"> <p align="center">
@@ -10,34 +10,162 @@
<img src="https://img.shields.io/badge/Language-Rust-orange?style=flat-square" alt="Written in Rust" /> <img src="https://img.shields.io/badge/Language-Rust-orange?style=flat-square" alt="Written in Rust" />
<img src="https://img.shields.io/badge/Powered_by-Tauri_v2-grey?style=flat-square" alt="Tauri v2" /> <img src="https://img.shields.io/badge/Powered_by-Tauri_v2-grey?style=flat-square" alt="Tauri v2" />
<img src="https://img.shields.io/badge/Status-Alpha-yellow?style=flat-square" alt="Alpha status" /> <img src="https://img.shields.io/badge/Status-Alpha-yellow?style=flat-square" alt="Alpha status" />
<img src="https://img.shields.io/badge/Tests-37-green?style=flat-square" alt="37 unit tests" />
<img src="https://img.shields.io/github/v/release/spalencsar/deskify?label=Latest%20Release&style=flat-square" alt="Latest release" />
<img src="https://img.shields.io/badge/License-MIT-green?style=flat-square" alt="MIT license" />
</p> </p>
<p align="center">
<img src="docs/assets/chat-kde.png" alt="Deskify app window running chat.com on KDE Plasma" width="49%" />
<img src="docs/assets/chat-launcher-kde.png" alt="Deskify app visible in KDE launcher" width="49%" />
</p>
<p align="center">
<img src="docs/assets/deskify-list-terminal.png" alt="deskify list terminal output" width="80%" />
</p>
<p align="center"><sub>Screenshots: KDE Plasma on Arch Linux (alpha MVP workflow).</sub></p>
--- ---
## ⚡ Why deskify? ## Quick Start
The original [Nativefier](https://github.com/nativefier/nativefier) project (Node.js/Electron) was an incredible tool, but it is now unmaintained and deprecated. Furthermore, packaging an entire Chromium V8 engine for *every single web app* you create consumes massive amounts of RAM and disk space. Two tracks, depending on what you want:
**deskify** solves this by leveraging [Tauri](https://tauri.app/). Instead of bundling a heavy browser engine, it uses your native system webview (e.g., `webkit2gtk` on Linux). ### Option A: Chromium mode (fastest, best compatibility)
## 🚧 Project Status (Alpha / Early MVP) Requirements: any Chromium-based browser installed (`chromium`, `google-chrome`, `brave`, etc.)
```bash
mkdir -p ~/.local/bin
curl -L -o ~/.local/bin/deskify \
https://github.com/spalencsar/deskify/releases/latest/download/deskify-linux-x86_64
chmod +x ~/.local/bin/deskify
# If `deskify` is not found, ensure ~/.local/bin is in PATH (common on Ubuntu/Debian):
command -v deskify >/dev/null || { echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc; }
deskify build --url "https://chat.com" --name "Chat" --backend chromium
```
### Option B: Native Tauri mode (system WebView, no Chromium dependency)
Follow the full install section below (Tauri/WebKitGTK prerequisites), then:
```bash
deskify build --url "https://chat.com" --name "Chat"
```
## Why Deskify Exists
Web apps are now core tools, but Linux desktops still treat them like second-class citizens.
- Electron-based wrappers solve distribution, but often at high RAM/disk cost.
- PWAs help in some browsers, but desktop integration is inconsistent across environments.
- The original [Nativefier](https://github.com/nativefier/nativefier) proved the need, but it is now unmaintained.
`deskify` takes a Linux-first approach: it turns a website into a native-feeling desktop app using [Tauri](https://tauri.app/) and the system webview (for example `webkit2gtk`) instead of bundling a full browser engine per app.
## Problem Fit (Why Deskify vs. Other Approaches)
Deskify is optimized for Linux users who want native desktop integration and CLI-friendly automation for web apps, without shipping a bundled browser runtime per app.
The comparison below is intentionally rough and practical (not benchmark marketing). It describes tradeoffs, not winners in every category.
| Approach | Runtime model | Desktop integration | Automation / scripting | Isolation / sandbox | Setup complexity | Offline capability |
| --- | --- | --- | --- | --- | --- | --- |
| Electron / Nativefier | Bundled Chromium per app | Good | Low to medium | Per-app process, app-bundled runtime | Easy to medium | Depends on the site |
| PWA | Browser runtime | Limited / browser-dependent | Low | Shared browser context | Very easy | Depends on browser + site |
| Flatpak web app models | Sandbox-oriented runtime model | Good | Limited | Strong sandbox model | Medium | Depends on runtime + site |
| **Deskify** | System WebView | Native (`.desktop`, icons, WMClass) | **High (CLI-first)** | Medium (shared system WebView security model) | Medium (Tauri prerequisites) | Depends on the site |
### Deskify Focus (Today)
Deskify focuses on:
- system-native Linux desktop integration
- minimal runtime overhead by relying on the system WebView
- automation-friendly CLI workflows
- straightforward local install/remove lifecycle management
Deskify intentionally does not aim to:
- replace full browser sandbox products
- provide a cross-platform abstraction layer
- ship bundled browser runtimes per generated app
## How Deskify Works Today (Alpha / MVP)
`deskify` is ready for public use and testing as an **early MVP**, but it is **not production-hardened yet**. `deskify` is ready for public use and testing as an **early MVP**, but it is **not production-hardened yet**.
- **Platform scope:** Linux only - **Platform scope:** Linux only
- **Build model:** `deskify` compiles a local Tauri wrapper app on your machine - **Current architecture:** one generated Tauri wrapper project per app
- **First build can take a while:** Rust crates + Tauri build steps may need to compile - **Build model:** `deskify` compiles the wrapper locally on your machine
- **Test coverage:** currently limited (core behavior is implemented, but automated coverage is still growing) - **Why this MVP design:** simpler debugging, isolated failures, low contributor complexity
- **Tradeoff:** build time and distro-specific setup issues become user-facing
- **Test coverage:** 37 unit tests covering desktop entry escaping, Tauri config generation, validation, Chromium backend, and app config serialization
### MVP Architecture (Today)
```mermaid
flowchart TD
A[deskify CLI] --> B[Generate temporary Tauri wrapper project]
B --> C[Fetch or copy icon]
C --> D[Write tauri.conf.json + source files]
D --> E[Run cargo tauri build locally]
E --> F[Install binary to local executable dir]
F --> G[Install icon + .desktop entry]
G --> H[Launch from Linux app menu]
```
### Known Limitations ### Known Limitations
- Requires Tauri/Linux system dependencies to be installed locally before `deskify build` - Requires Tauri/Linux system dependencies to be installed locally before `deskify build`
- Generated app build success can vary by distro/system setup (WebKitGTK/Tauri prerequisites) - Generated app build success can vary by distro/system setup (WebKitGTK/Tauri prerequisites)
- Some modern sites fail or degrade in the system WebView backend (`tauri`) due to engine/runtime differences
- No official cross-platform support (Windows/macOS) yet - No official cross-platform support (Windows/macOS) yet
- GitHub Releases / binary automation for `deskify` itself may lag behind source updates during early MVP - GitHub Releases / binary automation for `deskify` itself may lag behind source updates during early MVP
- DRM/protected-media services may not work reliably in the system WebView backend even if they work in a full browser (depends on WebView/DRM support)
### 🌟 Features ## Where Deskify Is Going
- **Extremely Lightweight:** Generated binaries are tiny (~4-6 MB) and RAM consumption is minimal.
Deskify aims to make web applications **first-class Linux desktop applications**.
Planned evolution (direction, not promise):
- Shared runtime model for multiple apps
- Per-app config and icon installs without full rebuilds
- Stronger Linux desktop integration (deployment, automation, kiosk/admin workflows)
- Better distro compatibility guidance and troubleshooting
The current per-app build approach is intentional for the MVP. The goal is to keep it simple now while making the longer-term direction visible.
### Planned Evolution (Concept)
```mermaid
flowchart TD
A[deskify CLI] --> B[deskify runtime binary]
A --> C[App config files]
A --> D[Icons + .desktop entries]
C --> E[apps/chatgpt.json]
C --> F[apps/home-assistant.json]
B --> G[Load app config at launch]
G --> H[Open site in system webview]
D --> I[Linux app menu integration]
```
## Why Not Just Use Flatpak Web Apps / PWAs / Electron?
The table above covers the technical tradeoffs in more detail. In practice, `deskify` is most useful when you want:
- a CLI-first workflow for repeatable installs and automation
- Linux-native desktop integration (`.desktop`, icons, window class behavior)
- a system-WebView-based runtime model instead of shipping a bundled browser per app
### Key Features
- **System-WebView Runtime Model:** Generated wrappers stay small because Deskify relies on the system WebView instead of bundling a browser runtime per app.
- **Automatic Icon Fetching:** Scrapes high-quality 128x128 favicons automatically using the Google Favicon API. - **Automatic Icon Fetching:** Scrapes high-quality 128x128 favicons automatically using the Google Favicon API.
- **Layered Icon Fallbacks:** Tries site-provided icons first (`<link rel="icon">`, `/favicon.ico`), then falls back to the Google Favicon API, then a dummy icon.
- **XDG-Compliant System Integration:** Safely creates `.desktop` entries in `~/.local/share/applications` and manages application icons in `~/.local/share/icons/hicolor/`. - **XDG-Compliant System Integration:** Safely creates `.desktop` entries in `~/.local/share/applications` and manages application icons in `~/.local/share/icons/hicolor/`.
- **Wayland/X11 Ready:** Perfectly binds `StartupWMClass` to ensure your DE groups the app exactly to its custom icon (no generic gear icons in GNOME/KDE taskbars). - **Wayland/X11 Ready:** Perfectly binds `StartupWMClass` to ensure your DE groups the app exactly to its custom icon (no generic gear icons in GNOME/KDE taskbars).
- **Kiosk / Fullscreen Mode:** Pin applications perfectly as dashboards. - **Kiosk / Fullscreen Mode:** Pin applications perfectly as dashboards.
@@ -48,6 +176,35 @@ The original [Nativefier](https://github.com/nativefier/nativefier) project (Nod
## 🚀 Installation ## 🚀 Installation
### Option A: Install a prebuilt binary (recommended)
Deskify provides Linux release binaries. Download the latest release and install it into `~/.local/bin`:
```bash
mkdir -p ~/.local/bin
curl -L -o ~/.local/bin/deskify \
https://github.com/spalencsar/deskify/releases/latest/download/deskify-linux-x86_64
chmod +x ~/.local/bin/deskify
deskify --help
```
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 ### 1. System Dependencies
Because `deskify` compiles Tauri applications natively on your machine, you need the standard Tauri prerequisites installed before using it. Because `deskify` compiles Tauri applications natively on your machine, you need the standard Tauri prerequisites installed before using it.
@@ -115,11 +272,25 @@ Once the build finishes, `ChatGPT` will instantly appear in your system Applicat
`deskify` derives a safe internal ID from the app name (for example, `ChatGPT` becomes `chatgpt`). `deskify` derives a safe internal ID from the app name (for example, `ChatGPT` becomes `chatgpt`).
### Backend Modes (`--backend`)
Deskify supports two backend modes:
- `tauri` (default): Uses the system WebView (`webkit2gtk` on Linux). Produces small wrappers and strong Linux desktop integration, but some sites may fail due to engine compatibility.
- `chromium`: Uses an already installed Chromium-based browser (`chromium`, `google-chrome`, `brave`, etc.) in app mode. Better site compatibility and no local Tauri build, but depends on a browser installed on the system.
If a site does not work in the default `tauri` backend, try `--backend chromium`.
Quick decision rule:
- Start with the default `tauri` backend for small wrappers and native Linux integration.
- If the site fails to load, behaves incorrectly, or needs a newer browser engine, rebuild/update with `--backend chromium`.
#### Advanced Build Options #### Advanced Build Options
```bash ```bash
deskify build \ deskify build \
--url "https://netflix.com" \ --url "https://example.com/dashboard" \
--name "Netflix" \ --name "Dashboard" \
--fullscreen \ --fullscreen \
--user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/120.0.0.0 Safari/537.36" \ --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/120.0.0.0 Safari/537.36" \
--dark-mode \ --dark-mode \
@@ -127,22 +298,98 @@ deskify build \
--height 720 --height 720
``` ```
Frameless example (without fullscreen):
```bash
deskify build \
--url "https://chat.com" \
--name "Chat" \
--no-decorations \
--width 1200 \
--height 800
```
Preview the generated Tauri config without building/installing:
```bash
deskify build --url "https://chat.com" --name "Chat" --print-config
```
Chromium compatibility mode (no local Tauri build):
```bash
deskify build --url "https://mail.proton.me" --name "Proton Mail" --backend chromium
```
Chromium with shared browser profile (uses existing browser profile/session model):
```bash
deskify build \
--url "https://app.slack.com" \
--name "Slack" \
--backend chromium \
--profile-scope shared
```
Chromium with explicit browser binary:
```bash
deskify build \
--url "https://github.com" \
--name "GitHub" \
--backend chromium \
--browser-bin /usr/bin/brave-browser
```
Preview planned actions only (dry run):
```bash
deskify build --url "https://chat.com" --name "Chat" --dry-run
```
* `--icon <PATH>`: Provide a custom PNG icon instead of auto-downloading one. * `--icon <PATH>`: Provide a custom PNG icon instead of auto-downloading one.
* `--fullscreen`: Starts the app in Kiosk mode. * `--fullscreen`: Starts the app in Kiosk mode.
* `--no-decorations`: Disables native window decorations (frameless window; useful for dashboards/kiosk setups).
* `--user-agent <UA>`: Useful to bypass webview restrictions on certain platforms. * `--user-agent <UA>`: Useful to bypass webview restrictions on certain platforms.
* `--dark-mode`: Forces the Tauri webview into a dark theme. * `--dark-mode`: Forces the Tauri webview into a dark theme.
* `--width <PX>` / `--height <PX>`: Sets the startup resolution. * `--width <PX>` / `--height <PX>`: Sets the startup resolution.
* `--backend <tauri|chromium>`: Choose system WebView (`tauri`) or Chromium app mode (`chromium`).
* `--browser-bin <PATH>`: Use a specific Chromium-based browser binary (Chromium backend only).
* `--profile-scope <isolated|shared>`: Chromium backend profile behavior (`isolated` creates a per-app profile under `~/.local/share/deskify/profiles/`).
* `--print-config`: Prints the generated `tauri.conf.json` and exits.
* `--dry-run`: Shows planned actions without building/installing.
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.
- Flatpak-installed browsers are not supported out of the box (they usually require `flatpak run ...`). Use a native browser binary for now; Flatpak support may be added in a future release.
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`) ### Managing Apps (`list` & `remove`)
You can view all applications generated by `deskify`: You can view all applications generated by `deskify`:
```bash ```bash
deskify list deskify list
``` ```
Verbose list (includes URL/backend when metadata is available):
```bash
deskify list --verbose
```
*Output:* *Output:*
```text ```text
Installed Deskify Apps: Installed Deskify Apps:
- ChatGPT (Internal ID: chatgpt) - ChatGPT (Internal ID: chatgpt, Backend: tauri)
- Netflix (Internal ID: netflix) - Proton Mail (Internal ID: proton-mail, Backend: chromium)
``` ```
To entirely uninstall an app (including the binary, desktop entry, and icons): To entirely uninstall an app (including the binary, desktop entry, and icons):
@@ -152,6 +399,41 @@ deskify remove chatgpt
`remove` expects this **internal ID** (sanitized lowercase letters, numbers, `-`), not the display name. `remove` expects this **internal ID** (sanitized lowercase letters, numbers, `-`), not the display name.
### Updating Apps (`update`)
Rebuild and reinstall an existing app ID without manually running `remove` + `build`:
```bash
deskify update chat --url "https://chat.com" --name "Chat" --no-decorations
```
Deskify persists app metadata under `~/.local/share/deskify/apps/<id>.json`. With persisted metadata, `update` can be used without `--url`.
If an older app has no metadata yet, provide `--url` once (or rebuild once) to migrate it.
`update <id>` keeps the existing internal ID stable even if you change the display name.
You can also preview an update:
```bash
deskify update chat --url "https://chat.com" --dry-run
deskify update chat --url "https://chat.com" --print-config
```
Switch an existing app to Chromium compatibility mode while keeping the same internal ID:
```bash
deskify update chat --url "https://chat.com" --name "Chat" --backend chromium
```
### Diagnostics (`doctor`)
Check local prerequisites and common environment issues (Rust/Cargo, `cargo tauri`, `pkg-config`, directories):
```bash
deskify doctor
```
`doctor` also checks whether a Chromium-based browser is available in `PATH` for `--backend chromium`.
--- ---
## 🧪 Manual Smoke Test Checklist (Before a Public Release) ## 🧪 Manual Smoke Test Checklist (Before a Public Release)
@@ -176,10 +458,9 @@ Expected: clean validation error and no unintended file deletion.
## 🏷️ Versioning & GitHub Releases (MVP) ## 🏷️ Versioning & GitHub Releases (MVP)
- Recommended tag format during MVP: `v0.1.0-alpha.N` - Recommended tag format during MVP: `v0.1.0-alpha.N`
- Start with **source-first** releases (repository + tags) - GitHub Releases publish a Linux `deskify` CLI binary on tags (`v*`)
- Add automated binary releases later via GitHub Actions
For the first public launch, tagging `v0.1.0-alpha.1` is a sensible default. For the latest alpha, see GitHub Releases (and continue with `v0.1.0-alpha.N` for follow-up releases).
--- ---

BIN
docs/assets/chat-kde.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
docs/assets/chat-launcher-kde.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

72
docs/github-labels.json Executable file
View File

@@ -0,0 +1,72 @@
[
{
"name": "architecture/runtime",
"color": "5319E7",
"description": "Runtime model, shared runtime, config-based apps, install model evolution"
},
{
"name": "distro-compat",
"color": "D93F0B",
"description": "Distro-specific build/runtime issues and environment differences"
},
{
"name": "integration",
"color": "0E8A16",
"description": "Desktop integration topics (.desktop, icons, launchers, window class behavior)"
},
{
"name": "icons",
"color": "FBCA04",
"description": "Favicon fetching, icon parsing, icon quality, and fallback behavior"
},
{
"name": "good first issue",
"color": "7057FF",
"description": "Scoped tasks suitable for first-time contributors"
},
{
"name": "needs testing",
"color": "BFDADC",
"description": "Behavior change needs manual or wider validation across systems"
},
{
"name": "design decision",
"color": "1D76DB",
"description": "Affects long-term architecture or product direction"
},
{
"name": "docs",
"color": "0075CA",
"description": "README, CONTRIBUTING, examples, troubleshooting, and release notes"
},
{
"name": "bug",
"color": "D73A4A",
"description": "Incorrect behavior or regression"
},
{
"name": "enhancement",
"color": "A2EEEF",
"description": "Feature or improvement request"
},
{
"name": "ci",
"color": "C5DEF5",
"description": "GitHub Actions, release workflows, and build checks"
},
{
"name": "feature",
"color": "84B6EB",
"description": "User-facing functionality addition (release note category)"
},
{
"name": "fix",
"color": "E99695",
"description": "Behavior correction or bug fix (release note category)"
},
{
"name": "chore",
"color": "FEF2C0",
"description": "Maintenance tasks and non-user-facing housekeeping"
}
]

46
docs/maintainer-notes.md Executable file
View File

@@ -0,0 +1,46 @@
# Maintainer Notes
This document captures lightweight repo-management conventions for `deskify` during the alpha/MVP phase.
## Issue Labels (Recommended)
Use labels to make project direction visible and to reduce triage friction.
- `architecture/runtime` - runtime model, shared runtime, config-based apps, install model evolution
- `distro-compat` - distro-specific build/runtime issues (WebKitGTK, packaging prerequisites, environment differences)
- `integration` - desktop integration topics (`.desktop`, icons, launchers, window class behavior)
- `icons` - favicon fetching, icon parsing, icon quality/fallback behavior
- `good first issue` - scoped tasks suitable for first-time contributors
- `needs testing` - behavior change needs manual or wider validation across systems
- `design decision` - issue/PR affects long-term architecture or product direction
- `docs` - README, CONTRIBUTING, examples, troubleshooting, release notes
- `bug` - incorrect behavior or regression
- `enhancement` - feature or improvement request
- `ci` - GitHub Actions, release workflows, build checks
Label definitions for GitHub setup are stored in `docs/github-labels.json`.
If you use GitHub CLI, `scripts/setup-github-labels.sh <owner/repo>` will create/update them.
## Triage Heuristics (Alpha)
- Prefer labeling directionally first (`architecture/runtime`, `distro-compat`, `integration`) before priority.
- Use `design decision` early when a discussion can create long-term constraints.
- Add `needs testing` to changes that touch build/install/remove flows or desktop integration behavior.
- Distinguish user-environment issues from code bugs (`distro-compat` + details) to avoid misclassifying support reports.
## Release Notes Categories (Suggested Mapping)
- `feature`, `enhancement` -> user-facing functionality additions
- `fix`, `bug` -> behavior corrections and regressions
- `docs` -> documentation changes
- `chore`, `ci` -> maintenance and pipeline work
## Maintainer Framing (README / Issues)
During alpha, consistently frame Deskify as:
- a Linux-first web app integration tool
- an early MVP with intentional per-app build architecture
- a project with a visible evolution path toward runtime/config-based installs
This helps avoid "Nativefier clone" framing as the default community label.

17
packaging/.SRCINFO Normal file
View File

@@ -0,0 +1,17 @@
pkgbase = deskify-bin
pkgdesc = Turn websites into Linux desktop apps (prebuilt binary package)
pkgver = 0.1.1.alpha.1
pkgrel = 1
url = https://github.com/spalencsar/deskify
arch = x86_64
license = MIT
depends = glibc
optdepends = chromium: for --backend chromium
provides = deskify
conflicts = deskify
source = deskify::https://github.com/spalencsar/deskify/releases/download/v0.1.1-alpha.1/deskify-linux-x86_64
source = LICENSE::https://raw.githubusercontent.com/spalencsar/deskify/v0.1.1-alpha.1/LICENSE
sha256sums = c4e938b7b130529eb50d85ab8797ef5d4c04262c9fcb40519f2e8d87443dc2ab
sha256sums = d4e53458cd2dd461f234186497b6d9b21566c477737a4d31fa6f018ef610486f
pkgname = deskify-bin

23
packaging/PKGBUILD Executable file
View File

@@ -0,0 +1,23 @@
pkgname=deskify-bin
pkgver=0.1.1.alpha.1
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.1-alpha.1"
source=("deskify::https://github.com/spalencsar/deskify/releases/download/${_tag}/deskify-linux-x86_64"
"LICENSE::https://raw.githubusercontent.com/spalencsar/deskify/${_tag}/LICENSE")
sha256sums=('c4e938b7b130529eb50d85ab8797ef5d4c04262c9fcb40519f2e8d87443dc2ab'
'd4e53458cd2dd461f234186497b6d9b21566c477737a4d31fa6f018ef610486f')
package() {
install -Dm755 "${srcdir}/deskify" "${pkgdir}/usr/bin/deskify"
install -Dm644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

69
packaging/README.md Normal file
View File

@@ -0,0 +1,69 @@
## AUR package template (manual + CI)
This folder contains a minimal `PKGBUILD` template for a future AUR package:
- `deskify-bin` (prebuilt GitHub Releases binary)
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
```bash
cd packaging
makepkg -sf
```
To compute sha256 sums for a tag:
```bash
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)

View 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}"

43
scripts/setup-github-labels.sh Executable file
View File

@@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -euo pipefail
if ! command -v gh >/dev/null 2>&1; then
echo "Error: GitHub CLI ('gh') is not installed." >&2
exit 1
fi
repo="${1:-}"
labels_file="${2:-docs/github-labels.json}"
if [[ -z "${repo}" ]]; then
echo "Usage: $0 <owner/repo> [labels-json-path]" >&2
echo "Example: $0 spalencsar/deskify" >&2
exit 1
fi
if [[ ! -f "${labels_file}" ]]; then
echo "Error: labels file not found: ${labels_file}" >&2
exit 1
fi
if ! command -v jq >/dev/null 2>&1; then
echo "Error: 'jq' is required to read ${labels_file}." >&2
exit 1
fi
echo "Syncing labels to ${repo} using ${labels_file} ..."
jq -c '.[]' "${labels_file}" | while IFS= read -r label; do
name="$(jq -r '.name' <<<"${label}")"
color="$(jq -r '.color' <<<"${label}")"
description="$(jq -r '.description' <<<"${label}")"
if gh label edit "${name}" --repo "${repo}" --color "${color}" --description "${description}" >/dev/null 2>&1; then
echo "Updated: ${name}"
else
gh label create "${name}" --repo "${repo}" --color "${color}" --description "${description}" >/dev/null
echo "Created: ${name}"
fi
done
echo "Done."

340
src/app.rs Normal file
View File

@@ -0,0 +1,340 @@
use anyhow::{Context, Result};
use directories::BaseDirs;
use std::fs;
use std::path::PathBuf;
use crate::chromium::{
backend_str, build_chromium_exec, chromium_profile_dir, profile_scope_str,
resolve_chromium_binary,
};
use crate::types::{Backend, DeskifyAppConfig, ProfileScope};
use crate::validation::{is_deskify_desktop_entry, validate_remove_id};
pub fn deskify_data_dir() -> Result<PathBuf> {
let base_dirs =
BaseDirs::new().ok_or_else(|| anyhow::anyhow!("Could not find system BaseDirs"))?;
Ok(base_dirs.data_local_dir().join("deskify"))
}
pub fn app_config_path(id: &str) -> Result<PathBuf> {
validate_remove_id(id)?;
Ok(deskify_data_dir()?
.join("apps")
.join(format!("{}.json", id)))
}
pub fn read_app_config(id: &str) -> Result<Option<DeskifyAppConfig>> {
let path = app_config_path(id)?;
if !path.exists() {
return Ok(None);
}
let content = fs::read_to_string(&path)
.with_context(|| format!("Failed to read app config {}", path.display()))?;
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)
}
}
}
pub fn write_app_config_from_args(args: &crate::types::BuildArgs) -> Result<()> {
validate_remove_id(&args.internal_id)?;
let path = app_config_path(&args.internal_id)?;
if let Some(dir) = path.parent() {
fs::create_dir_all(dir).context("Failed to create app config directory")?;
}
let cfg = DeskifyAppConfig {
schema_version: 1,
id: args.internal_id.clone(),
name: args.name.clone(),
url: args.url.clone(),
backend: args.backend,
browser_bin: args.browser_bin.clone(),
profile_scope: args.profile_scope,
fullscreen: args.fullscreen,
no_decorations: args.no_decorations,
user_agent: args.user_agent.clone(),
width: args.width,
height: args.height,
dark_mode: args.dark_mode,
};
fs::write(
&path,
serde_json::to_string_pretty(&cfg).context("Failed to serialize app config")?,
)
.with_context(|| format!("Failed to write app config {}", path.display()))?;
Ok(())
}
pub fn remove_app_config(id: &str) -> Result<()> {
let path = app_config_path(id)?;
if path.exists() {
fs::remove_file(&path).with_context(|| format!("Failed to remove {}", path.display()))?;
println!("Removed app config: {:?}", path);
}
Ok(())
}
pub fn list_apps_with_options(verbose: bool) -> Result<()> {
let base_dirs =
BaseDirs::new().ok_or_else(|| anyhow::anyhow!("Could not find system BaseDirs"))?;
let applications_dir = base_dirs.data_local_dir().join("applications");
println!("Installed Deskify Apps:");
let mut found = false;
if applications_dir.exists() {
for entry in
fs::read_dir(applications_dir).context("Failed to read applications directory")?
{
let entry = entry?;
let path = entry.path();
if path.extension().and_then(|s| s.to_str()) == Some("desktop")
&& let Ok(content) = fs::read_to_string(&path)
&& is_deskify_desktop_entry(&content)
{
let name = content
.lines()
.find(|l| l.starts_with("Name="))
.and_then(|l| l.strip_prefix("Name="))
.unwrap_or("Unknown");
let internal_id = path
.file_stem()
.and_then(|s| s.to_str())
.unwrap_or("Unknown");
let backend = content
.lines()
.find(|l| l.starts_with("X-Deskify-Backend="))
.and_then(|l| l.strip_prefix("X-Deskify-Backend="))
.unwrap_or("legacy");
if verbose && validate_remove_id(internal_id).is_ok() {
if let Some(cfg) = read_app_config(internal_id)? {
println!(
"- {} (Internal ID: {}, Backend: {}, URL: {})",
name,
internal_id,
backend_str(cfg.backend),
cfg.url
);
} else {
let url = content
.lines()
.find(|l| l.starts_with("X-Deskify-URL="))
.and_then(|l| l.strip_prefix("X-Deskify-URL="));
if let Some(url) = url {
println!(
"- {} (Internal ID: {}, Backend: {}, URL: {})",
name, internal_id, backend, url
);
} else {
println!(
"- {} (Internal ID: {}, Backend: {})",
name, internal_id, backend
);
}
}
} else {
println!(
"- {} (Internal ID: {}, Backend: {})",
name, internal_id, backend
);
}
found = true;
}
}
}
if !found {
println!("No apps found.");
}
Ok(())
}
pub fn read_desktop_entry_value(id: &str, key: &str) -> Result<Option<String>> {
validate_remove_id(id)?;
let base_dirs =
BaseDirs::new().ok_or_else(|| anyhow::anyhow!("Could not find system BaseDirs"))?;
let desktop_path = base_dirs
.data_local_dir()
.join("applications")
.join(format!("{}.desktop", id));
if !desktop_path.exists() {
return Ok(None);
}
let content = fs::read_to_string(&desktop_path)
.with_context(|| format!("Failed to read desktop entry {}", desktop_path.display()))?;
if !is_deskify_desktop_entry(&content) {
return Ok(None);
}
let prefix = format!("{}=", key);
Ok(content
.lines()
.find(|line| line.starts_with(&prefix))
.and_then(|line| line.strip_prefix(&prefix))
.map(str::to_string))
}
pub fn read_installed_app_display_name(id: &str) -> Result<Option<String>> {
validate_remove_id(id)?;
let base_dirs =
BaseDirs::new().ok_or_else(|| anyhow::anyhow!("Could not find system BaseDirs"))?;
let desktop_path = base_dirs
.data_local_dir()
.join("applications")
.join(format!("{}.desktop", id));
if !desktop_path.exists() {
return Ok(None);
}
let content = fs::read_to_string(&desktop_path)
.with_context(|| format!("Failed to read desktop entry {}", desktop_path.display()))?;
if !is_deskify_desktop_entry(&content) {
return Ok(None);
}
let name = content
.lines()
.find(|line| line.starts_with("Name="))
.and_then(|line| line.strip_prefix("Name="))
.map(str::to_string);
Ok(name)
}
pub fn remove_app_with_options(safe_name: &str, remove_profile: bool) -> Result<()> {
validate_remove_id(safe_name)?;
let base_dirs =
BaseDirs::new().ok_or_else(|| anyhow::anyhow!("Could not find system BaseDirs"))?;
let executable_dir = base_dirs
.executable_dir()
.map(|p| p.to_path_buf())
.unwrap_or_else(|| base_dirs.home_dir().join(".local/bin"));
let data_local_dir = base_dirs.data_local_dir();
let binary_path = executable_dir.join(safe_name);
if binary_path.exists() {
fs::remove_file(&binary_path).context("Failed to remove binary")?;
println!("Removed binary: {:?}", binary_path);
} else {
println!("Binary not found: {:?}", binary_path);
}
let desktop_path = data_local_dir
.join("applications")
.join(format!("{}.desktop", safe_name));
if desktop_path.exists() {
fs::remove_file(&desktop_path).context("Failed to remove .desktop file")?;
println!("Removed desktop entry: {:?}", desktop_path);
} else {
println!("Desktop entry not found: {:?}", desktop_path);
}
let icon_path = data_local_dir
.join("icons/hicolor/128x128/apps")
.join(format!("{}.png", safe_name));
if icon_path.exists() {
fs::remove_file(&icon_path).context("Failed to remove icon")?;
println!("Removed icon: {:?}", icon_path);
} else {
println!("Icon not found: {:?}", icon_path);
}
let profile_path = data_local_dir.join("deskify/profiles").join(safe_name);
if remove_profile {
if profile_path.exists() {
fs::remove_dir_all(&profile_path).context("Failed to remove Chromium profile")?;
println!("Removed Chromium profile: {:?}", profile_path);
} else {
println!("Chromium profile not found: {:?}", profile_path);
}
} else if profile_path.exists() {
println!("Keeping Chromium profile: {:?}", profile_path);
}
println!("Successfully removed app '{}'.", safe_name);
let _ = remove_app_config(safe_name);
Ok(())
}
pub fn print_generated_config(args: &crate::types::BuildArgs) -> Result<()> {
match args.backend {
Backend::Tauri => {
let config = crate::tauri::build_tauri_config_value(args, &args.internal_id, false);
println!(
"{}",
serde_json::to_string_pretty(&config)
.context("Failed to serialize generated config")?
);
}
Backend::Chromium => {
let browser = resolve_chromium_binary(args.browser_bin.as_deref())?;
let profile_dir = chromium_profile_dir(&args.internal_id)?;
let profile_dir = match args.profile_scope {
ProfileScope::Isolated => Some(profile_dir),
ProfileScope::Shared => None,
};
let exec = build_chromium_exec(args, &browser, profile_dir.as_deref());
let value = serde_json::json!({
"backend": "chromium",
"name": args.name,
"id": args.internal_id,
"url": args.url,
"browser": browser.display().to_string(),
"profileScope": profile_scope_str(args.profile_scope),
"exec": exec,
});
println!(
"{}",
serde_json::to_string_pretty(&value)
.context("Failed to serialize generated config")?
);
}
}
Ok(())
}
pub fn print_build_plan(action: &str, args: &crate::types::BuildArgs, existing_id: Option<&str>) {
let id = existing_id.unwrap_or(&args.internal_id);
println!("{} plan:", action);
if let Some(id) = existing_id {
println!("- Existing app ID: {}", id);
}
println!("- URL: {}", args.url);
println!("- Name: {}", args.name);
println!("- Internal ID: {}", id);
match args.backend {
Backend::Tauri => {
println!("- Backend: tauri (system WebView)");
println!("- Local build: cargo tauri build (temporary generated project)");
println!("- Install targets: local binary + XDG icon + .desktop entry");
}
Backend::Chromium => {
println!("- Backend: chromium (installed browser runtime)");
println!("- Local build: none");
println!("- Install targets: XDG icon + .desktop entry (+ optional isolated profile)");
println!("- Profile scope: {}", profile_scope_str(args.profile_scope));
if let Some(path) = &args.browser_bin {
println!("- Browser binary: {}", path);
} else {
println!("- Browser binary: auto-detect from PATH");
}
if args.no_decorations {
println!("- Note: --no-decorations is not guaranteed in Chromium app mode");
}
}
}
if args.fullscreen {
println!("- Window: fullscreen enabled");
}
if args.no_decorations {
println!("- Window: native decorations disabled");
}
}

146
src/chromium.rs Normal file
View File

@@ -0,0 +1,146 @@
use anyhow::{Context, Result};
use std::env;
use std::path::{Path, PathBuf};
use std::process::Command;
use crate::desktop::desktop_exec_escape;
use crate::types::{BuildArgs, ProfileScope};
use crate::validation::validate_remove_id;
use directories::BaseDirs;
pub fn chromium_candidates() -> &'static [&'static str] {
&[
"google-chrome",
"chromium",
"chromium-browser",
"brave-browser",
"vivaldi",
"microsoft-edge",
]
}
pub fn find_binary_in_path(name: &str) -> Option<PathBuf> {
let path_var = env::var_os("PATH")?;
for dir in env::split_paths(&path_var) {
let candidate = dir.join(name);
if candidate.is_file() {
return Some(candidate);
}
}
None
}
pub 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::anyhow!(
"Browser binary exists but failed to run: {} ({})",
path.display(),
details
))
}
pub 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::anyhow!(
"Specified browser binary does not exist or is not a file: {}",
candidate.display()
));
}
for candidate in chromium_candidates() {
if let Some(path) = find_binary_in_path(candidate)
&& chromium_binary_works(&path).is_ok()
{
return Ok(path);
}
}
Err(anyhow::anyhow!(
"No Chromium-based browser found in PATH. Install Chromium/Chrome/Brave or use --browser-bin /path/to/browser."
))
}
pub fn chromium_profile_dir(internal_id: &str) -> Result<PathBuf> {
validate_remove_id(internal_id)?;
let base_dirs =
BaseDirs::new().ok_or_else(|| anyhow::anyhow!("Could not find system BaseDirs"))?;
Ok(base_dirs
.data_local_dir()
.join("deskify")
.join("profiles")
.join(internal_id))
}
pub fn chromium_window_size_arg(width: Option<f64>, height: Option<f64>) -> Option<String> {
match (width, height) {
(Some(w), Some(h)) => Some(format!("--window-size={},{}", w as i64, h as i64)),
_ => None,
}
}
pub fn build_chromium_exec(
args: &BuildArgs,
browser_path: &Path,
profile_dir: Option<&Path>,
) -> String {
let mut parts = vec![browser_path.display().to_string()];
parts.push("--no-first-run".to_string());
parts.push("--no-default-browser-check".to_string());
parts.push(format!("--class={}", args.internal_id));
parts.push(format!("--app={}", args.url));
if let Some(profile_dir) = profile_dir {
parts.push(format!("--user-data-dir={}", profile_dir.display()));
}
if args.fullscreen {
parts.push("--start-fullscreen".to_string());
}
if let Some(window_size) = chromium_window_size_arg(args.width, args.height) {
parts.push(window_size);
}
if let Some(user_agent) = &args.user_agent {
parts.push(format!("--user-agent={}", user_agent));
}
if args.dark_mode {
parts.push("--force-dark-mode".to_string());
}
let escaped: Vec<String> = parts.iter().map(|s| desktop_exec_escape(s)).collect();
escaped.join(" ")
}
pub fn profile_scope_str(scope: ProfileScope) -> &'static str {
match scope {
ProfileScope::Isolated => "isolated",
ProfileScope::Shared => "shared",
}
}
pub fn backend_str(backend: crate::types::Backend) -> &'static str {
match backend {
crate::types::Backend::Tauri => "tauri",
crate::types::Backend::Chromium => "chromium",
}
}

50
src/desktop.rs Normal file
View File

@@ -0,0 +1,50 @@
use anyhow::Result;
use directories::BaseDirs;
use std::path::PathBuf;
pub fn desktop_exec_escape(arg: &str) -> String {
if arg.is_empty() {
return "\"\"".to_string();
}
let needs_quotes = arg
.chars()
.any(|c| c.is_whitespace() || c == '"' || c == '\\');
if !needs_quotes {
return arg.to_string();
}
let escaped = arg.replace('\\', "\\\\").replace('"', "\\\"");
format!("\"{}\"", escaped)
}
#[allow(dead_code)]
pub fn desktop_exec_join(args: &[String]) -> String {
args.iter()
.map(|arg| desktop_exec_escape(arg))
.collect::<Vec<_>>()
.join(" ")
}
pub fn desktop_paths(internal_id: &str) -> Result<(PathBuf, PathBuf, PathBuf, PathBuf)> {
let base_dirs = BaseDirs::new()
.ok_or_else(|| anyhow::anyhow!("Could not find system BaseDirs (e.g. $HOME)"))?;
let data_local_dir = base_dirs.data_local_dir();
let executable_dir = base_dirs
.executable_dir()
.map(|p| p.to_path_buf())
.unwrap_or_else(|| base_dirs.home_dir().join(".local/bin"));
let applications_dir = data_local_dir.join("applications");
let icon_dir = data_local_dir.join("icons/hicolor/128x128/apps");
let target_bin = executable_dir.join(internal_id);
let target_icon = icon_dir.join(format!("{}.png", internal_id));
let desktop_file_path = applications_dir.join(format!("{}.desktop", internal_id));
Ok((
target_bin,
target_icon,
desktop_file_path,
data_local_dir.to_path_buf(),
))
}

93
src/doctor.rs Normal file
View File

@@ -0,0 +1,93 @@
use anyhow::Result;
use directories::BaseDirs;
use std::env;
use std::process::Command;
use crate::chromium::resolve_chromium_binary;
pub fn run_doctor() -> Result<()> {
let mut failed = false;
let checks = vec![
("cargo", vec!["--version"], true),
("rustc", vec!["--version"], true),
("pkg-config", vec!["--version"], false),
];
println!("Deskify doctor");
println!("-------------");
for (cmd, args, critical) in checks {
match Command::new(cmd).args(args).output() {
Ok(output) if output.status.success() => {
let version = String::from_utf8_lossy(&output.stdout).trim().to_string();
println!("[ok] {} {}", cmd, version);
}
_ => {
println!(
"[{}] {} not found or failed",
if critical { "fail" } else { "warn" },
cmd
);
if critical {
failed = true;
}
}
}
}
match Command::new("cargo").args(["tauri", "--version"]).output() {
Ok(output) if output.status.success() => {
println!("[ok] {}", String::from_utf8_lossy(&output.stdout).trim());
}
_ => {
println!(
"[fail] cargo tauri not available (install with: cargo install tauri-cli --version \"^2.0.0\")"
);
failed = true;
}
}
if let Ok(output) = Command::new("pkg-config")
.args(["--modversion", "webkit2gtk-4.1"])
.output()
{
if output.status.success() {
println!(
"[ok] webkit2gtk-4.1 {}",
String::from_utf8_lossy(&output.stdout).trim()
);
} else {
println!("[warn] webkit2gtk-4.1 not found via pkg-config");
}
}
match resolve_chromium_binary(None) {
Ok(path) => println!("[ok] chromium browser found: {}", path.display()),
Err(_) => println!("[warn] no chromium-based browser found in PATH"),
}
let base_dirs =
BaseDirs::new().ok_or_else(|| anyhow::anyhow!("Could not find system BaseDirs"))?;
let executable_dir = base_dirs
.executable_dir()
.map(|p| p.to_path_buf())
.unwrap_or_else(|| base_dirs.home_dir().join(".local/bin"));
let applications_dir = base_dirs.data_local_dir().join("applications");
let icons_dir = base_dirs
.data_local_dir()
.join("icons/hicolor/128x128/apps");
println!("[info] executable dir: {}", executable_dir.display());
println!("[info] applications dir: {}", applications_dir.display());
println!("[info] icons dir: {}", icons_dir.display());
if let Ok(exe) = env::current_exe() {
println!("[info] deskify path: {}", exe.display());
}
if failed {
Err(anyhow::anyhow!("Doctor found critical issues"))
} else {
println!("Doctor completed: no critical issues detected.");
Ok(())
}
}

120
src/icon.rs Normal file
View File

@@ -0,0 +1,120 @@
use anyhow::{Context, Result};
use image::{DynamicImage, ImageFormat};
use regex::Regex;
use std::fs;
use std::io::Read;
use std::path::Path;
use url::Url;
pub fn write_rgba_png(img: DynamicImage, output_path: &Path) -> Result<()> {
let rgba = img.to_rgba8();
let rgba_img = DynamicImage::ImageRgba8(rgba);
rgba_img
.save_with_format(output_path, ImageFormat::Png)
.with_context(|| format!("Failed to write RGBA PNG icon to {}", output_path.display()))?;
Ok(())
}
pub fn download_icon_from_url(icon_url: &str, output_path: &Path) -> Result<bool> {
let response = match ureq::get(icon_url).call() {
Ok(resp) => resp,
Err(_) => return Ok(false),
};
let mut bytes = Vec::new();
if response.into_reader().read_to_end(&mut bytes).is_err() || bytes.is_empty() {
return Ok(false);
}
let img = match image::load_from_memory(&bytes) {
Ok(img) => img,
Err(_) => return Ok(false),
};
write_rgba_png(img, output_path)?;
Ok(true)
}
pub fn extract_icon_candidates_from_html(base_url: &Url, html: &str) -> Vec<String> {
let link_re = Regex::new(r#"(?is)<link\s+[^>]*rel\s*=\s*["'][^"']*icon[^"']*["'][^>]*href\s*=\s*["']([^"']+)["'][^>]*>"#).unwrap();
let mut candidates = Vec::new();
for cap in link_re.captures_iter(html) {
if let Some(href) = cap.get(1)
&& let Ok(joined) = base_url.join(href.as_str())
{
let candidate = joined.to_string();
if !candidates.contains(&candidate) {
candidates.push(candidate);
}
}
}
candidates
}
pub fn try_download_site_icon(website_url: &str, output_path: &Path) -> Result<bool> {
let base_url = match Url::parse(website_url) {
Ok(url) => url,
Err(_) => return Ok(false),
};
let mut html = String::new();
if let Ok(response) = ureq::get(website_url).call()
&& response.into_reader().read_to_string(&mut html).is_ok()
{
for icon_url in extract_icon_candidates_from_html(&base_url, &html) {
if download_icon_from_url(&icon_url, output_path)? {
return Ok(true);
}
}
}
if let Ok(favicon_url) = base_url.join("/favicon.ico")
&& download_icon_from_url(favicon_url.as_str(), output_path)?
{
return Ok(true);
}
Ok(false)
}
pub fn fetch_or_create_icon(
website_url: &str,
custom_icon: Option<&String>,
output_path: &Path,
) -> Result<()> {
if let Some(icon_path) = custom_icon {
if Path::new(icon_path).exists() {
let img = image::open(icon_path)
.with_context(|| format!("Failed to read custom icon image from {}", icon_path))?;
write_rgba_png(img, output_path)?;
return Ok(());
} else {
eprintln!(
"Warning: Custom icon path '{}' does not exist, falling back to downloaded icon.",
icon_path
);
}
}
if try_download_site_icon(website_url, output_path)? {
return Ok(());
}
if let Ok(parsed_url) = Url::parse(website_url)
&& let Some(host) = parsed_url.host_str()
{
println!("Falling back to Google favicon API for {}...", host);
let api_url = format!("https://www.google.com/s2/favicons?domain={}&sz=128", host);
if download_icon_from_url(&api_url, output_path)? {
return Ok(());
}
}
let dummy_png: [u8; 67] = [
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44,
0x52, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f,
0x15, 0xc4, 0x89, 0x00, 0x00, 0x00, 0x0a, 0x49, 0x44, 0x41, 0x54, 0x78, 0x9c, 0x63, 0x00,
0x01, 0x00, 0x00, 0x05, 0x00, 0x01, 0x0d, 0x0a, 0x2d, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x49,
0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
];
fs::write(output_path, dummy_png).context("Failed to write dummy icon fallback")?;
Ok(())
}

141
src/install.rs Normal file
View File

@@ -0,0 +1,141 @@
use anyhow::{Context, Result};
use std::fs;
use std::path::Path;
use crate::chromium::{
build_chromium_exec, chromium_profile_dir, profile_scope_str, resolve_chromium_binary,
};
use crate::desktop::desktop_paths;
use crate::types::{BuildArgs, ProfileScope};
pub fn install_tauri_app(args: &BuildArgs, bin_path: &Path, icon_path: &Path) -> Result<()> {
let (target_bin, target_icon, desktop_file_path, _data_local_dir) =
desktop_paths(&args.internal_id)?;
let executable_dir = target_bin
.parent()
.ok_or_else(|| anyhow::anyhow!("Invalid executable target path"))?;
let icon_dir = target_icon
.parent()
.ok_or_else(|| anyhow::anyhow!("Invalid icon target path"))?;
let applications_dir = desktop_file_path
.parent()
.ok_or_else(|| anyhow::anyhow!("Invalid applications target path"))?;
fs::create_dir_all(executable_dir).context("Failed to create ~/.local/bin directory")?;
fs::copy(bin_path, &target_bin).context("Failed to move binary to installation directory")?;
fs::create_dir_all(icon_dir).context("Failed to create icons directory")?;
if icon_path.exists() {
let _ = fs::copy(icon_path, &target_icon);
}
fs::create_dir_all(applications_dir).context("Failed to create applications directory")?;
let desktop_entry = format!(
r#"
[Desktop Entry]
Version=1.0
Name={}
Exec={}
Icon={}
StartupWMClass={}
Terminal=false
Type=Application
Categories=Network;WebBrowser;
X-Deskify-Managed=true
X-Deskify-Backend=tauri
"#,
args.name,
target_bin.to_string_lossy(),
args.internal_id,
args.internal_id
);
fs::write(&desktop_file_path, desktop_entry.trim()).context("Failed to write .desktop file")?;
println!("App successfully installed!");
println!(
"You can now launch '{}' from your application menu.",
args.name
);
Ok(())
}
pub fn install_chromium_app(args: &BuildArgs, icon_path: &Path) -> Result<()> {
let browser = resolve_chromium_binary(args.browser_bin.as_deref())?;
let profile_dir = match args.profile_scope {
ProfileScope::Isolated => Some(chromium_profile_dir(&args.internal_id)?),
ProfileScope::Shared => None,
};
if matches!((args.width, args.height), (Some(_), None) | (None, Some(_))) {
eprintln!(
"Warning: Chromium backend requires both --width and --height for --window-size; ignoring partial size override."
);
}
if args.no_decorations {
eprintln!(
"Warning: --no-decorations is not reliably supported in Chromium app mode and may be ignored."
);
}
let (target_bin, target_icon, desktop_file_path, _data_local_dir) =
desktop_paths(&args.internal_id)?;
let icon_dir = target_icon
.parent()
.ok_or_else(|| anyhow::anyhow!("Invalid icon target path"))?;
let applications_dir = desktop_file_path
.parent()
.ok_or_else(|| anyhow::anyhow!("Invalid applications target path"))?;
fs::create_dir_all(icon_dir).context("Failed to create icons directory")?;
fs::create_dir_all(applications_dir).context("Failed to create applications directory")?;
if let Some(profile_dir) = &profile_dir {
fs::create_dir_all(profile_dir).context("Failed to create Chromium profile directory")?;
}
let _ = fs::copy(icon_path, &target_icon);
let exec = build_chromium_exec(args, &browser, profile_dir.as_deref());
let desktop_entry = format!(
r#"
[Desktop Entry]
Version=1.0
Name={}
Exec={}
Icon={}
StartupWMClass={}
Terminal=false
Type=Application
Categories=Network;WebBrowser;
X-Deskify-Managed=true
X-Deskify-Backend=chromium
X-Deskify-URL={}
X-Deskify-ProfileScope={}
X-Deskify-Browser={}
"#,
args.name,
exec,
args.internal_id,
args.internal_id,
args.url,
profile_scope_str(args.profile_scope),
browser.display()
);
fs::write(&desktop_file_path, desktop_entry.trim()).context("Failed to write .desktop file")?;
if target_bin.exists() {
println!(
"Note: existing binary {} left in place (Chromium backend does not use it).",
target_bin.display()
);
}
println!("App successfully installed (Chromium backend)!");
println!(
"You can now launch '{}' from your application menu.",
args.name
);
Ok(())
}

File diff suppressed because it is too large Load Diff

156
src/tauri.rs Normal file
View File

@@ -0,0 +1,156 @@
use anyhow::{Context, Result};
use serde_json::{Map, Value, json};
use std::fs;
use std::path::{Path, PathBuf};
use std::process::Command;
use crate::types::BuildArgs;
pub fn build_tauri_config_value(
args: &BuildArgs,
safe_identifier: &str,
bundle_active: bool,
) -> Value {
let mut window_config = Map::<String, Value>::new();
window_config.insert("title".to_string(), json!(args.name));
window_config.insert("url".to_string(), json!(args.url));
if args.fullscreen {
window_config.insert("fullscreen".to_string(), json!(true));
}
if args.no_decorations {
window_config.insert("decorations".to_string(), json!(false));
}
if let Some(ua) = &args.user_agent {
window_config.insert("userAgent".to_string(), json!(ua));
}
if let Some(w) = args.width {
window_config.insert("width".to_string(), json!(w));
}
if let Some(h) = args.height {
window_config.insert("height".to_string(), json!(h));
}
if args.dark_mode {
window_config.insert("theme".to_string(), json!("Dark"));
}
json!({
"$schema": "https://schema.tauri.app/config/2",
"productName": args.name,
"version": "0.1.0",
"identifier": format!("com.deskify.{}", safe_identifier),
"build": {
"frontendDist": "dist"
},
"app": {
"windows": [Value::Object(window_config)],
"security": { "csp": null }
},
"bundle": {
"active": bundle_active,
"targets": "all",
"icon": ["icons/icon.png"]
}
})
}
pub fn generate_project(args: &BuildArgs, project_dir: &Path, icon_path: &Path) -> Result<()> {
let src_dir = project_dir.join("src");
fs::create_dir_all(&src_dir).context("Failed to create src directory")?;
let cargo_toml = r#"
[package]
name = "deskify-app"
version = "0.1.0"
description = "A native application wrapper"
authors = ["deskify"]
edition = "2021"
[dependencies]
tauri = { version = "2.0.0", features = [] }
[build-dependencies]
tauri-build = "2.0.0"
"#;
fs::write(project_dir.join("Cargo.toml"), cargo_toml).context("Failed to write Cargo.toml")?;
let build_rs = r#"
fn main() {
tauri_build::build()
}
"#;
fs::write(project_dir.join("build.rs"), build_rs).context("Failed to write build.rs")?;
let main_rs = r#"
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
fn main() {
tauri::Builder::default()
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
"#;
fs::write(src_dir.join("main.rs"), main_rs).context("Failed to write src/main.rs")?;
let dist_dir = project_dir.join("dist");
fs::create_dir_all(&dist_dir).context("Failed to create dist directory")?;
fs::write(
dist_dir.join("index.html"),
"<!DOCTYPE html><html><body></body></html>",
)
.context("Failed to write dummy index.html")?;
let icons_dir = project_dir.join("icons");
fs::create_dir_all(&icons_dir).context("Failed to create icons directory")?;
fs::copy(icon_path, icons_dir.join("icon.png")).context("Failed to copy icon")?;
let tauri_conf = build_tauri_config_value(args, &args.internal_id, false);
fs::write(
project_dir.join("tauri.conf.json"),
serde_json::to_string_pretty(&tauri_conf).context("Failed to serialize tauri.conf.json")?,
)
.context("Failed to write tauri.conf.json")?;
Ok(())
}
pub fn build_project(project_dir: &Path) -> Result<PathBuf> {
let tauri_check = Command::new("cargo")
.arg("tauri")
.arg("--version")
.output()
.context("Failed to execute `cargo`. Make sure rust/cargo is installed.")?;
if !tauri_check.status.success() {
return Err(anyhow::anyhow!(
"Tauri CLI is not installed or not working.\nPlease install it by running:\n cargo install tauri-cli --version \"^2.0.0\""
));
}
println!("Building native app (this may take a few minutes the first time)...");
let status = Command::new("cargo")
.arg("tauri")
.arg("build")
.current_dir(project_dir)
.status()
.context("Failed to execute `cargo tauri build`")?;
if !status.success() {
return Err(anyhow::anyhow!("Tauri build completed with an error"));
}
let bin_path = project_dir.join("target/release/deskify-app");
if bin_path.exists() {
println!("Successfully built binary at {:?}", bin_path);
Ok(bin_path)
} else {
Err(anyhow::anyhow!(
"Binary not found after build (expected at {:?})",
bin_path
))
}
}

161
src/types.rs Normal file
View File

@@ -0,0 +1,161 @@
use clap::{Parser, Subcommand};
#[derive(
clap::ValueEnum, serde::Serialize, serde::Deserialize, Debug, Clone, Copy, PartialEq, Eq,
)]
#[serde(rename_all = "lowercase")]
pub enum Backend {
Tauri,
Chromium,
}
#[derive(
clap::ValueEnum, serde::Serialize, serde::Deserialize, Debug, Clone, Copy, PartialEq, Eq,
)]
#[serde(rename_all = "lowercase")]
pub enum ProfileScope {
#[serde(alias = "default")]
Isolated,
Shared,
}
#[derive(Debug, Clone)]
pub struct BuildArgs {
pub url: String,
pub name: String,
pub internal_id: String,
pub icon: Option<String>,
pub fullscreen: bool,
pub no_decorations: bool,
pub user_agent: Option<String>,
pub width: Option<f64>,
pub height: Option<f64>,
pub dark_mode: bool,
pub backend: Backend,
pub browser_bin: Option<String>,
pub profile_scope: ProfileScope,
}
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
pub struct DeskifyAppConfig {
pub schema_version: u32,
pub id: String,
pub name: String,
pub url: String,
pub backend: Backend,
pub browser_bin: Option<String>,
pub profile_scope: ProfileScope,
pub fullscreen: bool,
pub no_decorations: bool,
pub user_agent: Option<String>,
pub width: Option<f64>,
pub height: Option<f64>,
pub dark_mode: bool,
}
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand, Debug)]
pub enum Commands {
Build {
#[arg(short, long)]
url: String,
#[arg(short, long)]
name: String,
#[arg(short, long)]
icon: Option<String>,
#[arg(short, long)]
fullscreen: bool,
#[arg(long)]
no_decorations: bool,
#[arg(short = 'A', long)]
user_agent: Option<String>,
#[arg(short = 'W', long)]
width: Option<f64>,
#[arg(short = 'H', long)]
height: Option<f64>,
#[arg(short, long)]
dark_mode: bool,
#[arg(long, value_enum, default_value_t = Backend::Tauri)]
backend: Backend,
#[arg(long)]
browser_bin: Option<String>,
#[arg(long, value_enum, default_value_t = ProfileScope::Isolated)]
profile_scope: ProfileScope,
#[arg(long)]
print_config: bool,
#[arg(long)]
dry_run: bool,
},
List {
#[arg(long)]
verbose: bool,
},
Doctor,
Remove {
id: String,
},
Update {
id: String,
#[arg(short, long)]
url: Option<String>,
#[arg(short, long)]
name: Option<String>,
#[arg(short, long)]
icon: Option<String>,
#[arg(short, long, action = clap::ArgAction::SetTrue)]
fullscreen: Option<bool>,
#[arg(long, action = clap::ArgAction::SetTrue)]
no_decorations: Option<bool>,
#[arg(short = 'A', long)]
user_agent: Option<String>,
#[arg(short = 'W', long)]
width: Option<f64>,
#[arg(short = 'H', long)]
height: Option<f64>,
#[arg(short, long, action = clap::ArgAction::SetTrue)]
dark_mode: Option<bool>,
#[arg(long, value_enum)]
backend: Option<Backend>,
#[arg(long)]
browser_bin: Option<String>,
#[arg(long, value_enum)]
profile_scope: Option<ProfileScope>,
#[arg(long)]
dry_run: bool,
#[arg(long)]
print_config: bool,
},
}

31
src/validation.rs Normal file
View File

@@ -0,0 +1,31 @@
use anyhow::{Result, anyhow};
use regex::Regex;
pub fn sanitize_app_id(name: &str) -> String {
let re = Regex::new(r"[^a-z0-9-]").unwrap();
let lower_name = name.to_lowercase().replace(' ', "-");
let sanitized = re.replace_all(&lower_name, "");
if sanitized.is_empty() {
"app".to_string()
} else {
sanitized.to_string()
}
}
pub fn validate_remove_id(id: &str) -> Result<()> {
let re = Regex::new(r"^[a-z0-9-]+$").unwrap();
if re.is_match(id) {
Ok(())
} else {
Err(anyhow!(
"Invalid app ID '{}'. Allowed characters: lowercase letters, numbers, and '-'.",
id
))
}
}
pub fn is_deskify_desktop_entry(content: &str) -> bool {
content.contains("X-Deskify-Managed=true")
|| (content.contains("Categories=Network;WebBrowser;")
&& (content.contains(".local/bin/") || content.contains("deskify")))
}