dsh-clean-desktop-shell 0.1.11 → 0.1.12
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/CONTRIBUTORS.md +19 -19
- package/README.en.md +341 -333
- package/README.md +286 -278
- package/electron/aumid.js +17 -17
- package/electron/crashGuard.js +60 -60
- package/electron/error.html +113 -113
- package/electron/main.js +203 -187
- package/electron/preload.js +49 -49
- package/electron/progress-preload.js +11 -11
- package/electron/progress.html +79 -79
- package/electron/progress.js +56 -56
- package/electron/service.js +521 -458
- package/electron/shortcut.js +122 -122
- package/electron/tray.js +232 -232
- package/electron/window.js +380 -264
- package/lib/common.js +74 -74
- package/lib/icon.js +51 -51
- package/lib/index.js +57 -13
- package/lib/runtime.js +423 -423
- package/package.json +1 -1
- package/scripts/check-syntax.mjs +54 -54
- package/scripts/selftest-runtime.mjs +90 -90
- package/src/host/common.js +74 -74
- package/src/host/icon.js +51 -51
- package/src/host/index.js +57 -13
- package/src/host/runtime.js +423 -423
- package/version.txt +1 -1
package/electron/progress.html
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="zh-CN">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; style-src 'unsafe-inline'; script-src 'unsafe-inline'" />
|
|
6
|
-
<title>后端操作</title>
|
|
7
|
-
<style>
|
|
8
|
-
html, body {
|
|
9
|
-
margin: 0;
|
|
10
|
-
height: 100%;
|
|
11
|
-
background: #10131A;
|
|
12
|
-
color: #9aa3b2;
|
|
13
|
-
font-family: system-ui, "Segoe UI", "Microsoft YaHei", sans-serif;
|
|
14
|
-
-webkit-user-select: none;
|
|
15
|
-
user-select: none;
|
|
16
|
-
overflow: hidden;
|
|
17
|
-
}
|
|
18
|
-
.wrap {
|
|
19
|
-
height: 100%;
|
|
20
|
-
box-sizing: border-box;
|
|
21
|
-
padding: 18px 22px;
|
|
22
|
-
display: flex;
|
|
23
|
-
flex-direction: column;
|
|
24
|
-
gap: 12px;
|
|
25
|
-
}
|
|
26
|
-
.title {
|
|
27
|
-
font-size: 14px;
|
|
28
|
-
font-weight: 600;
|
|
29
|
-
color: #e8eaf0;
|
|
30
|
-
}
|
|
31
|
-
.status {
|
|
32
|
-
display: flex;
|
|
33
|
-
align-items: center;
|
|
34
|
-
gap: 10px;
|
|
35
|
-
font-size: 13px;
|
|
36
|
-
min-height: 18px;
|
|
37
|
-
}
|
|
38
|
-
.dot {
|
|
39
|
-
width: 14px;
|
|
40
|
-
height: 14px;
|
|
41
|
-
flex: none;
|
|
42
|
-
border-radius: 50%;
|
|
43
|
-
border: 2px solid #2c3644;
|
|
44
|
-
border-top-color: #7f858f;
|
|
45
|
-
animation: spin 0.8s linear infinite;
|
|
46
|
-
}
|
|
47
|
-
.dot.ok {
|
|
48
|
-
border-color: #3d8b6a;
|
|
49
|
-
animation: none;
|
|
50
|
-
}
|
|
51
|
-
.dot.error {
|
|
52
|
-
border-color: #c0564d;
|
|
53
|
-
animation: none;
|
|
54
|
-
}
|
|
55
|
-
.msg { line-height: 1.4; }
|
|
56
|
-
.msg.error { color: #e09090; }
|
|
57
|
-
.msg.ok { color: #8fbfa4; }
|
|
58
|
-
@keyframes spin { to { transform: rotate(360deg); } }
|
|
59
|
-
</style>
|
|
60
|
-
</head>
|
|
61
|
-
<body>
|
|
62
|
-
<div class="wrap">
|
|
63
|
-
<div class="title" id="title">后端操作</div>
|
|
64
|
-
<div class="status">
|
|
65
|
-
<div class="dot" id="dot"></div>
|
|
66
|
-
<div class="msg" id="msg">请稍候…</div>
|
|
67
|
-
</div>
|
|
68
|
-
</div>
|
|
69
|
-
<script>
|
|
70
|
-
window.progressAPI.onSet((data) => {
|
|
71
|
-
if (data.title) document.getElementById('title').textContent = data.title
|
|
72
|
-
const msg = document.getElementById('msg')
|
|
73
|
-
msg.textContent = data.message || ''
|
|
74
|
-
msg.className = 'msg' + (data.state === 'error' ? ' error' : data.state === 'ok' ? ' ok' : '')
|
|
75
|
-
document.getElementById('dot').className = 'dot' + (data.state === 'error' ? ' error' : data.state === 'ok' ? ' ok' : '')
|
|
76
|
-
})
|
|
77
|
-
</script>
|
|
78
|
-
</body>
|
|
79
|
-
</html>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; style-src 'unsafe-inline'; script-src 'unsafe-inline'" />
|
|
6
|
+
<title>后端操作</title>
|
|
7
|
+
<style>
|
|
8
|
+
html, body {
|
|
9
|
+
margin: 0;
|
|
10
|
+
height: 100%;
|
|
11
|
+
background: #10131A;
|
|
12
|
+
color: #9aa3b2;
|
|
13
|
+
font-family: system-ui, "Segoe UI", "Microsoft YaHei", sans-serif;
|
|
14
|
+
-webkit-user-select: none;
|
|
15
|
+
user-select: none;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
}
|
|
18
|
+
.wrap {
|
|
19
|
+
height: 100%;
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
padding: 18px 22px;
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
gap: 12px;
|
|
25
|
+
}
|
|
26
|
+
.title {
|
|
27
|
+
font-size: 14px;
|
|
28
|
+
font-weight: 600;
|
|
29
|
+
color: #e8eaf0;
|
|
30
|
+
}
|
|
31
|
+
.status {
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
gap: 10px;
|
|
35
|
+
font-size: 13px;
|
|
36
|
+
min-height: 18px;
|
|
37
|
+
}
|
|
38
|
+
.dot {
|
|
39
|
+
width: 14px;
|
|
40
|
+
height: 14px;
|
|
41
|
+
flex: none;
|
|
42
|
+
border-radius: 50%;
|
|
43
|
+
border: 2px solid #2c3644;
|
|
44
|
+
border-top-color: #7f858f;
|
|
45
|
+
animation: spin 0.8s linear infinite;
|
|
46
|
+
}
|
|
47
|
+
.dot.ok {
|
|
48
|
+
border-color: #3d8b6a;
|
|
49
|
+
animation: none;
|
|
50
|
+
}
|
|
51
|
+
.dot.error {
|
|
52
|
+
border-color: #c0564d;
|
|
53
|
+
animation: none;
|
|
54
|
+
}
|
|
55
|
+
.msg { line-height: 1.4; }
|
|
56
|
+
.msg.error { color: #e09090; }
|
|
57
|
+
.msg.ok { color: #8fbfa4; }
|
|
58
|
+
@keyframes spin { to { transform: rotate(360deg); } }
|
|
59
|
+
</style>
|
|
60
|
+
</head>
|
|
61
|
+
<body>
|
|
62
|
+
<div class="wrap">
|
|
63
|
+
<div class="title" id="title">后端操作</div>
|
|
64
|
+
<div class="status">
|
|
65
|
+
<div class="dot" id="dot"></div>
|
|
66
|
+
<div class="msg" id="msg">请稍候…</div>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
<script>
|
|
70
|
+
window.progressAPI.onSet((data) => {
|
|
71
|
+
if (data.title) document.getElementById('title').textContent = data.title
|
|
72
|
+
const msg = document.getElementById('msg')
|
|
73
|
+
msg.textContent = data.message || ''
|
|
74
|
+
msg.className = 'msg' + (data.state === 'error' ? ' error' : data.state === 'ok' ? ' ok' : '')
|
|
75
|
+
document.getElementById('dot').className = 'dot' + (data.state === 'error' ? ' error' : data.state === 'ok' ? ' ok' : '')
|
|
76
|
+
})
|
|
77
|
+
</script>
|
|
78
|
+
</body>
|
|
79
|
+
</html>
|
package/electron/progress.js
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Small always-on-top progress window for backend operations
|
|
3
|
-
* (start / restart / stop). Single instance; reused across calls.
|
|
4
|
-
*
|
|
5
|
-
* States: 'busy' (spinner) | 'ok' | 'error' — the caller decides when to
|
|
6
|
-
* close it (auto-close timers live in the caller).
|
|
7
|
-
*/
|
|
8
|
-
import { BrowserWindow } from 'electron'
|
|
9
|
-
import { fileURLToPath } from 'node:url'
|
|
10
|
-
|
|
11
|
-
const PRELOAD = fileURLToPath(new URL('./progress-preload.js', import.meta.url))
|
|
12
|
-
const PAGE = fileURLToPath(new URL('./progress.html', import.meta.url))
|
|
13
|
-
|
|
14
|
-
let win = null
|
|
15
|
-
|
|
16
|
-
/** Show (or update) the progress window. */
|
|
17
|
-
export function showProgress({ title, message, state = 'busy' }) {
|
|
18
|
-
if (!win || win.isDestroyed()) {
|
|
19
|
-
win = new BrowserWindow({
|
|
20
|
-
width: 420,
|
|
21
|
-
height: 128,
|
|
22
|
-
frame: false,
|
|
23
|
-
resizable: false,
|
|
24
|
-
movable: true,
|
|
25
|
-
alwaysOnTop: true,
|
|
26
|
-
skipTaskbar: true,
|
|
27
|
-
show: false,
|
|
28
|
-
backgroundColor: '#10131A',
|
|
29
|
-
webPreferences: {
|
|
30
|
-
preload: PRELOAD,
|
|
31
|
-
contextIsolation: true,
|
|
32
|
-
nodeIntegration: false,
|
|
33
|
-
sandbox: true,
|
|
34
|
-
},
|
|
35
|
-
})
|
|
36
|
-
win.loadFile(PAGE)
|
|
37
|
-
win.once('ready-to-show', () => win.show())
|
|
38
|
-
win.on('closed', () => {
|
|
39
|
-
win = null
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
setProgress({ title, message, state })
|
|
43
|
-
return win
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/** Update the currently visible progress window (no-op if hidden). */
|
|
47
|
-
export function setProgress({ title, message, state }) {
|
|
48
|
-
if (win && !win.isDestroyed()) {
|
|
49
|
-
win.webContents.send('progress:set', { title, message, state })
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/** Close the progress window if open. */
|
|
54
|
-
export function closeProgress() {
|
|
55
|
-
if (win && !win.isDestroyed()) win.close()
|
|
56
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Small always-on-top progress window for backend operations
|
|
3
|
+
* (start / restart / stop). Single instance; reused across calls.
|
|
4
|
+
*
|
|
5
|
+
* States: 'busy' (spinner) | 'ok' | 'error' — the caller decides when to
|
|
6
|
+
* close it (auto-close timers live in the caller).
|
|
7
|
+
*/
|
|
8
|
+
import { BrowserWindow } from 'electron'
|
|
9
|
+
import { fileURLToPath } from 'node:url'
|
|
10
|
+
|
|
11
|
+
const PRELOAD = fileURLToPath(new URL('./progress-preload.js', import.meta.url))
|
|
12
|
+
const PAGE = fileURLToPath(new URL('./progress.html', import.meta.url))
|
|
13
|
+
|
|
14
|
+
let win = null
|
|
15
|
+
|
|
16
|
+
/** Show (or update) the progress window. */
|
|
17
|
+
export function showProgress({ title, message, state = 'busy' }) {
|
|
18
|
+
if (!win || win.isDestroyed()) {
|
|
19
|
+
win = new BrowserWindow({
|
|
20
|
+
width: 420,
|
|
21
|
+
height: 128,
|
|
22
|
+
frame: false,
|
|
23
|
+
resizable: false,
|
|
24
|
+
movable: true,
|
|
25
|
+
alwaysOnTop: true,
|
|
26
|
+
skipTaskbar: true,
|
|
27
|
+
show: false,
|
|
28
|
+
backgroundColor: '#10131A',
|
|
29
|
+
webPreferences: {
|
|
30
|
+
preload: PRELOAD,
|
|
31
|
+
contextIsolation: true,
|
|
32
|
+
nodeIntegration: false,
|
|
33
|
+
sandbox: true,
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
win.loadFile(PAGE)
|
|
37
|
+
win.once('ready-to-show', () => win.show())
|
|
38
|
+
win.on('closed', () => {
|
|
39
|
+
win = null
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
setProgress({ title, message, state })
|
|
43
|
+
return win
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Update the currently visible progress window (no-op if hidden). */
|
|
47
|
+
export function setProgress({ title, message, state }) {
|
|
48
|
+
if (win && !win.isDestroyed()) {
|
|
49
|
+
win.webContents.send('progress:set', { title, message, state })
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Close the progress window if open. */
|
|
54
|
+
export function closeProgress() {
|
|
55
|
+
if (win && !win.isDestroyed()) win.close()
|
|
56
|
+
}
|