Skip to content

Commit 06d3667

Browse files
committed
enh(#1255): allow close window using middle click
1 parent c75aec0 commit 06d3667

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### features
66

77
- add new cli command to bundle resources.
8+
- allow close window using middle click on dock item preview.
89

910
### refactor
1011

src/ui/react/weg/modules/item/infra/UserApplicationPreview.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ interface PreviewProps {
1818

1919
const TEMP_FOLDER = await tempDir();
2020

21-
export const UserApplicationPreview = (
22-
{ title, hwnd, isFocused }: PreviewProps,
23-
) => {
21+
export const UserApplicationPreview = ({ title, hwnd, isFocused }: PreviewProps) => {
2422
const imageUrl = convertFileSrc(`${TEMP_FOLDER}${hwnd}.png`);
2523

2624
const [imageSrc, setImageSrc] = useState<string | null>(imageUrl);
@@ -44,15 +42,19 @@ export const UserApplicationPreview = (
4442
return (
4543
<div
4644
className={cx("weg-item-preview", {
47-
"weg-item-preview-thumbnail-disabled": !$settings.value
48-
.thumbnailGenerationEnabled,
45+
"weg-item-preview-thumbnail-disabled": !$settings.value.thumbnailGenerationEnabled,
4946
})}
5047
onClick={() => {
5148
invoke(SeelenCommand.WegToggleWindowState, {
5249
hwnd,
5350
wasFocused: isFocused,
5451
});
5552
}}
53+
onAuxClick={(e) => {
54+
if (e.button === 1) {
55+
invoke(SeelenCommand.WegCloseApp, { hwnd });
56+
}
57+
}}
5658
>
5759
<div className="weg-item-preview-topbar">
5860
<div className="weg-item-preview-title">{title}</div>

0 commit comments

Comments
 (0)