Create a Dynamic Workspace That Opens Files Depending on The Current Date

What I’m trying to do

I’m trying to have a workspace that doesn’t statically open the same files. Instead depending on what day it is I want it to open the corresponding Periodic Daily Note, Periodic Weekly Note, Periodic Monthly Note, Periodic Quarterly Note, and Periodic Yearly Note.

Ideally it would do both the day before and current day, the week before and current week, the month before and current month, the quarter before and the current quarter, and the year before and the current year.

My Periodic Notes Have the following format:
YYYY-MM-DD
YYYY-[W]ww
YYYY-[M]MM
YYYY-[Q]Q
YYYY

Things I have tried

I thought I may be able to use templater/templater syntax in the workspaces.json but it doesn’t work:

             {
                "id": "99fa967f71d2e777",
                "type": "leaf",
                "state": {
                  "type": "markdown",
                  "state": {
                    "file": "Admin/Periodic Notes/Weekly Notes/<% tp.date.now(\"YYYY-[W]WW\") %>.md",
                    "mode": "source",
                    "source": true,
                    "backlinks": false
                  },
                  "icon": "lucide-file",
                  "title": "<% tp.date.now(\"YYYY-[W]WW\") %>"
                }
              },

I’ve set up QuickAdd macros that are able to open the corresponding daily note if it exists and if not create it with the current date, same with the Weekly Note with the current week, etc… But I don’t want to have to do them each manually. I want the workspace to all of these at once and arrange the windows in a predefined format.

Question

Does anyone know a method/plugin that enables workspaces that dynamically open files depending on the current date?

This question comes up occasionally. I don’t remember if there’s a solution for it yet, but searching the forum and the community plugins may turn something up.

1 Like

Some ideas, because I think I have done something similar…but not precisely like you.
First off define a workspace in the workspace manager.
Then it would help if one of these files is static, meaning it always stays open. That one could contain code to load the other windows. I have a snippet of dataviewjs code I clobbered together with AI (that gets it 9 out of 10 wrong, but still provides helpful tidbits). This snippet runs at an interval, but only if the date changed, so the code would not tie up the CPU. And if the date changes, then the function would load up files in each target portion of your workspace based on a template. And if the date changed, it would load up new files in each window.

That is at least the approach I would take. It is an interesting problem; I have not tried yet to explicitly target areas of the workspace and load files though…I would start by investigating if the api for obsidian supports this…I bet it does…the question always is how hard it will be to do. I would also use CustomJs plugin, so you can write custom functions and then call them from that static page…