Skip to content

Commit

Permalink
adding auto show qr code on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
willwade committed Oct 29, 2024
1 parent 48002fd commit f35bac7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions nodejs/sender-monitor/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,13 @@ app.on("ready", () => {
tray.setToolTip(`Session ID: ${sessionId}`);

QRCode.toDataURL(displayAppURL, (err, url) => {
if (err) console.error("Failed to generate QR code:", err);
else {
if (err) {
console.error("Failed to generate QR code:", err);
} else {
// Show the QR code window at startup
createQRWindow(url);

// Set up tray context menu with the QR option and other options
const contextMenu = Menu.buildFromTemplate([
{ label: "Show QR Code", click: () => createQRWindow(url) },
{
Expand All @@ -120,6 +125,7 @@ app.on("ready", () => {
}
});

// WebRTC connection events
webrtc.on("connected", () => {
isConnected = true;
updateTrayIcon();
Expand All @@ -132,6 +138,7 @@ app.on("ready", () => {
logMessage("Disconnected from WebRTC peer");
});

// Clipboard monitoring
setInterval(() => {
const currentText = clipboard.readText();
if (currentText && currentText !== lastText) {
Expand Down

0 comments on commit f35bac7

Please sign in to comment.