Closed cromo closed 3 months ago
Shouldn't this else case be sufficient, so you don't need to pass a mode? So you can just any filepath. I don't think, adding an open call if you pass no filepath to be opened, is a good idea.
I finally got around to testing it, and yes, I can omit the mode
and it still do what I want. However, I still need to pass a filepath
to get to that branch in the code.
I don't really know how the code is structured underneath, but the reason I want to be able to open a new window without specifying a file is because the command I'm running creates a new file - and thus I don't need to open a file to run the command but I do want a new window to run the command in. It would be a little nicer in this case to not have to open an intermediate file. What about allowing creating a new window with the default Obsidian "New tab" instead? That would make use cases like this cleaner.
For completeness, my current URL is:
obsidian://advanced-uri/?vault=notes&commandid=zk-prefixer&filepath=dummy-file&openmode=window
Is now available in v1.43.0 :tada:
Thank you for taking the time to understand my use case and help me work through this until the feature landed! I just checked and it works exactly as I hoped. Now my URL is:
obsidian://advanced-uri/?vault=notes&commandid=zk-prefixer&openmode=window
Much simpler!
I would like to be able to specify an
openmode
and run a command afterward. My use case is to create a new window and then run the create unique note command so that I get a floating window that I can move over/around the thing I'm taking notes on without affecting my main Obsidian layout.I have a workaround for this right now because command URIs can specify
filepath
s. I had to look into the code to see what exactly had to be done to pass theopenmode
parameter to theopen
call -filepath
parameter pointing at the dummy file, and amode=overwrite
parameter (since we need to have amode
specified in order to reach the code path that callsthis.plugin.open
, also, this is why I kept the dummy file empty - it's just going to get emptied anyway)openmode
parameterMy final workaround looks something like this:
Or spread out for readability:
Not having to have a dummy file to open a new window would be strongly preferred, but this workaround does roughly what I need it to do.