mirror of
				https://github.com/zulip/zulip-desktop.git
				synced 2025-10-31 20:13:43 +00:00 
			
		
		
		
	Compare commits
	
		
			2 Commits
		
	
	
		
			v5.4.1-bet
			...
			dock-bounc
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 3091bd5be8 | ||
|  | 5d113c611f | 
| @@ -75,11 +75,16 @@ class WebView extends BaseComponent { | ||||
|  | ||||
| 		this.$el.addEventListener('page-favicon-updated', event => { | ||||
| 			const { favicons } = event; | ||||
|  | ||||
| 			// This returns a string of favicons URL. If there is a PM counts in unread messages then the URL would be like | ||||
| 			// https://chat.zulip.org/static/images/favicon/favicon-pms.png | ||||
| 			if (favicons[0].indexOf('favicon-pms') > 0 && process.platform === 'darwin') { | ||||
| 				// This api is only supported on macOS | ||||
| 				app.dock.setBadge('●'); | ||||
| 				// bounce the dock | ||||
| 				if (ConfigUtil.getConfigItem('dockBouncing')) { | ||||
| 					app.dock.bounce(); | ||||
| 				} | ||||
| 			} | ||||
| 		}); | ||||
|  | ||||
|   | ||||
| @@ -127,6 +127,11 @@ class ServerManagerView { | ||||
| 			settingOptions.dndPreviousSettings.flashTaskbarOnMessage = true; | ||||
| 		} | ||||
|  | ||||
| 		if (process.platform === 'darwin') { | ||||
| 			// Only available on macOS | ||||
| 			settingOptions.dockBouncing = true; | ||||
| 		} | ||||
|  | ||||
| 		for (const i in settingOptions) { | ||||
| 			if (ConfigUtil.getConfigItem(i) === null) { | ||||
| 				ConfigUtil.setConfigItem(i, settingOptions[i]); | ||||
|   | ||||
| @@ -31,6 +31,10 @@ class GeneralSection extends BaseSection { | ||||
| 						<div class="setting-description">Show app unread badge</div> | ||||
| 						<div class="setting-control"></div> | ||||
| 					</div> | ||||
| 					<div class="setting-row" id="dock-bounce-option" style= "display:${process.platform === 'darwin' ? '' : 'none'}"> | ||||
| 						<div class="setting-description">Bounce dock on new private message</div> | ||||
| 						<div class="setting-control"></div> | ||||
| 					</div> | ||||
| 					<div class="setting-row" id="flash-taskbar-option" style= "display:${process.platform === 'win32' ? '' : 'none'}"> | ||||
| 						<div class="setting-description">Flash taskbar on new message</div> | ||||
| 						<div class="setting-control"></div> | ||||
| @@ -121,10 +125,15 @@ class GeneralSection extends BaseSection { | ||||
| 		this.removeCustomCSS(); | ||||
|  | ||||
| 		// Platform specific settings | ||||
|  | ||||
| 		// Flashing taskbar on Windows | ||||
| 		if (process.platform === 'win32') { | ||||
| 			this.updateFlashTaskbar(); | ||||
| 		} | ||||
| 		// Dock bounce on macOS | ||||
| 		if (process.platform === 'darwin') { | ||||
| 			this.updateDockBouncing(); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	updateTrayOption() { | ||||
| @@ -153,6 +162,18 @@ class GeneralSection extends BaseSection { | ||||
| 		}); | ||||
| 	} | ||||
|  | ||||
| 	updateDockBouncing() { | ||||
| 		this.generateSettingOption({ | ||||
| 			$element: document.querySelector('#dock-bounce-option .setting-control'), | ||||
| 			value: ConfigUtil.getConfigItem('dockBouncing', true), | ||||
| 			clickHandler: () => { | ||||
| 				const newValue = !ConfigUtil.getConfigItem('dockBouncing'); | ||||
| 				ConfigUtil.setConfigItem('dockBouncing', newValue); | ||||
| 				this.updateDockBouncing(); | ||||
| 			} | ||||
| 		}); | ||||
| 	} | ||||
|  | ||||
| 	updateFlashTaskbar() { | ||||
| 		this.generateSettingOption({ | ||||
| 			$element: document.querySelector('#flash-taskbar-option .setting-control'), | ||||
|   | ||||
		Reference in New Issue
	
	Block a user