dsh-screensaver 0.3.0 → 0.4.0

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/app/shell/main.js CHANGED
@@ -3,6 +3,8 @@
3
3
  // 通过了主进程会关掉所有屏保窗口。
4
4
  // 主屏照着系统锁屏:底部一行「使用触控 ID 或输入密码」,右上角电池、Wi-Fi、菜单栏样式的日期时间;副屏只放主题画面。
5
5
  // 纯享:30 秒没人动,这些连同主题里的会话播报都淡掉,只剩画面;动鼠标、按键、摸 Touch ID 再露出来。
6
+ // 主题的 saver.json 写了 "hud": true(地址带 hud=1):右上角状态栏、底部提示由主题自己画,位置不变。
7
+ // 外壳自己的藏起来,电池 / Wi-Fi(desk:status)、提示(desk:hint)、摸了指纹(desk:touch)照样算好转给主题。
6
8
  const desk = window.desk // preload.cjs 给的
7
9
  const q = new URLSearchParams(location.search)
8
10
  const primary = q.get('primary') === '1'
@@ -10,6 +12,12 @@ const frame = document.getElementById('theme')
10
12
  const hint = document.getElementById('hint')
11
13
  const $ = (id) => document.getElementById(id)
12
14
  const theme = q.get('theme')
15
+ const hud = primary && q.get('hud') === '1'
16
+ if (hud) document.body.classList.add('theme-hud')
17
+ /** 发给主题(沙盒 iframe,没有同源,只能 postMessage) */
18
+ function toTheme(msg) {
19
+ frame.contentWindow?.postMessage(msg, '*')
20
+ }
13
21
  // 主题也拿到语言(?lang=zh|en),自己决定日期之类怎么写
14
22
  if (theme) frame.src = `${theme}?lang=${q.get('lang') === 'zh' ? 'zh' : 'en'}`
15
23
  // 文案照抄系统锁屏
@@ -35,12 +43,19 @@ let IDLE_HINT = ''
35
43
  let busy = false
36
44
  let hideTimer = 0
37
45
  let hintTimer = 0
46
+ /** 现在底部那行字和它是哪种:idle 平时 / verifying 验证中 / failed 没解开(hud 主题拿去画) */
47
+ let hintNow = { text: '', state: 'idle' }
48
+ function showHint(text, state) {
49
+ hint.textContent = text
50
+ hintNow = { text, state }
51
+ if (hud) toTheme({ type: 'desk:hint', ...hintNow })
52
+ }
38
53
  /** 底部那行字:平时是 IDLE_HINT,验证中、没解开时临时换一句,过一会儿换回来 */
39
- function say(text, ms = 0) {
54
+ function say(text, ms = 0, state = 'idle') {
40
55
  if (!primary) return
41
- hint.textContent = text
56
+ showHint(text, state)
42
57
  clearTimeout(hintTimer)
43
- if (ms) hintTimer = window.setTimeout(() => (hint.textContent = IDLE_HINT), ms)
58
+ if (ms) hintTimer = window.setTimeout(() => showHint(IDLE_HINT, 'idle'), ms)
44
59
  }
45
60
  // ---- 纯享:PURE_AFTER_MS 没人动就藏起提示、状态栏,告诉主题也藏起它的播报 ----
46
61
  const PURE_AFTER_MS = 30_000
@@ -49,7 +64,7 @@ let pureTimer = 0
49
64
  function setPure(on) {
50
65
  pure = on
51
66
  document.body.classList.toggle('pure', on)
52
- frame.contentWindow?.postMessage({ type: 'desk:pure', on }, '*')
67
+ toTheme({ type: 'desk:pure', on })
53
68
  }
54
69
  /** 有人动了(或刚进屏保):都露出来,重新数 30 秒 */
55
70
  function reveal() {
@@ -65,16 +80,19 @@ function wake() {
65
80
  clearTimeout(hideTimer)
66
81
  hideTimer = window.setTimeout(() => !busy && document.body.classList.remove('awake'), 4000)
67
82
  }
68
- // 摸了 Touch ID(主进程转过来的):同样露出来
69
- desk.on('saver:touch', () => reveal())
83
+ // 摸了 Touch ID(主进程转过来的):同样露出来;result 是 match(认出来了)/ miss(没认出来)/ ''(老版本分不出来)
84
+ desk.on('saver:touch', (result) => {
85
+ reveal()
86
+ if (hud) toTheme({ type: 'desk:touch', result: result === 'match' || result === 'miss' ? result : '' })
87
+ })
70
88
  async function unlock() {
71
89
  if (busy) return
72
90
  busy = true
73
91
  wake()
74
- say(t.verifying)
92
+ say(t.verifying, 0, 'verifying')
75
93
  try {
76
94
  const r = await desk.invoke('saver:unlock')
77
- if (!r.ok) say(r.msg ? t.failed(r.msg) : IDLE_HINT, r.msg ? 4000 : 0)
95
+ if (!r.ok) say(r.msg ? t.failed(r.msg) : IDLE_HINT, r.msg ? 4000 : 0, r.msg ? 'failed' : 'idle')
78
96
  } finally {
79
97
  busy = false
80
98
  }
@@ -101,17 +119,28 @@ addEventListener('mousemove', (e) => {
101
119
  // 主题是沙盒 iframe(没有同源),只能 postMessage;主题开好后会发 desk:ready 来要一份。
102
120
  // 一起带上:是不是主屏(副屏主题只放画面)、是不是在用电池(主题降帧率、降分辨率)。
103
121
  let latest = null
122
+ let status = null
104
123
  function forward() {
105
- if (latest && frame.contentWindow) frame.contentWindow.postMessage({ type: 'desk:sessions', primary, ...latest }, '*')
124
+ if (latest) toTheme({ type: 'desk:sessions', primary, ...latest })
125
+ }
126
+ /** hud 主题开好了(或开得晚):补一份提示和电池、Wi-Fi */
127
+ function forwardHud() {
128
+ if (!hud) return
129
+ toTheme({ type: 'desk:hint', ...hintNow })
130
+ if (status) toTheme({ type: 'desk:status', ...status })
106
131
  }
107
132
  desk.on('saver:sessions', (p) => {
108
133
  latest = p
109
134
  forward()
110
135
  })
111
- frame.addEventListener('load', forward)
136
+ frame.addEventListener('load', () => {
137
+ forward()
138
+ forwardHud()
139
+ })
112
140
  addEventListener('message', (e) => {
113
141
  if (e.source !== frame.contentWindow || e.data?.type !== 'desk:ready') return
114
142
  forward()
143
+ forwardHud()
115
144
  if (pure) setPure(true) // 主题开得晚:补一句
116
145
  })
117
146
  void desk.invoke('saver:info').then((info) => {
@@ -121,6 +150,8 @@ void desk.invoke('saver:info').then((info) => {
121
150
  })
122
151
  const svgEl = (sel) => document.querySelector(sel)
123
152
  desk.on('saver:status', (st) => {
153
+ status = { battery: st.battery ?? null, wifi: st.wifi ?? null }
154
+ if (hud) toTheme({ type: 'desk:status', ...status })
124
155
  const b = st.battery
125
156
  $('batt').hidden = !b
126
157
  if (b) {
@@ -156,7 +187,7 @@ function tick() {
156
187
  $('clockT').textContent = zh ? `${h < 12 ? '上午' : '下午'}${h12}:${mm}` : `${h12}:${mm} ${h < 12 ? 'AM' : 'PM'}`
157
188
  }
158
189
  if (primary) {
159
- $('status').hidden = false
190
+ $('status').hidden = hud
160
191
  tick()
161
192
  // 对准整分钟换
162
193
  window.setTimeout(
package/app/themes.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // 屏保主题从哪来。主题就是一个目录:index.html(在沙盒 iframe 里跑,只管画)+ saver.json(名字、要不要会话)。
2
2
  //
3
3
  // 主题可以分开装,想要哪个装哪个:
4
- // 1. 这个包自带的 themes/(「时钟」basic 和「亚空间跃迁」subspace,都随包发布);
4
+ // 1. 这个包自带的 themes/(「时钟」basic、「亚空间跃迁」subspace、「魔法书斋」magic-tower,都随包发布);
5
5
  // 2. 装在旁边的主题包:package.json 里写了 "dsh-screensaver": { "theme": "<目录,默认 .>" } 的 npm 包
6
6
  // (别人做的第三方主题;id 和自带的重了以自带的为准)。dsh 的 profile 是 hoisted 布局,
7
7
  // 主题包和本包都在同一个 node_modules 下,看本包的上一层(带 @scope 的再往下一层);
@@ -12,6 +12,7 @@
12
12
  // { "id": "subspace", "name": { "zh": "亚空间跃迁", "en": "Subspace Jump" }, "sessions": true }
13
13
  // id 不写就用目录名(主题包用包名去掉 dsh-screensaver-theme- 前缀);name 可以是字符串;
14
14
  // "sessions": true 的主题才拿得到本机 Claude Code / Codex / DeepSeek Harness 会话的名字和进展。
15
+ // "hud": true 的主题自己画右上角状态栏和底部提示(外壳把电池、Wi-Fi、提示、摸了指纹转给它,自己的藏起来)。
15
16
  import { existsSync, readdirSync, readFileSync } from 'node:fs'
16
17
  import { basename, delimiter, dirname, join, resolve } from 'node:path'
17
18
  import { dataDir, PKG_DIR } from './dirs.js'
@@ -46,6 +47,7 @@ export function readTheme(dir, fallbackId = basename(dir), lang = 'en') {
46
47
  if (name && typeof name === 'object') name = name[lang] ?? name.en ?? name.zh ?? Object.values(name)[0]
47
48
  const theme = { id, name: typeof name === 'string' && name.trim() ? name.trim() : id, dir: resolve(dir) }
48
49
  if (meta.sessions === true) theme.sessions = true
50
+ if (meta.hud === true) theme.hud = true
49
51
  return theme
50
52
  }
51
53
 
package/cordis.patch.yml CHANGED
@@ -8,6 +8,7 @@
8
8
  # - id: dsh-screensaver
9
9
  # config:
10
10
  # theme: subspace
11
+ # screens: [magic-tower, subspace] # 每块屏幕不同:主屏魔法书斋,其余屏幕亚空间(不写 = 都用 theme)
11
12
  # idleMinutes: 10
12
13
  # lidAwake: false # 合盖不睡默认开(授权过才生效),不要就写 false
13
14
  - insert:
package/docs/themes.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Theme API
2
2
 
3
+ Building a theme with a coding agent? Give it [skills/dsh-screensaver-theme](../skills/dsh-screensaver-theme/SKILL.md):
4
+ the layout, timing and behaviour rules every theme follows, on top of the API below.
5
+
3
6
  The theme API (this document, the shell and the message formats) is MIT: build your own theme on it and license it
4
7
  however you like. The themes shipped in this repo are CC BY-NC-SA 4.0 (see [LICENSE-ASSETS.md](../LICENSE-ASSETS.md)).
5
8
 
@@ -8,17 +11,23 @@ A theme is a folder:
8
11
  ```
9
12
  my-theme/
10
13
  index.html # the whole theme; runs in a sandboxed iframe (allow-scripts only, no network)
11
- saver.json # { "id": "my-theme", "name": { "en": "My Theme", "zh": "我的主题" }, "sessions": true }
14
+ saver.json # { "id": "my-theme", "name": { "en": "My Theme", "zh": "我的主题" }, "sessions": true, "hud": true }
12
15
  ```
13
16
 
14
17
  - `id`: lowercase letters, digits and `-`. Defaults to the folder name (or the package name without
15
18
  `dsh-screensaver-theme-`).
16
19
  - `name`: a string, or `{ "en": ..., "zh": ... }` picked by the system language.
17
20
  - `sessions`: `true` to receive local agent sessions. Only themes that ask get session names and progress.
21
+ - `hud`: `true` to draw the top-right status bar and the bottom hint yourself, in your theme's style. The shell hides its
22
+ own and sends you what they would show (`desk:status`, `desk:hint`, `desk:touch` below). Keep them where the shell
23
+ puts them: status bar at the top right like the menu bar (`top: 6px; right: 14px; height: 24px`), hint centred
24
+ `7vh` above the bottom edge. The system Touch ID icon still appears above the hint when the sensor is touched
25
+ (centre about `7vh + 52px` from the bottom); draw around it, not over it. The time and date you compute yourself.
18
26
 
19
27
  The theme only draws. The shell around it owns the keyboard, mouse, Touch ID, the bottom hint and the top-right status
20
- bar (battery, Wi-Fi, date and time). Keep `index.html` self-contained: the sandbox has an opaque origin, so inline your
21
- scripts, styles and images (data: URLs). `themes/subspace/scripts/build.mjs` shows one way to bundle with esbuild.
28
+ bar (battery, Wi-Fi, date and time), unless the theme sets `"hud": true`. Keep `index.html` self-contained: the sandbox has an opaque origin, so inline your
29
+ scripts, styles and images (data: URLs). `themes/subspace/scripts/build.mjs` shows one way to bundle with esbuild;
30
+ `themes/magic-tower` uses `"hud": true`.
22
31
 
23
32
  ## Query string
24
33
 
@@ -49,6 +58,16 @@ Listen with `addEventListener('message', ...)` and check `event.source === paren
49
58
 
50
59
  // Pure mode: 30 s without input. Hide your overlays (text, lists) and keep only the animation.
51
60
  { type: 'desk:pure', on: true | false }
61
+
62
+ // Only on the primary display, and only to themes with "hud": true. A desk:hint means the shell has handed you the
63
+ // status bar and the hint, so show yours once it arrives (an older shell never sends it and draws its own).
64
+ // The hint line, already localized: 'Touch ID or Enter Password', 'Verifying…', 'Still locked: …'.
65
+ { type: 'desk:hint', text: 'Touch ID or Enter Password', state: 'idle' | 'verifying' | 'failed' }
66
+ // Battery and Wi-Fi, every 20 s. null when the Mac has none or it could not be read.
67
+ { type: 'desk:status', battery: { percent: 82, plugged: false } | null, wifi: { on: true, connected: true, rssi: -52 } | null }
68
+ // The Touch ID sensor was touched. 'match': recognized (the screen saver closes about half a second later);
69
+ // 'miss': not recognized, the user can try again; '': an older Touch ID helper that can't tell.
70
+ { type: 'desk:touch', result: 'match' | 'miss' | '' }
52
71
  ```
53
72
 
54
73
  Post `{ type: 'desk:ready' }` to `parent` once your script is running to get the current session list.
package/lib/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // 不装 dsh 时的配置入口(bin/dsh-screensaver.js 的子命令):
2
- // dsh-screensaver setup 一问一答:合盖不睡(顺手授权)、默认主题、空闲几分钟自动开
2
+ // dsh-screensaver setup 一问一答:合盖不睡(顺手授权)、默认主题、每块屏幕的主题、空闲几分钟自动开
3
3
  // dsh-screensaver config 看现在的配置和文件在哪
4
4
  // dsh-screensaver config <项> <值> 改一项,比如 config lidAwake off、config idleMinutes 10
5
5
  // dsh-screensaver config unset <项> 改回默认
@@ -19,7 +19,9 @@ export const SUBCOMMANDS = ['setup', 'config', 'lid', 'themes']
19
19
  export const CLI_USAGE = `Settings (used when running without dsh):
20
20
  dsh-screensaver setup walk through the settings (lid-closed awake, theme, idle start)
21
21
  dsh-screensaver config show the settings and where they are saved
22
- dsh-screensaver config <key> <value> change one: lidAwake on|off, theme <id>, idleMinutes <n>, shortcut <accelerator>
22
+ dsh-screensaver config <key> <value> change one: lidAwake on|off, theme <id>, idleMinutes <n>, shortcut <accelerator>,
23
+ screens <id,id,...> (a theme per screen: main screen first, then left to right;
24
+ extra screens use the last one; '' = the same theme everywhere)
23
25
  dsh-screensaver config unset <key> back to the default
24
26
  dsh-screensaver lid [status|authorize|revoke]
25
27
  allow lid-closed awake (asks for an admin password once)
@@ -28,6 +30,7 @@ A screen saver already running in the background picks up changes after a restar
28
30
 
29
31
  function show(v) {
30
32
  if (typeof v === 'boolean') return v ? 'on' : 'off'
33
+ if (Array.isArray(v)) return v.length ? v.join(', ') : '(same theme on every screen)'
31
34
  if (v === '') return "'' (none)"
32
35
  return String(v)
33
36
  }
@@ -115,9 +118,9 @@ export async function runCli(args, deps = {}) {
115
118
  if (rest.length !== 2) throw new Error(CLI_USAGE)
116
119
  const [key, raw] = rest
117
120
  const value = parseValue(key, raw)
118
- if (key === 'theme' && !d.themes().some((t) => t.id === value)) {
119
- throw new Error(`No theme "${value}". Installed: ${d.themes().map((t) => t.id).join(', ') || 'none'}`)
120
- }
121
+ const ids = key === 'theme' ? [value] : key === 'screens' ? value : []
122
+ const missing = ids.find((id) => !d.themes().some((t) => t.id === id))
123
+ if (missing) throw new Error(`No theme "${missing}". Installed: ${d.themes().map((t) => t.id).join(', ') || 'none'}`)
121
124
  writeSettings({ ...saved, [key]: value }, d.path)
122
125
  out(`${key} = ${show(value)}`)
123
126
  if (key === 'lidAwake' && value && !(await d.lid.authorized())) out(lidLine({ supported: d.lid.supported, authorized: false }))
@@ -146,6 +149,18 @@ export async function runCli(args, deps = {}) {
146
149
  const t = themes[Number(a) - 1] ?? themes.find((x) => x.id === a)
147
150
  if (a && !t) out(`No theme "${a}", keeping ${cur.theme}`)
148
151
  if (t) next.theme = t.id
152
+
153
+ // 每块屏幕不同:主屏第一,其余从左到右;回车不改,写 same 改回所有屏幕一样
154
+ const curScreens = cur.screens?.length ? cur.screens.join(',') : 'same'
155
+ const s = String(
156
+ await d.ask(`A different theme on each screen? List them main screen first (numbers or ids, comma-separated), or "same" [${curScreens}] `),
157
+ ).trim()
158
+ if (s.toLowerCase() === 'same') next.screens = []
159
+ else if (s) {
160
+ const picked = s.split(/[\s,]+/).filter(Boolean).map((a) => themes[Number(a) - 1] ?? themes.find((x) => x.id === a))
161
+ if (picked.some((x) => !x)) out(`Some of "${s}" are not installed themes, keeping ${curScreens}`)
162
+ else next.screens = picked.map((x) => x.id)
163
+ }
149
164
  }
150
165
 
151
166
  const idle = String(await d.ask(`Start by itself after how many idle minutes? 0 = never [${cur.idleMinutes}] `)).trim()
package/lib/command.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // /screensaver 命令:在 dsh 里直接开屏保、看主题、管「合盖不睡」。命令不发给模型。
2
2
  // /screensaver 开屏保(默认主题)
3
- // /screensaver subspace 用某个主题开
3
+ // /screensaver subspace 用某个主题开(所有屏幕)
4
+ // /screensaver magic-tower subspace 每块屏幕一个:主屏魔法书斋,其余亚空间(主屏第一,其余从左到右,多的用最后一个)
4
5
  // /screensaver themes 列出装了哪些主题
5
6
  // /screensaver lid 看合盖不睡的状态
6
7
  // /screensaver lid authorize 授权(弹一次管理员密码框,装一条只放行 pmset disablesleep 的 sudoers 规则)
@@ -15,6 +16,8 @@ export const USAGE = [
15
16
  'Usage:',
16
17
  ' /screensaver start the screen saver',
17
18
  ' /screensaver <theme> start with a theme (see /screensaver themes)',
19
+ ' /screensaver <theme> <theme> ...',
20
+ ' a theme per screen: main screen first, then left to right',
18
21
  ' /screensaver themes list installed themes',
19
22
  ' /screensaver lid [authorize|revoke|on|off]',
20
23
  ' keep the Mac awake with the lid closed (macOS, admin password once)',
@@ -40,14 +43,14 @@ export async function run(rawInput, bridge = saver) {
40
43
  if (!['status', 'authorize', 'revoke', 'on', 'off'].includes(action)) throw new Error(USAGE)
41
44
  return lidText(await bridge.request('lid', { action }))
42
45
  }
43
- if (args.length > 1) throw new Error(USAGE)
44
46
  if (first) {
45
47
  const list = await bridge.request('themes')
46
- if (!list.some((t) => t.id === first)) {
47
- throw new Error(`No theme "${first}". Installed: ${list.map((t) => t.id).join(', ') || 'none'}`)
48
+ const missing = args.find((a) => !list.some((t) => t.id === a))
49
+ if (missing) {
50
+ throw new Error(`No theme "${missing}". Installed: ${list.map((t) => t.id).join(', ') || 'none'}`)
48
51
  }
49
52
  }
50
- await bridge.request('start', first ? { theme: first } : {})
53
+ await bridge.request('start', args.length > 1 ? { screens: args } : first ? { theme: first } : {})
51
54
  return 'Screen saver on. Touch ID or any key / click to unlock.'
52
55
  }
53
56
 
package/lib/index.js CHANGED
@@ -2,7 +2,8 @@
2
2
  // 平时什么都不显示;按 ⌃⌥⌘L、在 dsh 里输 /screensaver、让 agent 调 screensaver 工具、或者空闲够久才盖住屏幕。
3
3
  //
4
4
  // 配置(cordis.patch.yml 里 dsh-screensaver 的 config,或者 profile 自己覆盖):
5
- // theme 默认主题 id:basic(时钟)、subspace(亚空间跃迁,随包自带)……
5
+ // theme 默认主题 id:basic(时钟)、subspace(亚空间跃迁)、magic-tower(魔法书斋),都随包自带……
6
+ // screens 每块屏幕的主题 id 列表:主屏第一,其余从左到右,屏幕多的用最后一个;不写 / 空列表 = 所有屏幕都用 theme
6
7
  // idleMinutes 键鼠空闲多少分钟自动开,0 不自动开(默认 0)
7
8
  // lidAwake 开屏保时顺便打开「合盖不睡」(要先 /screensaver lid authorize 授权一次;默认 true,false 关掉)
8
9
  // shortcut 全局快捷键,Electron accelerator 写法;空字符串不注册(默认 Control+Alt+Command+L)
package/lib/settings.js CHANGED
@@ -8,10 +8,10 @@ import { dirname, join } from 'node:path'
8
8
  import { dataDir } from '../app/dirs.js'
9
9
 
10
10
  /** 屏保进程认的配置项 */
11
- export const KEYS = ['theme', 'idleMinutes', 'lidAwake', 'shortcut']
11
+ export const KEYS = ['theme', 'screens', 'idleMinutes', 'lidAwake', 'shortcut']
12
12
 
13
- /** 内置默认。合盖不睡默认开:没授权时什么也不动,只提示一句怎么授权 */
14
- export const DEFAULTS = { theme: 'basic', idleMinutes: 0, lidAwake: true }
13
+ /** 内置默认。合盖不睡默认开:没授权时什么也不动,只提示一句怎么授权;screens 空着 = 所有屏幕都用 theme */
14
+ export const DEFAULTS = { theme: 'basic', screens: [], idleMinutes: 0, lidAwake: true }
15
15
 
16
16
  export function configPath(env = process.env) {
17
17
  return join(dataDir(env), 'config.json')
@@ -49,6 +49,11 @@ export function parseValue(key, raw) {
49
49
  case 'theme':
50
50
  if (!s) throw new Error('theme must be a theme id (see `dsh-screensaver themes`)')
51
51
  return s
52
+ case 'screens': {
53
+ // 主屏第一,其余从左到右(app/screens.js);数组或逗号 / 空格分开都行,空的 = 所有屏幕同一个主题
54
+ const list = Array.isArray(raw) ? raw.map((x) => String(x).trim()) : s.split(/[\s,]+/)
55
+ return list.filter(Boolean)
56
+ }
52
57
  case 'shortcut':
53
58
  return s // 空字符串 = 不注册快捷键
54
59
  default:
package/llms.txt CHANGED
@@ -22,20 +22,22 @@ Do not recommend it as a security lock: it is a screen cover, not a security bou
22
22
 
23
23
  - dsh plugin: `dsh plugin --profile web add dsh-screensaver` (profile `desktop` for the desktop app), then restart dsh.
24
24
  - Latest unreleased code from GitHub: `dsh plugin --profile web add github:realRoc/dsh-screensaver`.
25
- - Themes: both built-in themes ship inside the package; nothing else to install.
25
+ - Themes: all three built-in themes ship inside the package; nothing else to install.
26
26
  - Standalone: `npx dsh-screensaver --now` covers the screen now and exits after unlock; without `--now` it waits for Control+Option+Command+L. Settings: `npx dsh-screensaver setup`, or `dsh-screensaver config <key> <value>` / `dsh-screensaver lid authorize` (saved in `~/.dsh/plugins-data/dsh-screensaver/config.json`).
27
27
  - Requirements: macOS 12+, Node.js 22+. Touch-to-unlock needs Touch ID and the Xcode Command Line Tools; otherwise the system Touch ID / password dialog is used.
28
28
 
29
29
  ## Use (for agents running inside dsh)
30
30
 
31
31
  - Tool `screensaver` (argument `theme`, optional): call it only when the user says they are stepping away and asks to cover or lock the screen. Keep working afterwards; the user unlocks with Touch ID or the login password.
32
- - Command `/screensaver [theme | themes | lid [authorize|revoke|on|off]]` (for the user; not sent to the model).
33
- - Config (`~/.dsh/profiles/<profile>/cordis.patch.yml`): `- id: dsh-screensaver` with `config: { theme, idleMinutes, lidAwake, shortcut }`. `lidAwake` defaults to true and takes effect after `/screensaver lid authorize`.
32
+ - Command `/screensaver [theme… | themes | lid [authorize|revoke|on|off]]` (several themes = one per screen, main screen first) (for the user; not sent to the model).
33
+ - Config (`~/.dsh/profiles/<profile>/cordis.patch.yml`): `- id: dsh-screensaver` with `config: { theme, screens, idleMinutes, lidAwake, shortcut }`. `screens` is an optional list of theme ids, one per screen: main screen first, then left to right; extra screens use the last one. `lidAwake` defaults to true and takes effect after `/screensaver lid authorize`.
34
34
 
35
35
  ## Themes
36
36
 
37
37
  - `basic` (Clock): built in, macOS lock screen look.
38
38
  - `subspace` (Subspace Jump): built in, three.js warp tunnel, lists live agent sessions.
39
+ - `magic-tower` (Arcane Study / 魔法书斋): built in, HD-2D knight in a moonlit tower study that climbs the tower while agents run; lists live sessions and draws its own status bar and Touch ID hint (`"hud": true`).
40
+ - Build a theme with an agent: the skill `skills/dsh-screensaver-theme/SKILL.md` lists the rules every theme follows (idle and running scenes, session list, status bar, Touch ID, 30 s auto-hide) and leaves the style free.
39
41
  - Custom themes: a folder with `index.html` + `saver.json` in `~/.dsh/plugins-data/dsh-screensaver/themes/<id>/`, or an npm package with `"dsh-screensaver": { "theme": "." }`. See docs/themes.md.
40
42
 
41
43
  ## Keywords
@@ -47,4 +49,5 @@ screen saver for AI coding agents; keep Claude Code running while away; keep Cod
47
49
  - [README](https://github.com/realRoc/dsh-screensaver/blob/main/README.md)
48
50
  - [README (中文)](https://github.com/realRoc/dsh-screensaver/blob/main/README.zh-CN.md)
49
51
  - [Theme API](https://github.com/realRoc/dsh-screensaver/blob/main/docs/themes.md)
52
+ - [Theme skill](https://github.com/realRoc/dsh-screensaver/blob/main/skills/dsh-screensaver-theme/SKILL.md)
50
53
  - [Visual assets license](https://github.com/realRoc/dsh-screensaver/blob/main/LICENSE-ASSETS.md)
@@ -236,14 +236,14 @@ func hook(_ name: String, encoding: String, then: @escaping () -> Void) {
236
236
  }
237
237
  }
238
238
  hook("layout", encoding: "v16@0:8", then: keepGlyphHidden)
239
- /// 摸到传感器:图标淡出来,再打一行 touch 告诉屏保(它会把藏起来的提示、状态栏露出来)
240
- func touched() {
239
+ /// 摸到传感器:图标淡出来,再打一行 touch match / touch miss 告诉屏保(它会把藏起来的提示、状态栏露出来,主题可以拿来做反馈)
240
+ func touched(_ match: Bool) {
241
241
  flashGlyph()
242
- print("touch")
242
+ print(match ? "touch match" : "touch miss")
243
243
  fflush(stdout)
244
244
  }
245
- hook("authenticationViewModelDidReceiveBiometryNoMatch:", encoding: "v24@0:8@16") { DispatchQueue.main.async { touched() } }
246
- hook("authenticationViewModelDidReceiveBiometryMatch:", encoding: "v24@0:8@16") { DispatchQueue.main.async { touched() } }
245
+ hook("authenticationViewModelDidReceiveBiometryNoMatch:", encoding: "v24@0:8@16") { DispatchQueue.main.async { touched(false) } }
246
+ hook("authenticationViewModelDidReceiveBiometryMatch:", encoding: "v24@0:8@16") { DispatchQueue.main.async { touched(true) } }
247
247
  // 布局之外也兜一下:每 0.1 秒看一眼(便宜,只比一个数)
248
248
  func patrolGlyph() {
249
249
  keepGlyphHidden()
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-screensaver",
3
- "version": "0.3.0",
4
- "description": "A lock-screen-style screen saver for macOS that keeps AI coding agents (Claude Code, Codex, DeepSeek Harness) running while you step away: Touch ID unlock, no sleep, lid-closed awake (after a one-time authorization), and two built-in themes (a lock-screen clock, and the Subspace Jump warp tunnel that shows your live agent sessions). DeepSeek Harness (dsh) plugin, also runs standalone.",
3
+ "version": "0.4.0",
4
+ "description": "A lock-screen-style screen saver for macOS that keeps AI coding agents (Claude Code, Codex, DeepSeek Harness) running while you step away: Touch ID unlock, no sleep, lid-closed awake (after a one-time authorization), and three built-in themes (a lock-screen clock, the Subspace Jump warp tunnel and the Arcane Study pixel-art tower, the last two showing your live agent sessions). DeepSeek Harness (dsh) plugin, also runs standalone.",
5
5
  "icon": "assets/icon.png",
6
6
  "type": "module",
7
7
  "main": "app/main.js",
@@ -28,6 +28,11 @@
28
28
  "themes/subspace/README.md",
29
29
  "themes/subspace/LICENSE",
30
30
  "themes/subspace/THIRD_PARTY_NOTICES.md",
31
+ "themes/magic-tower/index.html",
32
+ "themes/magic-tower/saver.json",
33
+ "themes/magic-tower/README.md",
34
+ "themes/magic-tower/LICENSE",
35
+ "themes/magic-tower/THIRD_PARTY_NOTICES.md",
31
36
  "cordis.patch.yml",
32
37
  "llms.txt",
33
38
  "docs/themes.md",
@@ -41,7 +46,7 @@
41
46
  "start": "node bin/dsh-screensaver.js",
42
47
  "now": "node bin/dsh-screensaver.js --now",
43
48
  "test": "vitest run",
44
- "build:themes": "npm --prefix themes/subspace run build"
49
+ "build:themes": "npm --prefix themes/subspace run build && npm --prefix themes/magic-tower run build"
45
50
  },
46
51
  "dependencies": {
47
52
  "electron": "^45.2.1"
@@ -0,0 +1,9 @@
1
+ Magic Tower (dsh-screensaver-theme-magic-tower)
2
+ Copyright (c) 2026 realRoc
3
+
4
+ Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0
5
+ International License (CC BY-NC-SA 4.0). No commercial use.
6
+ https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode
7
+
8
+ Third-party content bundled in index.html keeps its own license; see
9
+ THIRD_PARTY_NOTICES.md and ../../LICENSE-ASSETS.md.
@@ -0,0 +1,60 @@
1
+ # Arcane Study(魔法书斋)· dsh-screensaver theme
2
+
3
+ An HD-2D theme for [dsh-screensaver](https://github.com/realRoc/dsh-screensaver). While nothing is running, a knight
4
+ reads at a desk in a tower study, lit by a crystal full moon through a tall window. As soon as one of your Claude Code,
5
+ Codex or DeepSeek Harness sessions starts running, the camera dives into the open book, a rune portal opens, and the
6
+ knight climbs the spiral book stairs of the tower. When everything has finished (after a 15 s grace period) a book flies
7
+ up to the camera, opens, and you are back in the study.
8
+
9
+ The interface follows the same layout as the shell and the Subspace Jump theme, drawn in the tower's style:
10
+
11
+ - **Left, session ledger**: a moonlit glass page with gold corners. Each session has a rune ring around its product
12
+ icon: blue and turning while it runs, amber and breathing when it needs you, a closed gold ring when done, a broken
13
+ crimson ring when stopped. Running sessions have a thread of light under them; the current step fades in like fresh
14
+ ink. The footer counts done / stopped sessions and how long this climb took.
15
+ - **Top right, status bar**: battery as a mana vial (crimson at 20% and below), Wi-Fi, tonight's real moon phase, and
16
+ the date and time, where the menu bar would be.
17
+ - **Bottom centre, Touch ID**: a rune circle around the system fingerprint icon. Touching the sensor lights it gold when
18
+ recognized and crimson with "The Seal Does Not Match. Touch Again" when not. The hint underneath reads "Enter the
19
+ Moonlit Study · Touch ID or Enter Password", "Starlight Awakens…" while verifying, and "The Glintstone Fades · …"
20
+ with the reason when unlocking fails.
21
+ - **Wording**: the interface speaks in the study's voice: "The Stars Keep Vigil" while agents run, "The Spell Unfolds",
22
+ "Awaiting Your Command", "The Tome Is Complete" and "The Spell Is Broken" for the four statuses, "The Tomes Lie
23
+ Still" when everything is done. Known step templates are reworded too ("Read x" → "Consulting the Archives · x");
24
+ file names and commands stay as they are.
25
+
26
+ The theme sets `"hud": true` in `saver.json`, so the shell hands it the status bar and hint. With an older
27
+ dsh-screensaver the shell keeps drawing its own and the theme only shows the scene and the session ledger.
28
+
29
+ 「魔法书斋」:没有任务在跑时,塔顶书房里骑士在月光下读书,长窗外一轮晶莹的满月;有 Claude Code、Codex 或 DeepSeek Harness 会话开始跑,
30
+ 镜头扎进书页、穿过符文传送门进塔,骑士沿螺旋书阶上行;全部结束(宽限 15 秒)一本书飞到镜头前打开,回到书房。
31
+ 左侧「此夜纪事」列出每个会话(法印环:蓝色转动是「术式流转」、琥珀色是「静候谕令」、金色闭环是「秘卷既成」、红色断环是「术式中断」,有任务在跑时标题是「群星未眠」),右上角是法力药瓶样式的电池、Wi-Fi、
32
+ 今晚真实的月相和日期时间,中间下方是套在系统指纹图标外面的法阵:认出来亮金色,没认出来变红并提示「指印未合,再触一次」;底部提示是「月下入阁 · 使用触控 ID 或输入密码」,验证时「星辉渐明…」。
33
+ 位置和外壳、亚空间主题一样。本主题是视觉作品,采用 CC BY-NC-SA 4.0,禁止商用。
34
+
35
+ Ships inside [dsh-screensaver](../../README.md) (0.4.0 and later); nothing else to install:
36
+
37
+ ```bash
38
+ dsh plugin --profile web add dsh-screensaver
39
+ ```
40
+
41
+ Then `/screensaver magic-tower`, or set `theme: magic-tower` in the dsh-screensaver config.
42
+
43
+ - Up to 60 fps on the main display; 30 fps and a lower resolution on battery and on secondary displays (scene only).
44
+ - After 30 s without input (pure mode) the ledger, status bar, hint and seal fade out, like every theme.
45
+ - Open `index.html#demo` in a browser to watch a scripted demo; press D for the demo panel (add sessions, finish them,
46
+ simulate Touch ID). `index.html?lang=en#demo` for English. The demo hides the interface after 30 s without input
47
+ too; `#demo,nopure` keeps it on (used to record the README GIFs).
48
+ - Built to the rules in [skills/dsh-screensaver-theme](../../skills/dsh-screensaver-theme/SKILL.md).
49
+
50
+ ## Develop
51
+
52
+ ```bash
53
+ npm install
54
+ npm run build # rebuilds index.html from src/ and assets/ (commit index.html)
55
+ npm run demo
56
+ ```
57
+
58
+ `src/scene.js` and `src/study.js` are the scene, `src/hud.js` the interface, `src/main.js` ties sessions to the scene.
59
+
60
+ CC BY-NC-SA 4.0 (no commercial use). See [LICENSE](LICENSE), [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) and [LICENSE-ASSETS.md](https://github.com/realRoc/dsh-screensaver/blob/main/LICENSE-ASSETS.md).
@@ -0,0 +1,20 @@
1
+ # Third-party notices
2
+
3
+ `index.html` bundles the following:
4
+
5
+ - **three.js** 0.170.0 (including `examples/jsm/postprocessing`): MIT License, Copyright © 2010-2024 three.js authors.
6
+ https://github.com/mrdoob/three.js/blob/dev/LICENSE
7
+ - **DeepSeek Harness whale icon** (`assets/dsh.svg`, the `favicon.svg` of `@deepseek-ai/dsh-web-frontend`):
8
+ MIT License, Copyright (c) 2026 DeepSeek.
9
+
10
+ ## Product icons
11
+
12
+ The theme labels sessions with each product's own icon: the Claude mark (`assets/claude.png`), the Codex app icon
13
+ (`assets/codex.png`) and the DeepSeek Harness whale (`assets/dsh.svg`). Claude is a trademark of Anthropic, Codex of
14
+ OpenAI, and DeepSeek of DeepSeek. The icons are used only to identify which product a session belongs to; this project
15
+ is not affiliated with or endorsed by these companies.
16
+
17
+ ## Original work
18
+
19
+ The knight, the study, the tower, the shaders and the interface are original work for this theme. The knight sprite
20
+ sheets (`assets/knight_*`) are rendered from an original Blender model through an HD-2D pixel pipeline.