obsidian-calendar-plugin
obsidian-calendar-plugin copied to clipboard
Opening in stacked tab
Hi - I just upgraded to Obsidian 1.0. Now, when I CMD-click a date in my calendar, it doesn't properly open in in a new tab. It instead opens in a new frame, so I cannot get it into the stacked tab view without first manually moving it over. Please help.
Same here. Expected behaviour for CMD+click would be to open in new tab in the same pane. Instead CMD+click opens the new tab in a new pane. It would be great if the opening behaviour of the plugin sticks with the Obsidian default pattern for handling opening in tabs, panes, windows. Thanks for a great plugin and for looking into this.
I think the solution should follow how opening files works:
- Left click = open/create file in current window.
- CTRL/CMD + left click = open/create file as new tab in active/root leaf.
- CTRL/CMD + ALT/SHIFT + left click = open/create file as new tab in new split leaf.
@kithairon @nbarman2022 I was able to get a work around for this by modifying the .obsidian/plugins/calendar/main.js file. This is tested in V1.5.10 of the Calendar plug-in. These changes will need to be repeated whenever the plug-in is updated.
At these locations in the main.js file:
- function tryToCreateDailyNote line 1052
- function trytoCreateWeekly line 1081
- function openOrCreateWeeklyNote line 4367
- function openOrCreateDailyNote line 4386
Replace this code:
const leaf = inNewSplit
? workspace.splitActiveLeaf()
: workspace.getUnpinnedLeaf();
With this code:
const leaf = inNewSplit
? workspace.getLeaf(true)
: workspace.getUnpinnedLeaf();
workspace.setActiveLeaf(leaf, false);
I am hoping to get around to a pull request closely mirroring the 'File Tree Alternative' plug-in.
@thunt-career Thanks for investigating and the work around. Have made the suggested changes and all works beautifully. Happy to live with re-patching after updates.
@thunt-career Thank you for the workaround, it works great. Hope the developers of this plugin choose to adjust the UX toward this too.
I would also love if the middle mouse button could open a calendar page in a new tab, same as it does for pages in the left “Files” pane.
@kithairon @nbarman2022 I was able to get a work around for this by modifying the .obsidian/plugins/calendar/main.js file. ... I am hoping to get around to a pull request closely mirroring the 'File Tree Alternative' plug-in.
Thanks! I tested it and it had the intended effect, that cmd-click opens a new note in the stacked tab group instead of in a completely new stacked group. I also tested with unstacked and it opens a note in a new frame.
Would be good to have a pull request.
@kithairon @nbarman2022 I was able to get a work around for this by modifying the .obsidian/plugins/calendar/main.js file. This is tested in V1.5.10 of the Calendar plug-in. These changes will need to be repeated whenever the plug-in is updated.
At these locations in the main.js file:
- function tryToCreateDailyNote line 1052
- function trytoCreateWeekly line 1081
- function openOrCreateWeeklyNote line 4367
- function openOrCreateDailyNote line 4386
Replace this code:
const leaf = inNewSplit ? workspace.splitActiveLeaf() : workspace.getUnpinnedLeaf();
With this code:
const leaf = inNewSplit ? workspace.getLeaf(true) : workspace.getUnpinnedLeaf(); workspace.setActiveLeaf(leaf, false);
I am hoping to get around to a pull request closely mirroring the 'File Tree Alternative' plug-in.
Works! Would be great if there would be a setting "Open in" with "Tab" or "Split" as @liamcain created this on purpose, see "Open daily notes in a new split" in README.