mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 21:11:30 +08:00 
			
		
		
		
	Merge pull request #4267 from rauenzi/tray
Add hotkey option to toggle hide to tray
This commit is contained in:
		
						commit
						2e69cc8331
					
				| @ -6,6 +6,7 @@ import openService from "../services/open.js"; | |||||||
| import protectedSessionService from "../services/protected_session.js"; | import protectedSessionService from "../services/protected_session.js"; | ||||||
| import options from "../services/options.js"; | import options from "../services/options.js"; | ||||||
| import froca from "../services/froca.js"; | import froca from "../services/froca.js"; | ||||||
|  | import utils from "../services/utils.js"; | ||||||
| 
 | 
 | ||||||
| export default class RootCommandExecutor extends Component { | export default class RootCommandExecutor extends Component { | ||||||
|     editReadOnlyNoteCommand() { |     editReadOnlyNoteCommand() { | ||||||
| @ -155,6 +156,15 @@ export default class RootCommandExecutor extends Component { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     toggleTrayCommand() { | ||||||
|  |         if (!utils.isElectron()) return; | ||||||
|  |         const {BrowserWindow} = utils.dynamicRequire('@electron/remote'); | ||||||
|  |         const windows = BrowserWindow.getAllWindows(); | ||||||
|  |         const isVisible = windows.every(w => w.isVisible()); | ||||||
|  |         const action = isVisible ? "hide" : "show" | ||||||
|  |         for (const window of windows) window[action](); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     firstTabCommand()   { this.#goToTab(1); } |     firstTabCommand()   { this.#goToTab(1); } | ||||||
|     secondTabCommand()  { this.#goToTab(2); } |     secondTabCommand()  { this.#goToTab(2); } | ||||||
|     thirdTabCommand()   { this.#goToTab(3); } |     thirdTabCommand()   { this.#goToTab(3); } | ||||||
|  | |||||||
| @ -240,6 +240,12 @@ const DEFAULT_KEYBOARD_ACTIONS = [ | |||||||
|         description: "Open new empty window", |         description: "Open new empty window", | ||||||
|         scope: "window" |         scope: "window" | ||||||
|     }, |     }, | ||||||
|  |     { | ||||||
|  |         actionName: "toggleTray", | ||||||
|  |         defaultShortcuts: [], | ||||||
|  |         description: "Shows/hides the application from the system tray", | ||||||
|  |         scope: "window" | ||||||
|  |     }, | ||||||
|     { |     { | ||||||
|         actionName: "firstTab", |         actionName: "firstTab", | ||||||
|         defaultShortcuts: ["CommandOrControl+1"], |         defaultShortcuts: ["CommandOrControl+1"], | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam