Moved from electrobun to tauri+cef

This commit is contained in:
Alois 2026-04-06 15:21:04 +02:00
commit 8a12ca7234
114 changed files with 822 additions and 513 deletions

1
.gitignore vendored
View file

@ -1,2 +1 @@
node_modules node_modules
packages/socket

View file

@ -4,5 +4,4 @@ coverage
.tmp .tmp
*.tsbuildinfo *.tsbuildinfo
bun.lock bun.lock
apps/desktop/build apps/tauri/src-tauri
apps/mobile/src-tauri

View file

@ -1 +0,0 @@
build

View file

@ -1,46 +0,0 @@
import type { ElectrobunConfig } from "electrobun";
import { version } from "../../package.json";
export default {
app: {
name: "tensamin",
identifier: "client.tensamin.net",
version,
urlSchemes: ["tensamin"],
},
build: {
useAsar: true,
views: {
mainview: {
entrypoint: "src/mainview/index.ts",
},
},
copy: {
"../web/dist/": "views/mainview/",
"../mobile/src-tauri/icons": "views/mainview/icons/",
},
mac: {
icons: "",
bundleWGPU: false,
defaultRenderer: "cef",
bundleCEF: true,
},
linux: {
icon: "../mobile/src-tauri/icons/icon.png",
bundleWGPU: false,
defaultRenderer: "cef",
bundleCEF: true,
chromiumFlags: {
"enable-features": "UseOzonePlatform",
"ozone-platform": "wayland",
},
},
win: {
icon: "../mobile/src-tauri/icons/icon.ico",
bundleWGPU: false,
defaultRenderer: "cef",
bundleCEF: true,
},
},
} satisfies ElectrobunConfig;

View file

@ -1,24 +0,0 @@
# Electrobun Project
This is an Electrobun desktop application.
IMPORTANT: Electrobun is NOT Electron. Do not use Electron APIs or patterns.
## Documentation
Full API reference: https://blackboard.sh/electrobun/llms.txt
Getting started: https://blackboard.sh/electrobun/docs/
## Quick Reference
Import patterns:
- Main process (Bun): `import { BrowserWindow } from "electrobun/bun"`
- Browser context: `import { Electroview } from "electrobun/view"`
Use `views://` URLs to load bundled assets (e.g., `url: "views://mainview/index.html"`).
Views must be configured in `electrobun.config.ts` to be built and copied into the bundle.
## About
Electrobun is built by Blackboard (https://blackboard.sh), an innovation lab building
tools and funding teams that define the next generation of technology.

View file

@ -1,19 +0,0 @@
{
"name": "electrobun-hello-world",
"version": "1.0.0",
"description": "A simple Electrobun app showcasing core features",
"scripts": {
"format": "bunx prettier --write .",
"lint": "echo desktop lint skipped",
"build": "electrobun build",
"start": "electrobun dev",
"dev": "electrobun dev --watch"
},
"dependencies": {
"electrobun": "1.15.1",
"@tensamin/shared": "workspace:*"
},
"devDependencies": {
"@types/bun": "latest"
}
}

View file

@ -1,41 +0,0 @@
{pkgs ? import <nixpkgs> {}}: let
libs = with pkgs; [
nspr
nss
libxcb
libxkbcommon
wayland
libdecor
dbus
atk
glib
gtk3
cups
libx11
libxcomposite
libxdamage
libxext
libxfixes
libxrandr
libgbm
expat
cairo
pango
alsa-lib
webkitgtk_4_1
libsoup_3
libayatana-appindicator
gdk-pixbuf
];
in
pkgs.mkShell {
buildInputs = [pkgs.bun] ++ libs;
shellHook = ''
export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath libs}:$LD_LIBRARY_PATH
export GDK_BACKEND=wayland
export OZONE_PLATFORM=wayland
export XDG_SESSION_TYPE=wayland
'';
}

View file

@ -1,28 +0,0 @@
import { BrowserWindow, Tray } from "electrobun/bun";
const tray = new Tray({
title: "Tensamin",
image: "views://mainview/icons/64x64.png",
height: 64,
width: 64,
});
const mainWindow = new BrowserWindow({
title: "Tensamin",
url: "views://mainview/index.html",
renderer: "cef",
frame: {
width: 800,
height: 800,
x: 200,
y: 200,
},
});
mainWindow.url = "views://mainview/index.html";
tray.on("tray-clicked", () => {
console.log("Tray clicked");
});
console.log("Started desktop app");

View file

@ -1,126 +0,0 @@
* {
box-sizing: border-box;
}
body {
font-family:
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
Cantarell, sans-serif;
margin: 0;
padding: 0;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: #333;
min-height: 100vh;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 40px 20px;
}
h1 {
color: white;
font-size: 3rem;
text-align: center;
margin-bottom: 8px;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.subtitle {
color: rgba(255, 255, 255, 0.9);
font-size: 1.25rem;
text-align: center;
margin-top: 0;
margin-bottom: 40px;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.welcome-section {
background: white;
border-radius: 12px;
padding: 30px;
margin: 30px 0;
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
line-height: 1.6;
}
h2 {
color: #2563eb;
margin-top: 30px;
margin-bottom: 15px;
}
ul {
margin: 20px 0;
padding-left: 20px;
}
li {
margin: 8px 0;
}
.links {
display: flex;
gap: 15px;
margin: 25px 0;
flex-wrap: wrap;
}
.doc-link {
display: inline-block;
background: #2563eb;
color: white;
text-decoration: none;
padding: 12px 20px;
border-radius: 8px;
font-weight: 500;
transition: all 0.2s ease;
box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}
.doc-link:hover {
background: #1d4ed8;
transform: translateY(-1px);
box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}
code {
background: #f1f5f9;
color: #475569;
padding: 2px 6px;
border-radius: 4px;
font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
font-size: 0.9em;
}
.footer {
text-align: center;
color: rgba(255, 255, 255, 0.8);
margin-top: 40px;
padding: 20px;
background: rgba(255, 255, 255, 0.1);
border-radius: 8px;
backdrop-filter: blur(10px);
}
.footer p {
margin: 8px 0;
}
/* Dark mode support */
@media (prefers-color-scheme: dark) {
.welcome-section {
background: #1f2937;
color: #f3f4f6;
}
h2 {
color: #60a5fa;
}
code {
background: #374151;
color: #d1d5db;
}
}

View file

@ -1,64 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Hello Electrobun!</title>
<link rel="stylesheet" href="index.css" />
</head>
<body>
<div class="container">
<h1>Hello Electrobun! 🎉</h1>
<p class="subtitle">A fast, cross-platform desktop app framework</p>
<div class="welcome-section">
<p>
Welcome to your first Electrobun app! This framework combines the
power of Bun with native desktop capabilities.
</p>
<h2>What is Electrobun?</h2>
<ul>
<li>
<strong>Fast:</strong> Built on Bun's lightning-fast JavaScript
runtime
</li>
<li>
<strong>Native:</strong> Access to system APIs like menus, trays,
and file dialogs
</li>
<li>
<strong>Cross-platform:</strong> Works on macOS, Windows, and Linux
</li>
<li>
<strong>Web-based UI:</strong> Use familiar HTML, CSS, and
JavaScript for your interface
</li>
</ul>
<h2>Get Started</h2>
<p>
Ready to build something amazing? Check out the documentation and
examples:
</p>
<div class="links">
<a href="https://electrobun.dev/" class="doc-link"> 📚 Electrobun </a>
<a href="https://github.com/blackboardsh/electrobun" class="doc-link">
🐙 GitHub Repository
</a>
<a href="https://electrobun.dev/docs/apis/bun/" class="doc-link">
💡 Api Docs
</a>
</div>
</div>
<div class="footer">
<p>
Edit <code>src/bun/index.ts</code> and <code>src/mainview/</code> to
customize your app
</p>
</div>
</div>
</body>
</html>

View file

@ -1 +0,0 @@
console.log("Hello Electrobun view loaded!");

View file

@ -1,22 +0,0 @@
{
"compilerOptions": {
"lib": ["ESNext", "DOM"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noPropertyAccessFromIndexSignature": true
},
"include": ["src/**/*", "./electrobun.config.ts"],
"exclude": ["node_modules", "dist", "build", "../../package/dist"]
}

View file

@ -1,25 +0,0 @@
{
"name": "@tensamin/mobile",
"private": true,
"version": "0.0.0",
"type": "module",
"exports": {
"./context": "./src/context.tsx"
},
"scripts": {
"dev:raw": "tauri android dev",
"build:raw": "tauri android build",
"dev": "if command -v nix >/dev/null 2>&1; then nix develop --command bun dev:raw; else bun dev:raw; fi",
"build": "if command -v nix >/dev/null 2>&1; then nix develop --command bun build:raw; else bun build:raw; fi",
"gen-icons": "tauri icon ./logo.png"
},
"dependencies": {
"@tauri-apps/api": "^2",
"@tauri-apps/plugin-opener": "^2",
"react": "^19.2.0",
"react-dom": "^19.2.0"
},
"devDependencies": {
"@tauri-apps/cli": "^2"
}
}

View file

@ -1,5 +1,5 @@
{ {
description = "Tauri Android development environment"; description = "Tauri development environment";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
@ -7,10 +7,15 @@
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = { self, nixpkgs, rust-overlay, flake-utils }: outputs = {
flake-utils.lib.eachDefaultSystem (system: self,
let nixpkgs,
overlays = [ (import rust-overlay) ]; rust-overlay,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system: let
overlays = [(import rust-overlay)];
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system overlays; inherit system overlays;
config = { config = {
@ -28,17 +33,17 @@
cmdLineToolsVersion = "8.0"; cmdLineToolsVersion = "8.0";
toolsVersion = "26.1.1"; toolsVersion = "26.1.1";
platformToolsVersion = "35.0.2"; platformToolsVersion = "35.0.2";
buildToolsVersions = [ "35.0.0" ]; buildToolsVersions = ["35.0.0"];
platformVersions = [ "35" "36" ]; platformVersions = ["35" "36"];
includeSources = false; includeSources = false;
includeSystemImages = false; includeSystemImages = false;
includeNDK = true; includeNDK = true;
ndkVersions = [ ndkVersion ]; ndkVersions = [ndkVersion];
useGoogleAPIs = false; useGoogleAPIs = false;
}; };
rustToolchain = pkgs.rust-bin.stable.latest.default.override { rustToolchain = pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" "rust-analyzer" ]; extensions = ["rust-src" "rust-analyzer"];
targets = [ targets = [
"aarch64-linux-android" "aarch64-linux-android"
"armv7-linux-androideabi" "armv7-linux-androideabi"
@ -48,13 +53,46 @@
]; ];
}; };
desktopRuntimeLibs = with pkgs; [
glib
gtk3
gdk-pixbuf
pango
cairo
atk
at-spi2-atk
alsa-lib
dbus
cups
expat
libdrm
libgbm
libglvnd
mesa
libxkbcommon
libx11
libxcomposite
libxdamage
libxext
libxfixes
libxrandr
libxcb
systemd
nspr
nss
];
in { in {
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [ buildInputs = with pkgs;
[
jdk17 jdk17
rustToolchain rustToolchain
gradle gradle
nodejs nodejs
pkg-config
]
++ desktopRuntimeLibs
++ [
android.androidsdk android.androidsdk
pkgs.android-studio-tools pkgs.android-studio-tools
]; ];
@ -62,7 +100,6 @@
shellHook = '' shellHook = ''
sdkSource="${android.androidsdk}/libexec/android-sdk" sdkSource="${android.androidsdk}/libexec/android-sdk"
# Build a Tauri-compatible SDK layout in a writable local directory.
mkdir -p "${androidHome}" mkdir -p "${androidHome}"
if [ -L "${sdkRoot}" ]; then if [ -L "${sdkRoot}" ]; then
rm -f "${sdkRoot}" rm -f "${sdkRoot}"
@ -93,8 +130,7 @@
export NDK_HOME="$ANDROID_NDK_ROOT" export NDK_HOME="$ANDROID_NDK_ROOT"
export NDK_PATH="$ANDROID_NDK_ROOT" export NDK_PATH="$ANDROID_NDK_ROOT"
export JAVA_HOME="${pkgs.jdk17}" export JAVA_HOME="${pkgs.jdk17}"
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath desktopRuntimeLibs}:$LD_LIBRARY_PATH"
echo "Android development environment ready!"
''; '';
}; };
} }

View file

Before

Width:  |  Height:  |  Size: 997 KiB

After

Width:  |  Height:  |  Size: 997 KiB

Before After
Before After

31
apps/tauri/package.json Normal file
View file

@ -0,0 +1,31 @@
{
"name": "@tensamin/tauri",
"private": true,
"version": "0.0.0",
"type": "module",
"exports": {
"./context": "./src/context.tsx"
},
"scripts": {
"dev:mobile:raw": "tauri android dev",
"build:mobile:raw": "tauri android build",
"dev:mobile": "if command -v nix >/dev/null 2>&1; then nix develop --command bun dev:mobile:raw; else bun dev:mobile:raw; fi",
"build:mobile": "if command -v nix >/dev/null 2>&1; then nix develop --command bun build:mobile:raw; else bun build:mobile:raw; fi",
"dev:desktop:raw": "tauri dev",
"build:desktop:raw": "tauri build",
"dev:desktop": "if command -v nix >/dev/null 2>&1; then nix develop --command bun dev:desktop:raw; else bun dev:desktop:raw; fi",
"build:desktop": "if command -v nix >/dev/null 2>&1; then nix develop --command bun build:desktop:raw; else bun build:desktop:raw; fi",
"gen-icons": "tauri icon ./logo.png"
},
"dependencies": {
"@tauri-apps/api": "^2",
"@tauri-apps/plugin-opener": "^2",
"react": "^19.2.0",
"react-dom": "^19.2.0"
},
"devDependencies": {
"@tauri-apps/cli": "^2"
}
}

4
apps/tauri/readme.md Normal file
View file

@ -0,0 +1,4 @@
# Outputs
- ./src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release.apk
- ./src-tauri/target/release/bundle/deb/Tensamin_{version}_{arch}.deb
- ./src-tauri/target/release/bundle/rpm/Tensamin-{version}-1.{arch}.rpm

File diff suppressed because it is too large Load diff

View file

@ -18,8 +18,20 @@ crate-type = ["staticlib", "cdylib", "rlib"]
tauri-build = { version = "2", features = [] } tauri-build = { version = "2", features = [] }
[dependencies] [dependencies]
tauri = { version = "2", features = [] }
tauri-plugin-opener = "2" tauri-plugin-opener = "2"
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_json = "1" serde_json = "1"
[target.'cfg(target_os = "android")'.dependencies.tauri]
version = "2"
features = []
default-features = true
[target.'cfg(not(target_os = "android"))'.dependencies.tauri]
version = "2"
features = ["cef"]
default-features = true
[patch.crates-io.tauri]
git = "https://github.com/tauri-apps/tauri"
branch = "feat/cef"

View file

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1,001 B

After

Width:  |  Height:  |  Size: 1,001 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 190 KiB

After

Width:  |  Height:  |  Size: 190 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 6 KiB

After

Width:  |  Height:  |  Size: 6 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before After
Before After

Some files were not shown because too many files have changed in this diff Show more