diff --git a/plugin/lib/quickcomposer.js b/plugin/lib/quickcomposer.js index c3ab1b2..b79aaa1 100644 --- a/plugin/lib/quickcomposer.js +++ b/plugin/lib/quickcomposer.js @@ -9,6 +9,7 @@ const quickcomposer = { audio: require("./quickcomposer/audio"), image: require("./quickcomposer/image"), windows: require("./quickcomposer/windows"), + macos: require("./quickcomposer/macos"), status: require("./quickcomposer/status"), }; diff --git a/plugin/lib/quickcomposer/macos/app.js b/plugin/lib/quickcomposer/macos/app.js new file mode 100644 index 0000000..aa1de79 --- /dev/null +++ b/plugin/lib/quickcomposer/macos/app.js @@ -0,0 +1,468 @@ +module.exports = { + // 获取前台应用 + getFrontmost: async function () { + const result = await quickcommand.runAppleScript(` + tell application "System Events" + set frontApp to first application process whose frontmost is true + set appName to name of frontApp + set appDisplayName to displayed name of frontApp + try + set appPath to POSIX path of (application file of frontApp) + on error + try + set appPath to POSIX path of (file of frontApp) + on error + set appPath to "" + end try + end try + try + set appVersion to short version of frontApp + on error + set appVersion to "" + end try + try + set appPid to unix id of frontApp + on error + set appPid to 0 + end try + try + set appMemory to background only of frontApp + on error + set appMemory to false + end try + try + set appVisible to visible of frontApp + on error + set appVisible to false + end try + try + set theWindow to window 1 of frontApp + set windowName to name of theWindow + set windowPos to position of theWindow + set windowSize to size of theWindow + set isMinimized to value of attribute "AXMinimized" of theWindow + set isFullscreen to value of attribute "AXFullScreen" of theWindow + try + set windowTitle to title of theWindow + on error + set windowTitle to windowName + end try + try + set windowIndex to index of theWindow + on error + set windowIndex to 1 + end try + set json to "{" + set json to json & "\\"name\\":\\"" & appName & "\\"," + set json to json & "\\"displayedName\\":\\"" & appDisplayName & "\\"," + set json to json & "\\"path\\":\\"" & appPath & "\\"," + set json to json & "\\"version\\":\\"" & appVersion & "\\"," + set json to json & "\\"pid\\":" & appPid & "," + set json to json & "\\"backgroundOnly\\":" & appMemory & "," + set json to json & "\\"visible\\":" & appVisible & "," + set json to json & "\\"frontmost\\":true," + set json to json & "\\"window\\":{" + set json to json & "\\"name\\":\\"" & windowName & "\\"," + set json to json & "\\"title\\":\\"" & windowTitle & "\\"," + set json to json & "\\"index\\":" & windowIndex & "," + set json to json & "\\"position\\":[" & (item 1 of windowPos as text) & "," & (item 2 of windowPos as text) & "]," + set json to json & "\\"size\\":[" & (item 1 of windowSize as text) & "," & (item 2 of windowSize as text) & "]," + set json to json & "\\"minimized\\":" & isMinimized & "," + set json to json & "\\"fullscreen\\":" & isFullscreen + set json to json & "}" + set json to json & "}" + on error + set json to "{" + set json to json & "\\"name\\":\\"" & appName & "\\"," + set json to json & "\\"displayedName\\":\\"" & appDisplayName & "\\"," + set json to json & "\\"path\\":\\"" & appPath & "\\"," + set json to json & "\\"version\\":\\"" & appVersion & "\\"," + set json to json & "\\"pid\\":" & appPid & "," + set json to json & "\\"backgroundOnly\\":" & appMemory & "," + set json to json & "\\"visible\\":" & appVisible & "," + set json to json & "\\"frontmost\\":true," + set json to json & "\\"window\\":null" + set json to json & "}" + end try + return json + end tell + `); + return JSON.parse(result); + }, + + // 获取运行中的应用 + getRunningApps: async function () { + const result = await quickcommand.runAppleScript(` + tell application "System Events" + set appList to "[" + set runningApps to application processes + repeat with i from 1 to count of runningApps + set theApp to item i of runningApps + set appName to name of theApp + set appDisplayName to displayed name of theApp + try + set appPath to POSIX path of (application file of theApp) + on error + try + set appPath to POSIX path of (file of theApp) + on error + set appPath to "" + end try + end try + try + set appVersion to short version of theApp + on error + set appVersion to "" + end try + try + set appPid to unix id of theApp + on error + set appPid to 0 + end try + try + set appMemory to background only of theApp + on error + set appMemory to false + end try + try + set appVisible to visible of theApp + on error + set appVisible to false + end try + try + set theWindow to window 1 of theApp + set windowName to name of theWindow + set windowPos to position of theWindow + set windowSize to size of theWindow + set isMinimized to value of attribute "AXMinimized" of theWindow + set isFullscreen to value of attribute "AXFullScreen" of theWindow + try + set windowTitle to title of theWindow + on error + set windowTitle to windowName + end try + try + set windowIndex to index of theWindow + on error + set windowIndex to 1 + end try + set json to "{" + set json to json & "\\"name\\":\\"" & appName & "\\"," + set json to json & "\\"displayedName\\":\\"" & appDisplayName & "\\"," + set json to json & "\\"path\\":\\"" & appPath & "\\"," + set json to json & "\\"version\\":\\"" & appVersion & "\\"," + set json to json & "\\"pid\\":" & appPid & "," + set json to json & "\\"backgroundOnly\\":" & appMemory & "," + set json to json & "\\"visible\\":" & appVisible & "," + set json to json & "\\"frontmost\\":" & (frontmost of theApp) & "," + set json to json & "\\"window\\":{" + set json to json & "\\"name\\":\\"" & windowName & "\\"," + set json to json & "\\"title\\":\\"" & windowTitle & "\\"," + set json to json & "\\"index\\":" & windowIndex & "," + set json to json & "\\"position\\":[" & (item 1 of windowPos as text) & "," & (item 2 of windowPos as text) & "]," + set json to json & "\\"size\\":[" & (item 1 of windowSize as text) & "," & (item 2 of windowSize as text) & "]," + set json to json & "\\"minimized\\":" & isMinimized & "," + set json to json & "\\"fullscreen\\":" & isFullscreen + set json to json & "}" + set json to json & "}" + on error + set json to "{" + set json to json & "\\"name\\":\\"" & appName & "\\"," + set json to json & "\\"displayedName\\":\\"" & appDisplayName & "\\"," + set json to json & "\\"path\\":\\"" & appPath & "\\"," + set json to json & "\\"version\\":\\"" & appVersion & "\\"," + set json to json & "\\"pid\\":" & appPid & "," + set json to json & "\\"backgroundOnly\\":" & appMemory & "," + set json to json & "\\"visible\\":" & appVisible & "," + set json to json & "\\"frontmost\\":" & (frontmost of theApp) & "," + set json to json & "\\"window\\":null" + set json to json & "}" + end try + if i < count of runningApps then + set appList to appList & json & "," + else + set appList to appList & json + end if + end repeat + return appList & "]" + end tell + `); + return JSON.parse(result); + }, + + // 启动应用 + launch: async function (appName) { + return await quickcommand.runAppleScript(` + tell application "${appName}" + activate + end tell + `); + }, + + // 退出应用 + quit: async function (appName) { + return await quickcommand.runAppleScript(` + tell application "${appName}" + quit + end tell + `); + }, + + // 隐藏应用 + hide: async function (appName) { + return await quickcommand.runAppleScript(` + tell application "System Events" + set visible of process "${appName}" to false + end tell + `); + }, + + // 显示应用 + show: async function (appName) { + return await quickcommand.runAppleScript(` + tell application "System Events" + set visible of process "${appName}" to true + end tell + tell application "${appName}" + activate + end tell + `); + }, + + // 最小化窗口 + minimize: async function (appName) { + return await quickcommand.runAppleScript(` + tell application "System Events" + tell process "${appName}" + try + set value of attribute "AXMinimized" of window 1 to true + end try + end tell + end tell + `); + }, + + // 最大化窗口 + maximize: async function (appName) { + return await quickcommand.runAppleScript(` + tell application "System Events" + tell process "${appName}" + try + set value of attribute "AXMinimized" of window 1 to false + set value of attribute "AXFullScreen" of window 1 to true + end try + end tell + end tell + `); + }, + + // 获取窗口信息 + getWindows: async function (appName) { + const result = await quickcommand.runAppleScript(` + tell application "System Events" + tell process "${appName}" + set appName to name + set appDisplayName to displayed name + set appPid to unix id + set appMemory to background only + set appVisible to visible + set appFrontmost to frontmost + + try + set appPath to POSIX path of (application file) + on error + try + set appPath to POSIX path of file + on error + set appPath to "" + end try + end try + + try + set appVersion to short version + on error + set appVersion to "" + end try + + set windowList to "[" + set theWindows to windows + repeat with i from 1 to count of theWindows + set theWindow to item i of theWindows + try + set windowName to name of theWindow + set windowPos to position of theWindow + set windowSize to size of theWindow + set isMinimized to value of attribute "AXMinimized" of theWindow + set isFullscreen to value of attribute "AXFullScreen" of theWindow + try + set windowTitle to title of theWindow + on error + set windowTitle to windowName + end try + try + set windowIndex to index of theWindow + on error + set windowIndex to i + end try + + set json to "{" + set json to json & "\\"name\\":\\"" & appName & "\\"," + set json to json & "\\"displayedName\\":\\"" & appDisplayName & "\\"," + set json to json & "\\"path\\":\\"" & appPath & "\\"," + set json to json & "\\"version\\":\\"" & appVersion & "\\"," + set json to json & "\\"pid\\":" & appPid & "," + set json to json & "\\"backgroundOnly\\":" & appMemory & "," + set json to json & "\\"visible\\":" & appVisible & "," + set json to json & "\\"frontmost\\":" & appFrontmost & "," + set json to json & "\\"window\\":{" + set json to json & "\\"name\\":\\"" & windowName & "\\"," + set json to json & "\\"title\\":\\"" & windowTitle & "\\"," + set json to json & "\\"index\\":" & windowIndex & "," + set json to json & "\\"position\\":[" & (item 1 of windowPos as text) & "," & (item 2 of windowPos as text) & "]," + set json to json & "\\"size\\":[" & (item 1 of windowSize as text) & "," & (item 2 of windowSize as text) & "]," + set json to json & "\\"minimized\\":" & isMinimized & "," + set json to json & "\\"fullscreen\\":" & isFullscreen + set json to json & "}" + set json to json & "}" + + if i < count of theWindows then + set windowList to windowList & json & "," + else + set windowList to windowList & json + end if + end try + end repeat + return windowList & "]" + end tell + end tell + `); + return JSON.parse(result); + }, + + // 获取应用脚本字典 + getScriptDictionary: async function (appName) { + try { + const { execSync } = require("child_process"); + + // 获取应用路径 + const appPathResult = await quickcommand.runAppleScript(` + tell application "System Events" + tell process "${appName}" + try + set appPath to POSIX path of (application file) + on error + try + set appPath to POSIX path of file + on error + set appPath to "" + end try + end try + return appPath + end tell + end tell + `); + + const appPath = appPathResult.trim(); + if (!appPath) { + return { + commands: [], + properties: [], + error: "找不到应用程序", + }; + } + + // 使用 sdef 命令获取脚本字典 + let xmlContent; + try { + xmlContent = execSync(`/usr/bin/sdef "${appPath}"`).toString(); + } catch (e) { + return { + commands: [], + properties: [], + error: "该应用程序没有脚本字典", + }; + } + + // 使用正则表达式提取命令和属性的详细信息 + const commands = []; + const properties = []; + + // 匹配命令及其描述 + const commandRegex = + /([\s\S]*?)<\/command>/g; + let match; + while ((match = commandRegex.exec(xmlContent)) !== null) { + const name = match[1]; + const description = match[2] || ""; + const content = match[3]; + + // 解析参数 + const parameters = []; + const paramRegex = + / p.name).join(" ") + : "" + }`, + }); + } + + // 匹配属性及其描述 + const propertyRegex = + //g; + while ((match = propertyRegex.exec(xmlContent)) !== null) { + properties.push({ + name: match[1], + description: match[2] || "", + access: match[3] || "read/write", + type: match[4], + usage: `tell application "${appName}" to get ${match[1]}`, + }); + } + + return { + commands, + properties, + summary: { + totalCommands: commands.length, + totalProperties: properties.length, + hasScriptingSupport: true, + }, + }; + } catch (e) { + console.error("Error getting script dictionary:", e); + return { + commands: [], + properties: [], + error: e.message, + }; + } + }, +}; diff --git a/plugin/lib/quickcomposer/macos/finder.js b/plugin/lib/quickcomposer/macos/finder.js new file mode 100644 index 0000000..e958b15 --- /dev/null +++ b/plugin/lib/quickcomposer/macos/finder.js @@ -0,0 +1,110 @@ +module.exports = { + // 获取选中项 + getSelection: async function () { + return await quickcommand.runAppleScript(` + tell application "Finder" + set selectedItems to selection + set itemList to {} + repeat with theItem in selectedItems + set end of itemList to { + name: name of theItem, + path: POSIX path of (theItem as alias), + kind: kind of theItem, + size: size of theItem, + created: creation date of theItem, + modified: modification date of theItem + } + end repeat + return itemList + end tell + `); + }, + + // 获取当前文件夹 + getCurrentFolder: async function () { + return await quickcommand.runAppleScript(` + tell application "Finder" + set currentFolder to (target of front window) as alias + return { + name: name of currentFolder, + path: POSIX path of currentFolder, + kind: kind of currentFolder, + created: creation date of currentFolder, + modified: modification date of currentFolder + } + end tell + `); + }, + + // 新建文件夹 + newFolder: async function (name) { + return await quickcommand.runAppleScript(` + tell application "Finder" + set currentFolder to (target of front window) as alias + make new folder at currentFolder with properties {name:"${name}"} + end tell + `); + }, + + // 移到废纸篓 + moveToTrash: async function () { + return await quickcommand.runAppleScript(` + tell application "Finder" + delete selection + end tell + `); + }, + + // 清空废纸篓 + emptyTrash: async function () { + return await quickcommand.runAppleScript(` + tell application "Finder" + empty trash + end tell + `); + }, + + // 显示包内容 + showPackageContents: async function (path) { + return await quickcommand.runAppleScript(` + tell application "Finder" + open package folder "${path}" + end tell + `); + }, + + // 设置显示隐藏文件 + setShowHiddenFiles: async function (show) { + return await quickcommand.runAppleScript(` + do shell script "defaults write com.apple.finder AppleShowAllFiles -bool ${show}" + do shell script "killall Finder" + `); + }, + + // 设置显示路径栏 + setShowPathbar: async function (show) { + return await quickcommand.runAppleScript(` + tell application "Finder" + set ShowPathbar to ${show} + end tell + `); + }, + + // 设置显示状态栏 + setShowStatusBar: async function (show) { + return await quickcommand.runAppleScript(` + tell application "Finder" + set StatusBar to ${show} + end tell + `); + }, + + // 设置显示预览面板 + setShowPreviewPane: async function (show) { + return await quickcommand.runAppleScript(` + tell application "Finder" + set PreviewPaneIsVisible to ${show} + end tell + `); + }, +}; diff --git a/plugin/lib/quickcomposer/macos/index.js b/plugin/lib/quickcomposer/macos/index.js new file mode 100644 index 0000000..82a4639 --- /dev/null +++ b/plugin/lib/quickcomposer/macos/index.js @@ -0,0 +1,9 @@ +const app = require("./app"); +const system = require("./system"); +const finder = require("./finder"); + +module.exports = { + app, + system, + finder, +}; diff --git a/plugin/lib/quickcomposer/macos/system.js b/plugin/lib/quickcomposer/macos/system.js new file mode 100644 index 0000000..4141db2 --- /dev/null +++ b/plugin/lib/quickcomposer/macos/system.js @@ -0,0 +1,113 @@ +module.exports = { + // 控制中心 + controlCenter: async function () { + return await quickcommand.runAppleScript(` + tell application "System Events" + tell process "Control Center" + click menu bar item 1 of menu bar 1 + end tell + end tell + `); + }, + + // 通知中心 + notificationCenter: async function () { + return await quickcommand.runAppleScript(` + tell application "System Events" + tell process "NotificationCenter" + click menu bar item 1 of menu bar 1 + end tell + end tell + `); + }, + + // 设置系统音量 + setVolume: async function (volume) { + return await quickcommand.runAppleScript(` + set volume output volume ${volume} + `); + }, + + // 设置屏幕亮度 + setBrightness: async function (brightness) { + return await quickcommand.runAppleScript(` + tell application "System Events" + tell process "SystemUIServer" + set value of slider 1 of group 1 of window "Display" to ${brightness} + end tell + end tell + `); + }, + + // 锁定屏幕 + lockScreen: async function () { + return await quickcommand.runAppleScript(` + tell application "System Events" + keystroke "q" using {command down, control down} + end tell + `); + }, + + // 进入睡眠 + sleep: async function () { + return await quickcommand.runAppleScript(` + tell application "System Events" + sleep + end tell + `); + }, + + // 设置Dock位置 + setDockPosition: async function (position) { + return await quickcommand.runAppleScript(` + do shell script "defaults write com.apple.dock orientation -string ${position}" + do shell script "killall Dock" + `); + }, + + // 设置Dock大小 + setDockSize: async function (size) { + return await quickcommand.runAppleScript(` + do shell script "defaults write com.apple.dock tilesize -int ${size}" + do shell script "killall Dock" + `); + }, + + // 设置Dock自动隐藏 + toggleDockAutohide: async function (enabled) { + return await quickcommand.runAppleScript(` + do shell script "defaults write com.apple.dock autohide -bool ${enabled}" + do shell script "killall Dock" + `); + }, + + // 设置菜单栏自动隐藏 + toggleMenuBarAutohide: async function (enabled) { + return await quickcommand.runAppleScript(` + tell application "System Events" + tell dock preferences + set autohide menu bar to ${enabled} + end tell + end tell + `); + }, + + // 设置时钟格式 + setClockFormat: async function (format) { + return await quickcommand.runAppleScript(` + do shell script "defaults write com.apple.menuextra.clock DateFormat -string '${format}'" + do shell script "killall SystemUIServer" + `); + }, + + // 切换深色模式 + toggleDarkMode: async function (enabled) { + return await quickcommand.runAppleScript(` + tell application "System Events" + tell appearance preferences + set dark mode to ${enabled} + end tell + end tell + `); + }, +}; diff --git a/src/components/composer/param/ParamImporter.vue b/src/components/composer/param/ParamImporter.vue index b9460a9..e988a7a 100644 --- a/src/components/composer/param/ParamImporter.vue +++ b/src/components/composer/param/ParamImporter.vue @@ -39,7 +39,7 @@ export default defineComponent({ }, props: { config: { - type: Array, + type: Object, required: true, }, modelValue: { diff --git a/src/js/composer/commands/index.js b/src/js/composer/commands/index.js index 571c9b6..3bf3d0a 100644 --- a/src/js/composer/commands/index.js +++ b/src/js/composer/commands/index.js @@ -16,6 +16,7 @@ import { audioCommands } from "./audioCommands"; import { imageCommands } from "./imageCommands"; import { windowsCommands } from "./windowsCommands"; import { statusCommands } from "./statusCommands"; +import { macosCommands } from "./macosCommands"; let commands = [ fileCommands, @@ -40,6 +41,10 @@ if (window.utools.isWindows()) { commands.push(windowsCommands); } +if (window.utools.isMacOS()) { + commands.push(macosCommands); +} + commands.push(otherCommands); export const commandCategories = commands; diff --git a/src/js/composer/commands/macosCommands.js b/src/js/composer/commands/macosCommands.js new file mode 100644 index 0000000..98e779a --- /dev/null +++ b/src/js/composer/commands/macosCommands.js @@ -0,0 +1,445 @@ +export const macosCommands = { + label: "MacOS专区", + icon: "laptop_mac", + defaultOpened: false, + commands: [ + { + value: "quickcomposer.macos.app.getFrontmost", + label: "应用管理", + desc: "应用程序管理功能", + icon: "apps", + isAsync: true, + subCommands: [ + { + value: "quickcomposer.macos.app.getFrontmost", + label: "获取前台应用", + desc: "获取当前前台运行的应用信息", + icon: "front_hand", + }, + { + value: "quickcomposer.macos.app.getRunningApps", + label: "获取活动应用", + desc: "获取所有正在运行的应用列表", + icon: "list", + }, + { + value: "quickcomposer.macos.app.launch", + label: "启动应用", + desc: "启动指定的应用程序", + icon: "launch", + config: [ + { + key: "appName", + label: "应用名称", + component: "VariableInput", + icon: "apps", + width: 12, + placeholder: "输入应用名称", + }, + ], + }, + { + value: "quickcomposer.macos.app.quit", + label: "退出应用", + desc: "退出指定的应用程序", + icon: "close", + config: [ + { + key: "appName", + label: "应用名称", + component: "VariableInput", + icon: "apps", + width: 12, + placeholder: "输入应用名称", + }, + ], + }, + { + value: "quickcomposer.macos.app.hide", + label: "隐藏应用", + desc: "隐藏指定的应用程序", + icon: "visibility_off", + config: [ + { + key: "appName", + label: "应用名称", + component: "VariableInput", + icon: "apps", + width: 12, + placeholder: "输入应用名称", + }, + ], + }, + { + value: "quickcomposer.macos.app.show", + label: "显示应用", + desc: "显示指定的应用程序", + icon: "visibility", + config: [ + { + key: "appName", + label: "应用名称", + component: "VariableInput", + icon: "apps", + width: 12, + placeholder: "输入应用名称", + }, + ], + }, + { + value: "quickcomposer.macos.app.minimize", + label: "最小化窗口", + desc: "最小化指定应用的窗口", + icon: "minimize", + config: [ + { + key: "appName", + label: "应用名称", + component: "VariableInput", + icon: "apps", + width: 12, + placeholder: "输入应用名称", + }, + ], + }, + { + value: "quickcomposer.macos.app.maximize", + label: "最大化窗口", + desc: "最大化指定应用的窗口", + icon: "maximize", + config: [ + { + key: "appName", + label: "应用名称", + component: "VariableInput", + icon: "apps", + width: 12, + placeholder: "输入应用名称", + }, + ], + }, + { + value: "quickcomposer.macos.app.getWindows", + label: "获取窗口信息", + desc: "获取指定应用的所有窗口信息", + icon: "window", + config: [ + { + key: "appName", + label: "应用名称", + component: "VariableInput", + icon: "apps", + width: 12, + placeholder: "输入应用名称", + }, + ], + }, + { + value: "quickcomposer.macos.app.getScriptDictionary", + label: "获取应用脚本字典", + desc: "获取应用程序的AppleScript字典内容", + icon: "code", + config: [ + { + key: "appName", + label: "应用名称", + component: "VariableInput", + icon: "apps", + width: 12, + placeholder: "输入应用名称", + }, + ], + }, + ], + }, + { + value: "quickcomposer.macos.system", + label: "系统管理", + desc: "系统级别的控制功能", + icon: "settings", + isAsync: true, + subCommands: [ + { + value: "quickcomposer.macos.system.controlCenter", + label: "控制中心", + desc: "打开或关闭控制中心", + icon: "toggle_on", + }, + { + value: "quickcomposer.macos.system.notificationCenter", + label: "通知中心", + desc: "打开或关闭通知中心", + icon: "notifications", + }, + { + value: "quickcomposer.macos.system.setVolume", + label: "系统音量", + desc: "调整系统音量", + icon: "volume_up", + config: [ + { + key: "volume", + label: "音量", + component: "NumberInput", + icon: "volume_up", + min: 0, + max: 100, + defaultValue: 50, + width: 12, + }, + ], + }, + { + value: "quickcomposer.macos.system.setBrightness", + label: "屏幕亮度", + desc: "调整屏幕亮度", + icon: "brightness_medium", + config: [ + { + key: "brightness", + label: "亮度", + component: "NumberInput", + icon: "brightness_medium", + min: 0, + max: 100, + defaultValue: 50, + width: 12, + }, + ], + }, + { + value: "quickcomposer.macos.system.lockScreen", + label: "锁定屏幕", + desc: "锁定系统屏幕", + icon: "lock", + }, + { + value: "quickcomposer.macos.system.sleep", + label: "进入睡眠", + desc: "使系统进入睡眠状态", + icon: "bedtime", + }, + { + value: "quickcomposer.macos.system.setDockPosition", + label: "Dock位置", + desc: "设置Dock栏位置", + icon: "swap_horiz", + config: [ + { + key: "position", + label: "位置", + component: "ButtonGroup", + width: 12, + options: [ + { label: "底部", value: "bottom" }, + { label: "左侧", value: "left" }, + { label: "右侧", value: "right" }, + ], + defaultValue: "bottom", + }, + ], + }, + { + value: "quickcomposer.macos.system.setDockSize", + label: "Dock大小", + desc: "设置Dock栏大小", + icon: "aspect_ratio", + config: [ + { + key: "size", + label: "大小", + component: "NumberInput", + min: 16, + max: 128, + defaultValue: 48, + width: 12, + }, + ], + }, + { + value: "quickcomposer.macos.system.toggleDockAutohide", + label: "Dock自动隐藏", + desc: "设置Dock栏自动隐藏", + icon: "visibility_off", + config: [ + { + key: "enabled", + label: "启用", + component: "CheckButton", + width: 12, + defaultValue: false, + }, + ], + }, + { + value: "quickcomposer.macos.system.toggleMenuBarAutohide", + label: "菜单栏自动隐藏", + desc: "设置菜单栏自动隐藏", + icon: "visibility_off", + config: [ + { + key: "enabled", + label: "启用", + component: "CheckButton", + width: 12, + defaultValue: false, + }, + ], + }, + { + value: "quickcomposer.macos.system.setClockFormat", + label: "时钟格式", + desc: "设置菜单栏时钟显示格式", + icon: "schedule", + config: [ + { + key: "format", + label: "格式", + component: "TextInput", + width: 12, + placeholder: "EEE MMM d H:mm:ss", + }, + ], + }, + { + value: "quickcomposer.macos.system.toggleDarkMode", + label: "深色模式", + desc: "切换系统深色模式", + icon: "dark_mode", + config: [ + { + key: "enabled", + label: "启用", + component: "CheckButton", + width: 12, + defaultValue: false, + }, + ], + }, + ], + }, + { + value: "quickcomposer.macos.finder", + label: "访达管理", + desc: "访达操作和文件管理功能", + icon: "folder", + isAsync: true, + subCommands: [ + { + value: "quickcomposer.macos.finder.getSelection", + label: "获取选中项", + desc: "获取访达中当前选中的项目", + icon: "select_all", + }, + { + value: "quickcomposer.macos.finder.getCurrentFolder", + label: "获取当前文件夹", + desc: "获取访达当前打开的文件夹路径", + icon: "folder_open", + }, + { + value: "quickcomposer.macos.finder.newFolder", + label: "新建文件夹", + desc: "在当前位置创建新文件夹", + icon: "create_new_folder", + config: [ + { + key: "name", + label: "文件夹名称", + component: "TextInput", + width: 12, + placeholder: "新建文件夹", + }, + ], + }, + { + value: "quickcomposer.macos.finder.moveToTrash", + label: "移到废纸篓", + desc: "将选中项目移动到废纸篓", + icon: "delete", + }, + { + value: "quickcomposer.macos.finder.emptyTrash", + label: "清空废纸篓", + desc: "清空废纸篓", + icon: "delete_forever", + }, + { + value: "quickcomposer.macos.finder.showPackageContents", + label: "显示包内容", + desc: "显示应用程序包内容", + icon: "folder_zip", + config: [ + { + key: "path", + label: "应用路径", + component: "FilePicker", + width: 12, + placeholder: "选择应用程序", + }, + ], + }, + { + value: "quickcomposer.macos.finder.setShowHiddenFiles", + label: "显示隐藏文件", + desc: "设置是否显示隐藏文件", + icon: "visibility", + config: [ + { + key: "show", + label: "显示", + component: "CheckButton", + width: 12, + defaultValue: false, + }, + ], + }, + { + value: "quickcomposer.macos.finder.setShowPathbar", + label: "显示路径栏", + desc: "设置是否显示路径栏", + icon: "wrap_text", + config: [ + { + key: "show", + label: "显示", + component: "CheckButton", + width: 12, + defaultValue: true, + }, + ], + }, + { + value: "quickcomposer.macos.finder.setShowStatusBar", + label: "显示状态栏", + desc: "设置是否显示状态栏", + icon: "info", + config: [ + { + key: "show", + label: "显示", + component: "CheckButton", + width: 12, + defaultValue: true, + }, + ], + }, + { + value: "quickcomposer.macos.finder.setShowPreviewPane", + label: "显示预览面板", + desc: "设置是否显示预览面板", + icon: "preview", + config: [ + { + key: "show", + label: "显示", + component: "CheckButton", + width: 12, + defaultValue: true, + }, + ], + }, + ], + }, + ], +}; diff --git a/src/js/composer/commands/screenCommands.js b/src/js/composer/commands/screenCommands.js index cc1fbdc..fb90e32 100644 --- a/src/js/composer/commands/screenCommands.js +++ b/src/js/composer/commands/screenCommands.js @@ -67,7 +67,7 @@ const RECT_DICT_EDITOR = { export const screenCommands = { label: "显示器", - icon: "screenshot_monitor", + icon: "display_settings", commands: [ { value: "utools.getPrimaryDisplay", diff --git a/src/js/composer/commands/systemCommands.js b/src/js/composer/commands/systemCommands.js index 04dc3f9..a281f6a 100644 --- a/src/js/composer/commands/systemCommands.js +++ b/src/js/composer/commands/systemCommands.js @@ -2,7 +2,7 @@ import { newVarInputVal } from "js/composer/varInputValManager"; export const systemCommands = { label: "系统操作", - icon: "computer", + icon: "settings_suggest", defaultOpened: false, commands: [ { diff --git a/src/js/composer/commands/windowsCommands.js b/src/js/composer/commands/windowsCommands.js index 046615a..1449b32 100644 --- a/src/js/composer/commands/windowsCommands.js +++ b/src/js/composer/commands/windowsCommands.js @@ -1,7 +1,5 @@ -import { newVarInputVal } from "js/composer/varInputValManager"; - export const windowsCommands = { - label: "Windows工具", + label: "Windows专区", icon: "window", defaultOpened: false, commands: [