Forcing a single instance of Obsidian

I would like to only, always run a single instance of Obsidian:

  • if it is not started, start it
  • if it is running, focus on it

Since launching Obsidian always starts a new instance, I am doing this through AutoHotkey where I search for the instance and act accordingly.

When reading the forum and Github, I noticed that there are discussions of people who would like to be able to run multiple instances of Obsidian - this implies that they cannot, and this strongly suggests that they are forced into the one instance which is already running → exactly what I would like.

My question: how is this in reality?

Case 1: by default Obsidian reuses an existing instance → I am special and would like to know how to set up the normal, default way

Case 2: by default Obsidian starts a new instance → I am in that default and

  • maybe there is a way to set a single instance?
  • if not I will open a feature request

EDIT: in case someone would be interested in the AHK code:

ensureObsidianIsOpen()
{
	obsidianWindowName := "ahk_exe Obsidian.exe"
	DetectHiddenText True
	if (WinExist(obsidianWindowName)) {
		WinActivate(obsidianWindowName)
	} else {
		Run "C:\Users\yop\AppData\Local\Obsidian\Obsidian.exe"
	}
	WinWaitActive(obsidianWindowName)
}
1 Like

Can you link to one of the discussions that is requesting multiple instances in Windows?

I see some talking about mobile. And maybe there were requests for multiple instances of the same vault? It doesn’t make sense that someone wouldn’t be able to in Windows unless they were experiencing a bug. Opening multiple vaults is a common and ordinary thing.

Just adding another suggested workaround to you to consider. Use the Obsidian URL scheme to launch your vault. If it’s open, it will pop up. If it isn’t, it will open.

I don’t know if AHK supports that in Windows, but it works very well in MacOS, and I map it to a hotkey in Hammerspoon. In Windows, if I enter the URL into a browser, it works at least.

Obsidian docs: Using obsidian URI - Obsidian Help

1 Like

Thank you - yes this is what I ended up doing when researching further. This also covers my other point about focusing on Obsidian.

1 Like