chore: 初始化仓库(零源工具箱 0.1.0 基线)
- Go 主进程 cmd/zerorigin(托盘常驻 + 触发器/规则/动作引擎) - Wails v3 设置进程 cmd/settings(独立 module) - 监督进程 cmd/watchdog(-supervise 异常重启) - 构建脚本 build.bat / NSIS 安装包 deploy/、便携版 portable/ - 架构与 MVP 计划文档 docs/、阶段 0-4 验收记录 deploy/acceptance-0-4.md
This commit is contained in:
commit
0a1c1e82ea
188 files changed
+19926
No files matched your search
@@ -0,0 +1,394 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { ConfigService, Config, Rule, ActionConfig, GlobalConfig } from '../bindings/zerorigin-settings'
|
||||
import { ACTION_DEFAULTS, ACTION_SCHEMA, TRIGGER_DEFAULTS, TRIGGER_SCHEMA, ParamField } from './types'
|
||||
|
||||
const loading = ref(true)
|
||||
const errorMsg = ref('')
|
||||
const notice = ref('')
|
||||
const warnings = ref<string[]>([])
|
||||
|
||||
const config = reactive<Config>({
|
||||
version: 1,
|
||||
global: { enabled: true, theme: 'system', log_level: 'info' },
|
||||
rules: [],
|
||||
})
|
||||
const meta = reactive<{ trigger_types: Record<string, string>; action_types: Record<string, string> }>({
|
||||
trigger_types: {},
|
||||
action_types: {},
|
||||
})
|
||||
|
||||
const selectedId = ref<string | null>(null)
|
||||
const editing = reactive<{ rule: Rule | null }>({ rule: null })
|
||||
|
||||
const selected = computed(() => (config.rules ?? []).find(r => r.id === selectedId.value) ?? null)
|
||||
const rules = computed(() => config.rules ?? [])
|
||||
|
||||
// 主题(跟随系统/浅色/深色)
|
||||
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)')
|
||||
function applyTheme(theme: string) {
|
||||
let dark = theme === 'dark'
|
||||
if (theme === 'system') dark = prefersDark.matches
|
||||
document.documentElement.setAttribute('data-theme', dark ? 'dark' : 'light')
|
||||
}
|
||||
|
||||
async function load() {
|
||||
loading.value = true
|
||||
try {
|
||||
const appCfg = await ConfigService.Load()
|
||||
if (appCfg && appCfg.config) {
|
||||
Object.assign(config, appCfg.config)
|
||||
applyTheme(config.global.theme)
|
||||
if ((config.rules ?? []).length > 0) {
|
||||
selectedId.value = (config.rules ?? [])[0].id
|
||||
editing.rule = { ...(config.rules ?? [])[0] }
|
||||
}
|
||||
}
|
||||
const m = await ConfigService.Meta()
|
||||
if (m) Object.assign(meta, m)
|
||||
} catch (e: any) {
|
||||
errorMsg.value = String(e?.message ?? e)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
onMounted(load)
|
||||
|
||||
function selectRule(id: string) {
|
||||
selectedId.value = id
|
||||
const r = (config.rules ?? []).find(x => x.id === id)
|
||||
editing.rule = r ? JSON.parse(JSON.stringify(r)) : null
|
||||
}
|
||||
|
||||
function newRule() {
|
||||
const id = 'rule-' + Date.now().toString(36)
|
||||
const rule: Rule = {
|
||||
id,
|
||||
name: '新规则',
|
||||
enabled: true,
|
||||
priority: 100,
|
||||
trigger: { type: 'mouse_corner', params: { ...TRIGGER_DEFAULTS.mouse_corner } },
|
||||
actions: [{ type: 'volume_up', params: { ...ACTION_DEFAULTS.volume_up } }],
|
||||
cooldown_ms: 800,
|
||||
}
|
||||
config.rules = [...(config.rules ?? []), rule]
|
||||
selectRule(id)
|
||||
}
|
||||
|
||||
function removeRule(id: string) {
|
||||
config.rules = (config.rules ?? []).filter(r => r.id !== id)
|
||||
if (selectedId.value === id) {
|
||||
selectedId.value = null
|
||||
editing.rule = null
|
||||
}
|
||||
}
|
||||
|
||||
function onTriggerTypeChange() {
|
||||
if (!editing.rule) return
|
||||
const t = editing.rule!.trigger.type
|
||||
editing.rule!.trigger.params = { ...(TRIGGER_DEFAULTS[t] ?? {}) }
|
||||
}
|
||||
|
||||
function addAction() {
|
||||
if (!editing.rule) return
|
||||
const type = 'volume_up'
|
||||
editing.rule!.actions = [...(editing.rule!.actions ?? []), { type, params: { ...ACTION_DEFAULTS[type] } }]
|
||||
}
|
||||
|
||||
function onActionTypeChange(a: ActionConfig) {
|
||||
a.params = { ...(ACTION_DEFAULTS[a.type] ?? {}) }
|
||||
}
|
||||
|
||||
function removeAction(idx: number) {
|
||||
if (!editing.rule) return
|
||||
if (editing.rule!.actions) editing.rule!.actions.splice(idx, 1)
|
||||
}
|
||||
|
||||
function paramVal(rule: Rule | null, field: ParamField): any {
|
||||
return rule?.trigger.params?.[field.key]
|
||||
}
|
||||
function setParam(rule: Rule | null, field: ParamField, val: string | number | boolean) {
|
||||
if (!rule) return
|
||||
if (!rule.trigger.params) rule.trigger.params = {}
|
||||
rule.trigger.params[field.key] = field.type === 'number' ? Number(val) : val
|
||||
}
|
||||
function actionParam(a: ActionConfig, key: string): any {
|
||||
return a?.params?.[key]
|
||||
}
|
||||
function setActionParam(a: ActionConfig, field: ParamField, val: string | number | boolean) {
|
||||
if (!a.params) a.params = {}
|
||||
a.params[field.key] = field.type === 'number' ? Number(val) : val
|
||||
}
|
||||
|
||||
function triggerDesc(r: Rule): string {
|
||||
const label = meta.trigger_types[r.trigger.type] ?? r.trigger.type
|
||||
const p = r.trigger.params ?? {}
|
||||
const extra: string[] = []
|
||||
if (r.trigger.type === 'mouse_corner' && p.corner) extra.push(String(p.corner))
|
||||
if (r.trigger.type === 'mouse_edge_wheel' && p.edge) extra.push(String(p.edge) + (p.direction ? '/' + p.direction : ''))
|
||||
if (r.trigger.type === 'hotkey' && p.hotkey) extra.push(String(p.hotkey))
|
||||
return extra.length ? `${label}(${extra.join(',')})` : label
|
||||
}
|
||||
|
||||
function actionDesc(a: ActionConfig): string {
|
||||
return meta.action_types[a.type] ?? a.type
|
||||
}
|
||||
|
||||
async function save() {
|
||||
notice.value = ''
|
||||
warnings.value = []
|
||||
// 把编辑中的规则回写
|
||||
if (editing.rule && selectedId.value) {
|
||||
const idx = (config.rules ?? []).findIndex(r => r.id === selectedId.value)
|
||||
if (idx >= 0 && config.rules) config.rules[idx] = JSON.parse(JSON.stringify(editing.rule))
|
||||
}
|
||||
try {
|
||||
warnings.value = (await ConfigService.Save({ ...config, global: { ...config.global } })) ?? []
|
||||
notice.value = warnings.value.length ? '已保存(有警告,见下方)' : '已保存,主进程将自动生效'
|
||||
} catch (e: any) {
|
||||
notice.value = '保存失败:' + String(e?.message ?? e)
|
||||
}
|
||||
}
|
||||
|
||||
function setGlobalEnabled(v: boolean) {
|
||||
config.global.enabled = v
|
||||
}
|
||||
function setTheme(v: string) {
|
||||
config.global.theme = v
|
||||
applyTheme(v)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="app">
|
||||
<header class="topbar">
|
||||
<div class="brand">
|
||||
<h1>零源工具箱</h1>
|
||||
<span class="subtitle">设置</span>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<label class="switch-label">
|
||||
<span>已启用</span>
|
||||
<input type="checkbox" :checked="config.global.enabled" @change="e => setGlobalEnabled((e.target as HTMLInputElement).checked)" />
|
||||
</label>
|
||||
<select :value="config.global.theme" @change="e => setTheme((e.target as HTMLSelectElement).value)" title="主题">
|
||||
<option value="system">跟随系统</option>
|
||||
<option value="light">浅色</option>
|
||||
<option value="dark">深色</option>
|
||||
</select>
|
||||
<button class="primary" :disabled="loading" @click="save">保存</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div v-if="errorMsg" class="error-banner">{{ errorMsg }}</div>
|
||||
<div v-if="notice" class="notice-banner">{{ notice }}</div>
|
||||
<div v-if="warnings.length" class="warn-banner">
|
||||
<div v-for="w in warnings" :key="w">{{ w }}</div>
|
||||
</div>
|
||||
|
||||
<main v-if="!loading" class="content">
|
||||
<!-- 规则列表 -->
|
||||
<section class="rules-pane">
|
||||
<div class="pane-head">
|
||||
<h2>规则({{ rules.length }})</h2>
|
||||
<button class="ghost" @click="newRule">+ 新建</button>
|
||||
</div>
|
||||
<ul class="rule-list">
|
||||
<li
|
||||
v-for="r in rules"
|
||||
:key="r.id"
|
||||
:class="['rule-card', { active: r.id === selectedId }]"
|
||||
@click="selectRule(r.id)"
|
||||
>
|
||||
<div class="rule-main">
|
||||
<div class="rule-name">
|
||||
<span :class="['dot', r.enabled ? 'on' : 'off']"></span>
|
||||
<span class="name">{{ r.name || r.id }}</span>
|
||||
</div>
|
||||
<div class="rule-desc">{{ triggerDesc(r) }} → {{ (r.actions ?? []).map(actionDesc).join('、') }}</div>
|
||||
</div>
|
||||
<button class="icon-btn" title="删除" @click.stop="removeRule(r.id)">✕</button>
|
||||
</li>
|
||||
</ul>
|
||||
<p v-if="rules.length === 0" class="empty">还没有规则,点击“新建”添加。</p>
|
||||
</section>
|
||||
|
||||
<!-- 编辑面板 -->
|
||||
<section v-if="selected && editing.rule" class="editor-pane">
|
||||
<h2>编辑规则</h2>
|
||||
|
||||
<div class="field-grid">
|
||||
<label class="field">
|
||||
<span>名称</span>
|
||||
<input v-model="editing.rule!.name" type="text" />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span>优先级</span>
|
||||
<input v-model.number="editing.rule!.priority" type="number" />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span>冷却 (ms)</span>
|
||||
<input v-model.number="editing.rule!.cooldown_ms" type="number" min="0" />
|
||||
</label>
|
||||
<label class="field check">
|
||||
<input type="checkbox" v-model="editing.rule!.enabled" />
|
||||
<span>启用此规则</span>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span>全屏行为</span>
|
||||
<select v-model="editing.rule!.fullscreen">
|
||||
<option value="">全屏下忽略(默认)</option>
|
||||
<option value="allow">全屏下仍触发</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<h3>触发器</h3>
|
||||
<div class="section-box">
|
||||
<label class="field">
|
||||
<span>类型</span>
|
||||
<select v-model="editing.rule!.trigger.type" @change="onTriggerTypeChange">
|
||||
<option v-for="(label, type) in meta.trigger_types" :key="type" :value="type">{{ label }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<div v-for="f in TRIGGER_SCHEMA[editing.rule!.trigger.type] ?? []" :key="f.key" class="field">
|
||||
<span>{{ f.label }}</span>
|
||||
<select v-if="f.type === 'select'" :value="paramVal(editing.rule, f)" @change="e => setParam(editing.rule, f, (e.target as HTMLSelectElement).value)">
|
||||
<option v-for="o in f.options" :key="o.value" :value="o.value">{{ o.label }}</option>
|
||||
</select>
|
||||
<input v-else-if="f.type === 'number'" type="number" :min="f.min" :placeholder="f.placeholder" :value="paramVal(editing.rule, f)" @input="e => setParam(editing.rule, f, (e.target as HTMLInputElement).value)" />
|
||||
<input v-else type="text" :placeholder="f.placeholder" :value="paramVal(editing.rule, f)" @input="e => setParam(editing.rule, f, (e.target as HTMLInputElement).value)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>动作({{ (editing.rule!.actions ?? []).length }})</h3>
|
||||
<div class="section-box">
|
||||
<div v-for="(a, idx) in editing.rule!.actions" :key="idx" class="action-item">
|
||||
<div class="action-head">
|
||||
<select v-model="a.type" @change="onActionTypeChange(a)">
|
||||
<option v-for="(label, type) in meta.action_types" :key="type" :value="type">{{ label }}</option>
|
||||
</select>
|
||||
<button class="icon-btn" title="删除动作" @click="removeAction(idx)">✕</button>
|
||||
</div>
|
||||
<div v-for="f in ACTION_SCHEMA[a.type] ?? []" :key="f.key" class="field">
|
||||
<span>{{ f.label }}</span>
|
||||
<select v-if="f.type === 'select'" :value="actionParam(a, f.key)" @change="e => setActionParam(a, f, (e.target as HTMLSelectElement).value)">
|
||||
<option v-for="o in f.options" :key="o.value" :value="o.value">{{ o.label }}</option>
|
||||
</select>
|
||||
<input v-else-if="f.type === 'number'" type="number" :min="f.min" :placeholder="f.placeholder" :value="actionParam(a, f.key)" @input="e => setActionParam(a, f, (e.target as HTMLInputElement).value)" />
|
||||
<input v-else type="text" :placeholder="f.placeholder" :value="actionParam(a, f.key)" @input="e => setActionParam(a, f, (e.target as HTMLInputElement).value)" />
|
||||
</div>
|
||||
</div>
|
||||
<button class="ghost" @click="addAction">+ 添加动作</button>
|
||||
</div>
|
||||
</section>
|
||||
<section v-else class="editor-pane empty-pane">
|
||||
<p>选择一条规则进行编辑,或新建规则。</p>
|
||||
</section>
|
||||
</main>
|
||||
<div v-else class="loading">加载中…</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.app {
|
||||
font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
|
||||
min-height: 100vh;
|
||||
color: var(--text);
|
||||
background: var(--bg);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.topbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 14px 20px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
background: var(--bg-top);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 5;
|
||||
}
|
||||
.brand { display: flex; align-items: baseline; gap: 8px; }
|
||||
.brand h1 { font-size: 18px; margin: 0; font-weight: 600; }
|
||||
.subtitle { color: var(--muted); font-size: 13px; }
|
||||
.controls { display: flex; align-items: center; gap: 14px; }
|
||||
.switch-label { display: flex; align-items: center; gap: 6px; font-size: 14px; }
|
||||
.content {
|
||||
display: grid;
|
||||
grid-template-columns: 320px 1fr;
|
||||
gap: 0;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
.rules-pane {
|
||||
border-right: 1px solid var(--border);
|
||||
padding: 16px;
|
||||
overflow-y: auto;
|
||||
background: var(--bg-side);
|
||||
}
|
||||
.pane-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
|
||||
.pane-head h2 { font-size: 14px; margin: 0; }
|
||||
.rule-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
|
||||
.rule-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
background: var(--card);
|
||||
transition: border-color .12s;
|
||||
}
|
||||
.rule-card:hover { border-color: var(--accent); }
|
||||
.rule-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
|
||||
.rule-main { min-width: 0; }
|
||||
.rule-name { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; }
|
||||
.rule-desc { color: var(--muted); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
|
||||
.dot.on { background: #2ea043; }
|
||||
.dot.off { background: var(--muted); }
|
||||
.editor-pane { padding: 20px 24px; overflow-y: auto; }
|
||||
.editor-pane h2 { font-size: 16px; margin: 0 0 14px; }
|
||||
.editor-pane h3 { font-size: 13px; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
|
||||
.section-box { border: 1px solid var(--border); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
|
||||
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
|
||||
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
|
||||
.field input, .field select {
|
||||
padding: 6px 8px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
background: var(--input-bg);
|
||||
color: var(--text);
|
||||
font-size: 13px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); }
|
||||
.field.check { flex-direction: row; align-items: center; gap: 6px; }
|
||||
.action-item { border: 1px dashed var(--border); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
|
||||
.action-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
|
||||
.action-head select { flex: 1; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--input-bg); color: var(--text); }
|
||||
button.primary {
|
||||
padding: 6px 16px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
button.primary:disabled { opacity: .5; cursor: default; }
|
||||
button.ghost { padding: 5px 12px; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: var(--text); cursor: pointer; font-size: 13px; }
|
||||
button.ghost:hover { border-color: var(--accent); }
|
||||
button.icon-btn { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px 6px; }
|
||||
button.icon-btn:hover { color: #d1242f; }
|
||||
.error-banner, .notice-banner, .warn-banner { padding: 8px 20px; font-size: 13px; }
|
||||
.error-banner { background: #fdecec; color: #b91c1c; }
|
||||
.notice-banner { background: #e8f5ec; color: #1a7f37; }
|
||||
.warn-banner { background: #fef6e6; color: #9a6700; }
|
||||
.empty { color: var(--muted); font-size: 13px; }
|
||||
.empty-pane { display: flex; align-items: center; justify-content: center; color: var(--muted); }
|
||||
.loading { padding: 40px; color: var(--muted); }
|
||||
</style>
|
||||
@@ -0,0 +1,4 @@
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
|
||||
createApp(App).mount('#app')
|
||||
@@ -0,0 +1,98 @@
|
||||
// 触发器/动作的参数表单 schema(驱动动态表单渲染)。
|
||||
|
||||
export interface ParamField {
|
||||
key: string
|
||||
label: string
|
||||
type: 'text' | 'number' | 'select' | 'bool'
|
||||
options?: { value: string; label: string }[]
|
||||
placeholder?: string
|
||||
required?: boolean
|
||||
min?: number
|
||||
}
|
||||
|
||||
export const TRIGGER_SCHEMA: Record<string, ParamField[]> = {
|
||||
mouse_corner: [
|
||||
{ key: 'corner', label: '角落', type: 'select', required: true, options: [
|
||||
{ value: 'top_left', label: '左上角' },
|
||||
{ value: 'top_right', label: '右上角' },
|
||||
{ value: 'bottom_left', label: '左下角' },
|
||||
{ value: 'bottom_right', label: '右下角' },
|
||||
]},
|
||||
{ key: 'screen', label: '屏幕', type: 'select', options: [
|
||||
{ value: 'all', label: '所有屏幕' },
|
||||
{ value: 'primary', label: '主屏幕' },
|
||||
]},
|
||||
{ key: 'threshold_px', label: '触发范围 (px)', type: 'number', min: 4, placeholder: '32' },
|
||||
],
|
||||
mouse_edge_wheel: [
|
||||
{ key: 'edge', label: '边缘', type: 'select', required: true, options: [
|
||||
{ value: 'top', label: '顶部' },
|
||||
{ value: 'bottom', label: '底部' },
|
||||
{ value: 'left', label: '左侧' },
|
||||
{ value: 'right', label: '右侧' },
|
||||
]},
|
||||
{ key: 'direction', label: '滚轮方向', type: 'select', options: [
|
||||
{ value: 'up', label: '向上(增大)' },
|
||||
{ value: 'down', label: '向下(减小)' },
|
||||
]},
|
||||
{ key: 'threshold_px', label: '边缘范围 (px)', type: 'number', min: 4, placeholder: '32' },
|
||||
],
|
||||
hotkey: [
|
||||
{ key: 'hotkey', label: '快捷键', type: 'text', required: true, placeholder: 'ctrl+alt+d' },
|
||||
],
|
||||
}
|
||||
|
||||
export const ACTION_SCHEMA: Record<string, ParamField[]> = {
|
||||
switch_virtual_desktop: [
|
||||
{ key: 'mode', label: '模式', type: 'select', required: true, options: [
|
||||
{ value: 'alternate', label: '往返(alternate)' },
|
||||
{ value: 'left', label: '向左' },
|
||||
{ value: 'right', label: '向右' },
|
||||
]},
|
||||
{ key: 'method', label: '切换方式', type: 'select', options: [
|
||||
{ value: 'com', label: 'COM 直调(推荐)' },
|
||||
{ value: 'taskview', label: '任务视图导航' },
|
||||
{ value: 'hotkey', label: '系统快捷键' },
|
||||
]},
|
||||
{ key: 'taskview_delay_ms', label: '任务视图等待 (ms)', type: 'number', min: 0, placeholder: '400' },
|
||||
],
|
||||
volume_up: [
|
||||
{ key: 'steps', label: '步进(百分比)', type: 'number', min: 1, placeholder: '1' },
|
||||
],
|
||||
volume_down: [
|
||||
{ key: 'steps', label: '步进(百分比)', type: 'number', min: 1, placeholder: '1' },
|
||||
],
|
||||
toggle_mute: [],
|
||||
show_notification: [
|
||||
{ key: 'title', label: '标题', type: 'text', required: true },
|
||||
{ key: 'text', label: '内容', type: 'text', required: true },
|
||||
],
|
||||
delay: [
|
||||
{ key: 'ms', label: '毫秒', type: 'number', required: true, min: 0 },
|
||||
],
|
||||
launch_application: [
|
||||
{ key: 'path', label: '程序路径', type: 'text', required: true, placeholder: 'C:\\Windows\\System32\\notepad.exe' },
|
||||
{ key: 'args', label: '参数', type: 'text' },
|
||||
],
|
||||
open_url: [
|
||||
{ key: 'url', label: '链接', type: 'text', required: true, placeholder: 'https://example.com' },
|
||||
],
|
||||
}
|
||||
|
||||
// 默认参数(新建动作时填充)。
|
||||
export const ACTION_DEFAULTS: Record<string, Record<string, unknown>> = {
|
||||
switch_virtual_desktop: { mode: 'alternate', method: 'com' },
|
||||
volume_up: { steps: 1 },
|
||||
volume_down: { steps: 1 },
|
||||
toggle_mute: {},
|
||||
show_notification: { title: '', text: '' },
|
||||
delay: { ms: 500 },
|
||||
launch_application: { path: '', args: '' },
|
||||
open_url: { url: '' },
|
||||
}
|
||||
|
||||
export const TRIGGER_DEFAULTS: Record<string, Record<string, unknown>> = {
|
||||
mouse_corner: { corner: 'bottom_left', screen: 'all', threshold_px: 32 },
|
||||
mouse_edge_wheel: { edge: 'top', direction: 'up', threshold_px: 32 },
|
||||
hotkey: { hotkey: 'ctrl+alt+d' },
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
/// <reference types="vite/client" />
|
||||
Reference in new issue
Block a user