Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix app not focusing on previous window on MacOS #36

Merged
merged 2 commits into from
Jul 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/utils/stickerHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,26 @@ async function pasteStickerFromPath(
}

// write sticker file to clipboard
// Thanks Kastow https://stackoverflow.com/a/76242802/22187538
if (process.platform === 'darwin') {
// Not sure if buffer works on mac
clipboard.writeImage(tempStickerPath);
}
// Thanks Kastow https://stackoverflow.com/a/76242802/22187538А
clipboard.writeBuffer(
'FileNameW',
Buffer.concat([Buffer.from(tempStickerPath, 'ucs-2'), Buffer.from([0, 0])])
);
console.log(`Wrote sticker to clipboard from path ${tempStickerPath}`);

if (closeWindowAfterSend) {
// windows
window.minimize();
// linux
window.hide();
// mac
if (process.platform === 'darwin') {
app.hide();
}
} else {
window.setAlwaysOnTop(true);
window.setFocusable(false);
Expand Down