electrobun 0.1.3 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/dist/api/bun/core/Tray.ts +20 -9
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
## What is Electrobun?
|
|
10
10
|
|
|
11
|
-
> Electrobun is in the **_very_** early stages. We currently support development on macOS, Windows, and Linux
|
|
11
|
+
> Electrobun is in the **_very_** early stages. We currently support development on macOS, Windows, and Linux. You can also bundle your app for these platform targets and cross-bundle them from a mac. We're actively working on stabilizing so any bug reports, especially on different platforms are most welcome.
|
|
12
12
|
|
|
13
13
|
Electrobun aims to be a complete **solution-in-a-box** for building, updating, and shipping ultra fast, tiny, and cross-platform desktop applications written in Typescript.
|
|
14
14
|
Under the hood it uses <a href="https://bun.sh">bun</a> to execute the main process and to bundle webview typescript, and has native bindings written in <a href="https://ziglang.org/">zig</a>.
|
|
@@ -60,13 +60,17 @@ Ways to get involved at this early stage:
|
|
|
60
60
|
- cmake
|
|
61
61
|
- webkit2gtk and GTK development packages
|
|
62
62
|
|
|
63
|
+
Un Ubuntu/Debian based distros: `sudo apt install build-essential cmake pkg-config libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev`
|
|
64
|
+
|
|
63
65
|
### First-time Setup
|
|
64
66
|
|
|
65
67
|
```bash
|
|
66
|
-
git clone
|
|
68
|
+
git clone --recurse-submodules https://github.com/blackboardsh/electrobun.git
|
|
67
69
|
cd electrobun
|
|
68
70
|
bun install
|
|
69
71
|
bun dev:playground:clean
|
|
72
|
+
# On Linux, use:
|
|
73
|
+
bun dev:playground:clean:linux
|
|
70
74
|
```
|
|
71
75
|
|
|
72
76
|
### Development Workflow
|
|
@@ -74,12 +78,16 @@ bun dev:playground:clean
|
|
|
74
78
|
```bash
|
|
75
79
|
# After making changes to source code
|
|
76
80
|
bun dev:playground
|
|
81
|
+
# On Linux, use:
|
|
82
|
+
bun dev:playground:linux
|
|
77
83
|
|
|
78
84
|
# If you only changed playground code (not electrobun source)
|
|
79
85
|
bun dev:playground:rerun
|
|
80
86
|
|
|
81
87
|
# If you need a completely fresh start
|
|
82
88
|
bun dev:playground:clean
|
|
89
|
+
# On Linux, use:
|
|
90
|
+
bun dev:playground:clean:linux
|
|
83
91
|
```
|
|
84
92
|
|
|
85
93
|
### Additional Commands
|
|
@@ -26,14 +26,20 @@ export class Tray {
|
|
|
26
26
|
width = 16,
|
|
27
27
|
height = 16,
|
|
28
28
|
}: ConstructorOptions = {}) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
try {
|
|
30
|
+
this.ptr = ffi.request.createTray({
|
|
31
|
+
id: this.id,
|
|
32
|
+
title,
|
|
33
|
+
image: this.resolveImagePath(image),
|
|
34
|
+
template,
|
|
35
|
+
width,
|
|
36
|
+
height,
|
|
37
|
+
});
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.warn('Tray creation failed:', error);
|
|
40
|
+
console.warn('System tray functionality may not be available on this platform');
|
|
41
|
+
this.ptr = null;
|
|
42
|
+
}
|
|
37
43
|
|
|
38
44
|
TrayMap[this.id] = this;
|
|
39
45
|
}
|
|
@@ -48,10 +54,12 @@ export class Tray {
|
|
|
48
54
|
}
|
|
49
55
|
|
|
50
56
|
setTitle(title: string) {
|
|
57
|
+
if (!this.ptr) return;
|
|
51
58
|
ffi.request.setTrayTitle({ id: this.id, title });
|
|
52
59
|
}
|
|
53
60
|
|
|
54
61
|
setImage(imgPath: string) {
|
|
62
|
+
if (!this.ptr) return;
|
|
55
63
|
ffi.request.setTrayImage({
|
|
56
64
|
id: this.id,
|
|
57
65
|
image: this.resolveImagePath(imgPath),
|
|
@@ -59,6 +67,7 @@ export class Tray {
|
|
|
59
67
|
}
|
|
60
68
|
|
|
61
69
|
setMenu(menu: Array<MenuItemConfig>) {
|
|
70
|
+
if (!this.ptr) return;
|
|
62
71
|
const menuWithDefaults = menuConfigWithDefaults(menu);
|
|
63
72
|
ffi.request.setTrayMenu({
|
|
64
73
|
id: this.id,
|
|
@@ -73,7 +82,9 @@ export class Tray {
|
|
|
73
82
|
|
|
74
83
|
remove() {
|
|
75
84
|
console.log('Tray.remove() called for id:', this.id);
|
|
76
|
-
|
|
85
|
+
if (this.ptr) {
|
|
86
|
+
ffi.request.removeTray({ id: this.id });
|
|
87
|
+
}
|
|
77
88
|
delete TrayMap[this.id];
|
|
78
89
|
console.log('Tray removed from TrayMap');
|
|
79
90
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "electrobun",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Build ultra fast, tiny, and cross-platform desktop apps with Typescript.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Blackboard Technologies Inc.",
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
"build:release": "bun build.ts --release",
|
|
34
34
|
"dev:playground": "bun build:dev && bun build:cli && cd playground && npm install && bun build:dev && bun start",
|
|
35
35
|
"dev:playground:linux": "bun build:dev && npm link && cd playground && npm link electrobun && bun build:dev && bun start",
|
|
36
|
-
"dev:playground:clean": "cd playground && rm -rf node_modules && npm install && cd .. && bun dev:playground",
|
|
36
|
+
"dev:playground:clean": "cd playground && rm -rf node_modules && rm -rf vendors/cef && npm install && cd .. && bun dev:playground",
|
|
37
|
+
"dev:playground:clean:linux": "cd playground && rm -rf node_modules && rm -rf vendors/cef && npm install && cd .. && bun dev:playground:linux",
|
|
37
38
|
"dev:playground:rerun": "cd playground && bun start",
|
|
38
39
|
"dev:playground:canary": "bun build:release && cd playground && npm install && bun build:canary && bun start:canary",
|
|
39
40
|
"run:playground": "bun build:dev && bun build:cli && cd templates/interactive-playground && npm install && bun build:dev && bun start",
|