mirror of
https://github.com/bitwarden/browser
synced 2026-01-03 09:03:32 +00:00
[BEEEP] [PM-565] Implement clipboard logic in rust (#4516)
Implement the Desktop clipboard logic natively using rust. This uses the arboard crate for clipboard functionality. This change consists of 3 portions: * Rust component. * Updating renderer to call main using electron ipc. * Update main to listen to renderer ipc and forward calls to the native clipboard module.
This commit is contained in:
17
apps/desktop/src/platform/main/clipboard.main.ts
Normal file
17
apps/desktop/src/platform/main/clipboard.main.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { ipcMain } from "electron";
|
||||
|
||||
import { clipboards } from "@bitwarden/desktop-native";
|
||||
|
||||
import { ClipboardWriteMessage } from "../types/clipboard";
|
||||
|
||||
export class ClipboardMain {
|
||||
init() {
|
||||
ipcMain.handle("clipboard.read", async (_event: any, _message: any) => {
|
||||
return await clipboards.read();
|
||||
});
|
||||
|
||||
ipcMain.handle("clipboard.write", async (_event: any, message: ClipboardWriteMessage) => {
|
||||
return await clipboards.write(message.text, message.password ?? false);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user