优化调整
This commit is contained in:
+82
-1
@@ -54,7 +54,11 @@ export const commands = {
|
||||
quickpanelShowWindow: () => __TAURI_INVOKE<null>("quickpanel_show_window"),
|
||||
/** 锁定屏幕(Windows: rundll32 user32.dll,LockWorkStation,CREATE_NO_WINDOW 避免黑窗) */
|
||||
quickpanelLockScreen: () => __TAURI_INVOKE<null>("quickpanel_lock_screen"),
|
||||
/** 初始化文件索引数据库(应用启动时调用) */
|
||||
/**
|
||||
* 初始化文件索引数据库(应用启动时调用)。
|
||||
* 若存在上次构建的索引(last_built_dirs 非空),自动恢复 notify 增量监听,
|
||||
* 无需重建即可继续自动同步文件变更。
|
||||
*/
|
||||
quickpanelInitFileIndex: () => __TAURI_INVOKE<null>("quickpanel_init_file_index"),
|
||||
/** 构建文件索引(全量重建,阻塞操作建议在 spawn_blocking 调用) */
|
||||
quickpanelBuildFileIndex: () => __TAURI_INVOKE<number>("quickpanel_build_file_index"),
|
||||
@@ -96,6 +100,35 @@ export const commands = {
|
||||
* 适用于内置系统工具:regedit、shutdown、cmd、powershell、taskmgr 等。
|
||||
*/
|
||||
quickpanelRunSystemCommand: (command: string, args: string[]) => __TAURI_INVOKE<null>("quickpanel_run_system_command", { command, args }),
|
||||
/** 列出目录下的压缩包文件(供批量解压面板使用)。 */
|
||||
quickpanelListArchives: (dir: string) => __TAURI_INVOKE<ArchiveInfo[]>("quickpanel_list_archives", { dir }),
|
||||
/** 列出目录下的全部条目(供批量重命名/删除面板使用,不含子目录递归)。 */
|
||||
quickpanelListDir: (dir: string) => __TAURI_INVOKE<FileEntry[]>("quickpanel_list_dir", { dir }),
|
||||
/**
|
||||
* 批量解压。`files` 为压缩包路径列表,`dest_dir` 为目标目录,
|
||||
* `password` 为统一解压密码(可空),`into_subfolder` 是否解压到同名子文件夹。
|
||||
* 每完成一个文件通过 `quickpanel-extract-progress` 事件推送进度。
|
||||
*/
|
||||
quickpanelBatchExtract: (files: string[], destDir: string, password: string | null, intoSubfolder: boolean) => __TAURI_INVOKE<ExtractResult[]>("quickpanel_batch_extract", { files, destDir, password, intoSubfolder }),
|
||||
/**
|
||||
* 正则批量重命名预览:对每个文件名应用 `pattern → replacement`,
|
||||
* 仅返回有匹配的文件,`newName` 为替换结果。
|
||||
*/
|
||||
quickpanelPreviewRename: (files: string[], pattern: string, replacement: string) => __TAURI_INVOKE<RenamePreview[]>("quickpanel_preview_rename", { files, pattern, replacement }),
|
||||
/** 执行重命名。同一目录下若目标已存在则跳过该项。 */
|
||||
quickpanelApplyRename: (items: RenameItem[]) => __TAURI_INVOKE<RenameResult[]>("quickpanel_apply_rename", { items }),
|
||||
/**
|
||||
* 批量删除文件/目录。`force=false` 时移动至回收站;`force=true` 时先递归清除
|
||||
* 只读属性再永久删除(可绕过只读/部分占用导致的删除失败,但被其他进程真正
|
||||
* 锁定的文件仍会失败并返回原因)。
|
||||
*/
|
||||
quickpanelDeleteFiles: (paths: string[], force: boolean) => __TAURI_INVOKE<DeleteResult[]>("quickpanel_delete_files", { paths, force }),
|
||||
/**
|
||||
* 显示主窗口并强制置为前台。
|
||||
* Tauri 的 set_focus 在 Windows 上受前台锁定限制,主窗口被其他应用遮挡时无法到前台;
|
||||
* 改用原生 SetForegroundWindow + BringWindowToTop(模拟 Alt 键重置前台锁定)。
|
||||
*/
|
||||
quickpanelFocusMainWindow: () => __TAURI_INVOKE<null>("quickpanel_focus_main_window"),
|
||||
clipboardGetHistory: (limit: number | null, offset: number | null, kind: string | null) => __TAURI_INVOKE<HistoryPage>("clipboard_get_history", { limit, offset, kind }),
|
||||
clipboardGetPinned: () => __TAURI_INVOKE<ClipboardItem[]>("clipboard_get_pinned"),
|
||||
clipboardSearch: (query: string, limit: number | null, offset: number | null) => __TAURI_INVOKE<HistoryPage>("clipboard_search", { query, limit, offset }),
|
||||
@@ -206,6 +239,12 @@ export type AppRecord = {
|
||||
path: string,
|
||||
};
|
||||
|
||||
export type ArchiveInfo = {
|
||||
name: string,
|
||||
path: string,
|
||||
size: number,
|
||||
};
|
||||
|
||||
/** 前端可见的捕获数据 */
|
||||
export type CaptureData = {
|
||||
pngBase64: string,
|
||||
@@ -280,6 +319,14 @@ export type CustomCommand = {
|
||||
args?: string[],
|
||||
};
|
||||
|
||||
/** 批量删除单个条目的结果。 */
|
||||
export type DeleteResult = {
|
||||
name: string,
|
||||
path: string,
|
||||
ok: boolean,
|
||||
error: string,
|
||||
};
|
||||
|
||||
/** 下载任务 */
|
||||
export type DownloadTask = {
|
||||
/** 任务 ID(自增 hex 字符串) */
|
||||
@@ -350,6 +397,20 @@ export type ExistingTaskInfo = {
|
||||
status: TaskStatus,
|
||||
};
|
||||
|
||||
export type ExtractResult = {
|
||||
name: string,
|
||||
path: string,
|
||||
ok: boolean,
|
||||
error: string,
|
||||
};
|
||||
|
||||
export type FileEntry = {
|
||||
name: string,
|
||||
path: string,
|
||||
isDir: boolean,
|
||||
size: number,
|
||||
};
|
||||
|
||||
/** 单个文件记录(返回给前端) */
|
||||
export type FileRecord = {
|
||||
path: string,
|
||||
@@ -449,6 +510,26 @@ export type QuickPanelSettings = {
|
||||
customCommands?: CustomCommand[],
|
||||
};
|
||||
|
||||
export type RenameItem = {
|
||||
path: string,
|
||||
oldName: string,
|
||||
newName: string,
|
||||
};
|
||||
|
||||
export type RenamePreview = {
|
||||
path: string,
|
||||
oldName: string,
|
||||
newName: string,
|
||||
error: string,
|
||||
};
|
||||
|
||||
export type RenameResult = {
|
||||
oldName: string,
|
||||
newName: string,
|
||||
ok: boolean,
|
||||
error: string,
|
||||
};
|
||||
|
||||
export type ScreenRect = {
|
||||
x: number,
|
||||
y: number,
|
||||
|
||||
Reference in New Issue
Block a user