Compare commits

...

5 Commits

Author SHA1 Message Date
unknown
ea851c652c update. 2025-01-12 12:09:21 +08:00
unknown
9243140d3b 更新版本。 2025-01-12 12:08:56 +08:00
unknown
36b77ce32b 修复同一目录下打开文件夹却打开应用程序的问题。 2025-01-12 12:08:37 +08:00
unknown
d51a5404ee 修复项目在自定义排序拖拽移动项目问题。 2025-01-12 12:06:26 +08:00
unknown
018bd91931 修复程序在某些情况崩溃的问题。 2025-01-12 12:04:14 +08:00
8 changed files with 113 additions and 45 deletions

View File

@ -561,6 +561,13 @@ function showOpenDialogSync(windowName: string, options: OpenDialogOptions) {
return pathList;
}
/**
*
*/
function mainWindowExist() {
return global.mainWindow && !global.mainWindow.isDestroyed();
}
export {
downloadImage,
getURLInfo,
@ -580,4 +587,5 @@ export {
showErrorMessageBox,
showSaveDialogSync,
showOpenDialogSync,
mainWindowExist,
};

View File

@ -323,12 +323,14 @@ function updateOpenInfo(type: string, id: number) {
*/
function run(
type: string,
operation: "open" | "runas" | "openFileLocation",
operation: "open" | "runas" | "openFileLocation" | "explore",
item: Item
) {
if (item.data) {
if (operation === "open" && item.data.runAsAdmin) {
operation = "runas";
} else if (operation === "open" && item.type === 1) {
operation = "explore";
}
// 更新打开信息
updateOpenInfo(type, item.id);

View File

@ -13,6 +13,7 @@ import cacheData from "../commons/cacheData";
import {
getMainBackgorunColor,
getWindowInScreen,
mainWindowExist,
sendToWebContent,
} from "../commons";
import { release } from "node:os";
@ -236,12 +237,13 @@ function createMainWindow() {
*/
function onBlurHide() {
if (
mainWindow.isVisible() &&
mainWindowExist() &&
global.mainWindow.isVisible() &&
global.setting.general.hideLoseFocus &&
!global.setting.general.alwaysTop &&
mainWindow.getChildWindows().length === 0 &&
global.mainWindow.getChildWindows().length === 0 &&
!global.mainWindowShowDialog &&
!hasCursorPosWindow(mainWindow)
!hasCursorPosWindow(global.mainWindow)
) {
// 隐藏窗口
hideMainWindow();
@ -299,6 +301,9 @@ function showMainWindowBefore(
* @param autoHide
*/
function showMainWindow(blurHide: boolean, autoHide = false) {
if (!mainWindowExist()) {
return;
}
// flag
let flag = true;
// 是否开启勿扰模式
@ -313,12 +318,12 @@ function showMainWindow(blurHide: boolean, autoHide = false) {
}
if (flag) {
if (!global.setting.general.alwaysTop) {
mainWindow.setAlwaysOnTop(true, "screen-saver");
global.mainWindow.setAlwaysOnTop(true, "screen-saver");
}
global.mainWindow.show();
global.mainWindow.focus();
if (!global.setting.general.alwaysTop) {
mainWindow.setAlwaysOnTop(false);
global.mainWindow.setAlwaysOnTop(false);
}
global.blurHide = blurHide;
}
@ -328,7 +333,7 @@ function showMainWindow(blurHide: boolean, autoHide = false) {
*
*/
function hideMainWindow() {
if (global.mainWindow.isVisible()) {
if (mainWindowExist() && global.mainWindow.isVisible()) {
global.mainWindow.hide();
global.blurHide = false;
}
@ -389,10 +394,13 @@ function createTray(show: boolean) {
* @returns
*/
function edgeAdsorb(display: Display | null, workArea = false) {
if (!mainWindowExist()) {
return;
}
// 如果勾选停靠在桌面边缘时自动隐藏,放行
if (
global.mainWindow.isDestroyed() ||
(!global.setting.general.edgeAdsorb && !global.setting.general.edgeAutoHide)
!global.setting.general.edgeAdsorb &&
!global.setting.general.edgeAutoHide
) {
return;
}
@ -400,7 +408,7 @@ function edgeAdsorb(display: Display | null, workArea = false) {
// 清空方向
global.mainWindowDirection = null;
// 屏幕
let displays = display ? [display] : getWindowInScreen(mainWindow);
let displays = display ? [display] : getWindowInScreen(global.mainWindow);
if (displays.length > 1 || displays.length === 0) {
return;
}
@ -489,6 +497,9 @@ function edgeAdsorb(display: Display | null, workArea = false) {
*
*/
function showFollowMousePosition() {
if (!mainWindowExist()) {
return;
}
// 当永远居中、固定位置勾选后不能使用显示时跟随鼠标位置
if (
!global.setting.general.alwaysCenter &&
@ -519,6 +530,9 @@ function showFollowMousePosition() {
* /
*/
function showHideMouseWheelClick() {
if (!mainWindowExist()) {
return;
}
if (global.setting.general.showHideMouseWheelClick) {
if (global.mainWindow.isVisible()) {
hideMainWindow();
@ -532,8 +546,11 @@ function showHideMouseWheelClick() {
*
*/
function alwaysCenter() {
if (!mainWindowExist()) {
return;
}
if (global.setting.general.alwaysCenter) {
mainWindow.center();
global.mainWindow.center();
}
}
@ -544,26 +561,32 @@ function alwaysCenter() {
* @returns
*/
function autoHide(size: number, timer: boolean) {
if (global.mainWindow.isDestroyed() || !global.setting.general.edgeAutoHide) {
if (!mainWindowExist()) {
return;
}
if (!global.setting.general.edgeAutoHide) {
return;
}
// 当有子窗口时不自动隐藏
if (mainWindow.getChildWindows().length > 0 || global.mainWindowShowDialog) {
if (
global.mainWindow.getChildWindows().length > 0 ||
global.mainWindowShowDialog
) {
return;
}
let x = screen.getCursorScreenPoint().x;
let y = screen.getCursorScreenPoint().y;
try {
// 屏幕
let displays = getWindowInScreen(mainWindow);
let displays = getWindowInScreen(global.mainWindow);
if (displays.length > 1 || displays.length === 0) {
return;
}
// 屏幕区域
let displayBounds = displays[0].bounds;
// 窗口位置信息
let bounds = mainWindow.getBounds();
if (mainWindow.isVisible()) {
let bounds = global.mainWindow.getBounds();
if (global.mainWindow.isVisible()) {
let flag = false;
if (bounds.x === displayBounds.x && bounds.y === displayBounds.y) {
// 左上角
@ -738,12 +761,15 @@ function doubleClickTaskbar(
mousedownClassName: string | null,
className: string | null
) {
if (!mainWindowExist()) {
return;
}
// 必须开启设置
if (!global.setting.general.showHideDoubleClickTaskbar) {
return;
}
// 获取屏幕
let displays = getWindowInScreen(mainWindow);
let displays = getWindowInScreen(global.mainWindow);
if (
displays.length > 1 ||
displays.length === 0 ||
@ -779,7 +805,7 @@ function doubleClickTaskbar(
// 清空计数
global.doubleClickTaskbarCounter = 0;
// 显示或隐藏
if (mainWindow.isVisible()) {
if (global.mainWindow.isVisible()) {
hideMainWindow();
} else {
showMainWindowBefore(false);

View File

@ -5,7 +5,11 @@ import { hideMainWindow, showMainWindowBefore } from "../main/index";
import { list as selectClassificationList } from "../classification/data";
import { list as selectItemList } from "../item/data";
import { run } from "../item";
import { closeWindow, getMainBackgorunColor } from "../commons/index";
import {
closeWindow,
getMainBackgorunColor,
mainWindowExist,
} from "../commons/index";
import {
createQuickSearchWindow,
hideQuickSearchWindow,
@ -83,12 +87,14 @@ function setShortcutKey(setting: Setting = global.setting) {
globalShortcut.register(
setting.general.showHideShortcutKey.replace("Win", "Super"),
() => {
if (mainWindowExist()) {
if (global.mainWindow.isVisible()) {
hideMainWindow();
} else {
showMainWindowBefore(true);
}
}
}
);
} catch (e) {
if (process.env.NODE_ENV === "development") {
@ -104,9 +110,11 @@ function setShortcutKey(setting: Setting = global.setting) {
globalShortcut.register(
classification.shortcutKey.replace("Win", "Super"),
() => {
if (mainWindowExist()) {
// 分类
showMainWindowBefore(true, false, classification.id);
}
}
);
} catch (e) {
if (process.env.NODE_ENV === "development") {
@ -123,6 +131,7 @@ function setShortcutKey(setting: Setting = global.setting) {
globalShortcut.register(
item.shortcutKey.replace("Win", "Super"),
() => {
if (mainWindowExist()) {
// flag
let flag = true;
// 是否开启勿扰模式
@ -136,6 +145,7 @@ function setShortcutKey(setting: Setting = global.setting) {
run("main", "open", item);
}
}
}
);
} catch (e) {
if (process.env.NODE_ENV === "development") {

View File

@ -1,7 +1,7 @@
{
"name": "dawn-launcher",
"productName": "Dawn Launcher",
"version": "1.4.7",
"version": "1.5.0",
"main": "dist-electron/main/index.js",
"description": "Windows 快捷启动工具,帮助您整理杂乱无章的桌面,分门别类管理您的桌面快捷方式,让您的桌面保持干净整洁。",
"author": "FanChenIO",

View File

@ -729,6 +729,8 @@ pub fn shell_execute(
operation = String::from("open");
}
}
// 是否是打开文件夹
let is_dir = operation == "explore";
// dir
let dir = start_location.unwrap_or_else(|| {
// 判断是否是文件夹
@ -752,9 +754,19 @@ pub fn shell_execute(
let params = PCWSTR(params.as_ptr());
let dir = PCWSTR(dir.as_ptr());
unsafe {
// execute
if is_dir {
ShellExecuteW(
None,
w!("open"),
w!("explorer.exe"),
file,
None,
SW_SHOWDEFAULT,
);
} else {
ShellExecuteW(None, operation, file, params, dir, SW_SHOWDEFAULT);
}
}
});
}

View File

@ -34,7 +34,7 @@
/>
<p class="mt-4">Dawn Launcher {{ version }}</p>
<p class="mt-2">
Copyright © 2022-2024 Dawn Launcher. All Rights Reserved
Copyright © 2022-2025 Dawn Launcher. All Rights Reserved
</p>
<p class="mt-2">
{{ store.language.officialWebsite }}{{ store.language.colon

View File

@ -130,6 +130,7 @@ import {
setItemWidth,
run,
removeInvalidItem,
showItemList,
} from "../js";
import ItemList from "./List.vue";
import { Item } from "../../../../types/item";
@ -315,12 +316,21 @@ function createItemSortable() {
let fromClassificationId = parseInt(
event.from.getAttribute("classification-id")!
);
//
const currentItem =
getItemListByClassificationId(fromClassificationId)[
event.oldIndex
];
let fromClassification =
getClassificationById(fromClassificationId);
if (fromClassification) {
let itemList =
getItemListByClassificationId(fromClassificationId);
if (itemList) {
let copyItemList = JSON.parse(JSON.stringify(itemList));
//
const currentItem = showItemList(
copyItemList,
fromClassification
)[event.oldIndex];
fromIdList.push(currentItem.id);
}
}
} else {
//
for (const value of store.itemBatchOperationDataArray) {