Compare commits

...

6 Commits
0.3.4 ... main

Author SHA1 Message Date
Tom
ac353bb5a6
Merge pull request #66 from achilleas-k/fix/accelerator-docs-url
fix: update documentation URL for Electron accelerator format
2025-10-19 20:06:06 +11:00
Achilleas Koutsou
5e7ee6ca73 fix: update documentation URL for Electron accelerator format
The current URL is outdated (404).  Accelerator documentation is now
in the keyboard shortcuts section of the tutorial.
2025-10-16 11:08:33 +02:00
Tom
f4e827253d
merge #51: expose windowing to other plugins
Expose Windowing APIs to Other Plugins
2025-03-15 22:06:39 +11:00
Blue Falcon
62fcf88fe6
feat: expose getCurrentWindow 2024-06-23 02:13:35 -07:00
Blue Falcon
09fe3c2d03
feat: expose windowing APIs to other plugins
exposes:
- getWindows()
- showWindows()
- hideWindows()
- toggleWindows()
2024-06-23 01:57:53 -07:00
cc0baa3226
fix: #29 #30 focus maximised windows on trigger after alt-tab 2023-09-04 21:26:01 +10:00
3 changed files with 28 additions and 19 deletions

View File

@ -8,16 +8,16 @@ toggle window visibility and create quick notes from anywhere in your operating
### Window management
| Option | Description | Default |
| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ |
| Launch on startup | Open Obsidian automatically whenever you log into your computer. | Disabled |
| Hide on launch | Minimises Obsidian automatically whenever the app is launched. If the "Run in background" option is enabled, windows will be hidden to the system tray/menubar instead of minimised to the taskbar/dock. | Disabled |
| Run in background | Hide the app and continue to run it in the background instead of quitting it when pressing the window close button or toggle focus hotkey. | Disabled |
| Hide taskbar icon | Hides the window's icon from from the dock/taskbar. This may not work on Linux-based OSes. | Disabled |
| Create tray icon | Add an icon to your system tray/menubar to bring hidden Obsidian windows back into focus on click or force a full quit/relaunch of the app through the right-click menu. | Enabled |
| Tray icon image | Set the image used by the tray/menubar icon. Recommended size: 16x16 | ![](obsidian.png) |
| Tray icon tooltip | Set a title to identify the tray/menubar icon by. The `{{vault}}` placeholder will be replaced by the vault name. | `{{vault}} \| Obsidian` |
| Toggle window focus hotkey | This hotkey is registered globally and will be detected even if Obsidian does not have keyboard focus. Format: [Electron accelerator](https://www.electronjs.org/docs/latest/api/accelerator) | <kbd>CmdOrCtrl+Shift+Tab</kbd> |
| Option | Description | Default |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ------------------------------ |
| Launch on startup | Open Obsidian automatically whenever you log into your computer. | Disabled |
| Hide on launch | Minimises Obsidian automatically whenever the app is launched. If the "Run in background" option is enabled, windows will be hidden to the system tray/menubar instead of minimised to the taskbar/dock. | Disabled |
| Run in background | Hide the app and continue to run it in the background instead of quitting it when pressing the window close button or toggle focus hotkey. | Disabled |
| Hide taskbar icon | Hides the window's icon from from the dock/taskbar. This may not work on Linux-based OSes. | Disabled |
| Create tray icon | Add an icon to your system tray/menubar to bring hidden Obsidian windows back into focus on click or force a full quit/relaunch of the app through the right-click menu. | Enabled |
| Tray icon image | Set the image used by the tray/menubar icon. Recommended size: 16x16 | ![](obsidian.png) |
| Tray icon tooltip | Set a title to identify the tray/menubar icon by. The `{{vault}}` placeholder will be replaced by the vault name. | `{{vault}} \| Obsidian` |
| Toggle window focus hotkey | This hotkey is registered globally and will be detected even if Obsidian does not have keyboard focus. Format: [Electron accelerator](https://www.electronjs.org/docs/latest/tutorial/keyboard-shortcuts#accelerators) | <kbd>CmdOrCtrl+Shift+Tab</kbd> |
The `Relaunch Obsidian` and `Close Vault` actions can be triggered from the tray/menubar context menu,
or with the in-app command palette (search for "Tray: Relaunch Obsidian" or "Tray: Close Vault").
@ -25,11 +25,11 @@ Hotkeys can be assigned to the commands via Obsidian's built-in hotkey manager.
### Quick notes
| Option | Description | Default |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- |
| Quick note location | New quick notes will be placed in this folder. | |
| Quick note date format | New quick notes will use a filename of this pattern. Format: [Moment.js format string](https://momentjs.com/docs/#/displaying/format/) | `YYYY-MM-DD` |
| Quick note hotkey | This hotkey is registered globally and will be detected even if Obsidian does not have keyboard focus. Format: [Electron accelerator](https://www.electronjs.org/docs/latest/api/accelerator) | <kbd>CmdOrCtrl+Shift+Q</kbd> |
| Option | Description | Default |
| ---------------------- | -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ---------------------------- |
| Quick note location | New quick notes will be placed in this folder. | |
| Quick note date format | New quick notes will use a filename of this pattern. Format: [Moment.js format string](https://momentjs.com/docs/#/displaying/format/) | `YYYY-MM-DD` |
| Quick note hotkey | This hotkey is registered globally and will be detected even if Obsidian does not have keyboard focus. Format: [Electron accelerator](https://www.electronjs.org/docs/latest/tutorial/keyboard-shortcuts#accelerators) | <kbd>CmdOrCtrl+Shift+Q</kbd> |
## Installation

15
main.js
View File

@ -1,5 +1,5 @@
/**
* obsidian-tray v0.3.4
* obsidian-tray v0.3.5
* (c) 2023 dragonwocky <thedragonring.bod@gmail.com> (https://dragonwocky.me/)
* (https://github.com/dragonwocky/obsidian-tray/) under the MIT license
*/
@ -24,7 +24,7 @@ const LOG_PREFIX = "obsidian-tray",
ACCELERATOR_FORMAT = `
This hotkey is registered globally and will be detected even if Obsidian does
not have keyboard focus. Format:
<a href="https://www.electronjs.org/docs/latest/api/accelerator" target="_blank" rel="noopener">
<a href="https://www.electronjs.org/docs/latest/tutorial/keyboard-shortcuts#accelerators" target="_blank" rel="noopener">
Electron accelerator</a>
`,
MOMENT_FORMAT = `
@ -76,7 +76,10 @@ const vaultWindows = new Set(),
showWindows = () => {
log(LOG_SHOWING_WINDOWS);
getWindows().forEach((win) => {
maximizedWindows.has(win) ? win.maximize() : win.show();
if (maximizedWindows.has(win)) {
win.maximize();
win.focus();
} else win.show();
});
},
hideWindows = () => {
@ -475,6 +478,12 @@ class TrayPlugin extends obsidian.Plugin {
cleanup();
}
getCurrentWindow = getCurrentWindow
getWindows = getWindows;
showWindows = showWindows;
hideWindows = hideWindows;
toggleWindows = toggleWindows;
async loadSettings() {
const DEFAULT_SETTINGS = OPTIONS.map((opt) => ({ [opt.key]: opt.default }));
this.settings = Object.assign(...DEFAULT_SETTINGS, await this.loadData());

View File

@ -4,7 +4,7 @@
"author": "dragonwocky",
"authorUrl": "https://dragonwocky.me/",
"description": "Run Obsidian from the system tray for customisable window management & global quick notes",
"version": "0.3.4",
"version": "0.3.5",
"isDesktopOnly": true,
"minAppVersion": "1.0.0"
}