obsidian-calendar-plugin icon indicating copy to clipboard operation
obsidian-calendar-plugin copied to clipboard

Opening in stacked tab

Open nbarman2022 opened this issue 2 years ago • 8 comments

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.

nbarman2022 avatar Oct 16 '22 01:10 nbarman2022

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.

kithairon avatar Oct 24 '22 08:10 kithairon

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.

thunt-career avatar Dec 06 '22 19:12 thunt-career

@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 avatar Dec 13 '22 23:12 thunt-career

@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.

kithairon avatar Dec 14 '22 11:12 kithairon

@thunt-career Thank you for the workaround, it works great. Hope the developers of this plugin choose to adjust the UX toward this too.

lcb931023 avatar Feb 09 '23 08:02 lcb931023

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.

pyxelr avatar Feb 12 '23 11:02 pyxelr

@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.

abeham avatar Feb 24 '23 13:02 abeham

@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.

mackaaij avatar Mar 07 '24 19:03 mackaaij