Workspaces are not closing open databases

If I save a workspace that contains one open database (named: oneOpen) then, in the process of my work, when I have other databases that are open, I go to oneOpen workspace it does not close the open databases.

Is this a bug or desired behavior?

Workspaces allow you to save the state of your open databases, as well as the contents and positions of all open windows

This is currently intentional, workspaces open required databases if necessary but don’t close any.

thanks

Would it be possible to add an option in DT to close the databases that are not part of a workspace when switching workspaces ? Or adding this option at the workspace level when creating a new workspace ?

My understanding of worspaces was that it was a way to group databased by concerns/topics.

For example, I have two workspaces (just for the sake of the example):

  • one called “admin” that holds admin related databases: “Archived emails”, “Admin - Personal” and “Admin - Work”
  • another workspace named “Medicine” that holds databases such as “Chinese medicine”, “western medicine”…

I often switch from one to another. But as DT does not close the databases upon workspace change, after one workspace switch, the relation between databases is lost (the ones only worth in the context of admin or the ones in the context of medicine) and unless you remember exactly which databases are part of a workspace there is no way to know. In my example it seems trivial, but when you have several databases, the workspace feature loses its interest if you have to close every unrelated database when switching to another workspace.

1 Like

I’d second this suggestion, at least as an option to close irrelevant databases on switching workspaces.

As it is, you can switch from one workspace to a different one, subsequently update it, and find you’ve included an unwanted database or databases in your workspace update.

We’ll consider this for future releases.

2 Likes

Thank you :+1:

Another voice in favour please.

I arrived at this thread thinking the non closure of databases was a bug :slight_smile:

You could use File > Close Database > Close All before opening the workspace.

1 Like

I also got to this discussion because I thought Workspaces not closing DBs was a bug.
Yes, I could use File > Close Database > Close All before opening the workspace but that is more work for my poor, old, tired, fingers …

The real issue arising from the current behavior of not closing DBs for me is from that of search. Could there be a keyboard shortcut to close all DBs except for the selected one.

So another voice in favor of having workspaces remember the specific DBs that should and should not be open.

Could there be a keyboard shortcut to close all DBs except for the selected one.

There is already an available command but a shortcut can’t be mapped to it since the name is dynamic.

This script closes all databases except the current one.

You can assign a shortcut by adding e.g. ___SHIFT + OPT + CMD + W to the filename.

-- Close all databases except the current one

tell application id "DNtp"
	try
		set theDatabases to databases
		set theCurrentDatabase to current database
		
		repeat with i from 1 to (count theDatabases)
			set thisDatabase to item i of theDatabases
			if thisDatabase ≠ theCurrentDatabase then
				close thisDatabase
			end if
		end repeat
		
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
		return
	end try
end tell
2 Likes

Thank you kind Sir.
It works like a champ.

1 Like

Realise this is an old thread, but, I have a personal use-case that this MIGHT benefit from.

I have several databases, some are current for contents, some represent more of a historical or archive context.

What I would like to do is have DT in a given Workspace only see the databases open in that Workspace, which would make searching and matching data a faster operation.

In other words, I would like to have a DT window dedicated to a set of databases; the “Archives” Workspace could be Databases that are older/historical, but the “Current” Workspace could be a different set of Databases.

I realise that I can accomplish some of what I’m after by carefully using the “scope” search directive, but, it’s not just about limiting searches, there are layout preferences I’d appreciate as well, which is why the Workspace concept seems a good fit.

No doubt there are other ways to do what I want, but, an ability to have a specific Workspace ONLY show certain Databases, AND to have multiple Workspaces open at the same time, would be quite clever.

That’s not how workspaces work.
And there’s already a script that addresses closing open databases to load only those for a given workspace: Script menu > More Scripts > Open Clean Workspace.