mirror of
				https://github.com/zulip/zulip-desktop.git
				synced 2025-11-04 05:53:21 +00:00 
			
		
		
		
	notification: Set the AppUserModelId from the main process.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
		@@ -142,6 +142,9 @@ function createMainWindow(): Electron.BrowserWindow {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Used for notifications on Windows
 | 
				
			||||||
 | 
					  app.setAppUserModelId("org.zulip.zulip-electron");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  app.on("second-instance", () => {
 | 
					  app.on("second-instance", () => {
 | 
				
			||||||
    if (mainWindow) {
 | 
					    if (mainWindow) {
 | 
				
			||||||
      if (mainWindow.isMinimized()) {
 | 
					      if (mainWindow.isMinimized()) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,5 @@
 | 
				
			|||||||
import {ipcRenderer} from "../typed-ipc-renderer";
 | 
					import {ipcRenderer} from "../typed-ipc-renderer";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Do not change this
 | 
					 | 
				
			||||||
export const appId = "org.zulip.zulip-electron";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// This function will focus the server that sent
 | 
					// This function will focus the server that sent
 | 
				
			||||||
// the notification. Main function implemented in main.js
 | 
					// the notification. Main function implemented in main.js
 | 
				
			||||||
export function focusCurrentServer(): void {
 | 
					export function focusCurrentServer(): void {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,13 +1,4 @@
 | 
				
			|||||||
import {remote} from "electron";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import DefaultNotification from "./default-notification";
 | 
					import DefaultNotification from "./default-notification";
 | 
				
			||||||
import {appId} from "./helpers";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const {app} = remote;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// From https://github.com/felixrieseberg/electron-windows-notifications#appusermodelid
 | 
					 | 
				
			||||||
// On windows 8 we have to explicitly set the appUserModelId otherwise notification won't work.
 | 
					 | 
				
			||||||
app.setAppUserModelId(appId);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface NotificationData {
 | 
					export interface NotificationData {
 | 
				
			||||||
  close: () => void;
 | 
					  close: () => void;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user