ref: 支持win搜索快捷启动

This commit is contained in:
muwoo 2022-01-11 12:18:08 +08:00
parent 04e674d1cd
commit bdae8c280b
2 changed files with 12 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "rubick", "name": "rubick",
"version": "2.0.1-beta.14", "version": "2.0.1-beta.15",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",

View File

@ -6,8 +6,14 @@ import { shell } from "electron";
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
const fileIcon = require("extract-file-icon"); const fileIcon = require("extract-file-icon");
const filePath = path.resolve("C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs"); const filePath = path.resolve("C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs");
const appData = path.join(os.homedir(), "./AppData/Roaming");
const startMenu = path.join(appData, "Microsoft\\Windows\\Start Menu\\Programs");
const fileLists: any = []; const fileLists: any = [];
const isZhRegex = /[\u4e00-\u9fa5]/; const isZhRegex = /[\u4e00-\u9fa5]/;
@ -58,7 +64,10 @@ function fileDisplay(filePath) {
} catch(e) { } catch(e) {
// //
} }
if (!appDetail.target || appDetail.target.toLowerCase().indexOf("unin") >= 0) return; if (!appDetail.target || appDetail.target.toLowerCase().indexOf("unin") >= 0 || appDetail.args) return;
// C:/program/cmd.exe => cmd
keyWords.push(path.basename(appDetail.target, ".exe"));
if (isZhRegex.test(appName)) { if (isZhRegex.test(appName)) {
const py = translate(appName); const py = translate(appName);
@ -101,5 +110,6 @@ function fileDisplay(filePath) {
export default () => { export default () => {
fileDisplay(filePath); fileDisplay(filePath);
fileDisplay(startMenu);
return fileLists; return fileLists;
}; };