scambier / obsidian-no-dupe-leaves

Automatically switch the focus to open notes instead of reopening them
GNU Affero General Public License v3.0
60 stars 6 forks source link

Would like "Open in new Tab" method of opening to keep current window open and conditionally open new or re-use tab to display target note #4

Closed dokmanc closed 1 year ago

dokmanc commented 1 year ago

I have a main note page that lists other notes. When I click on a link on the main page, I would like it open the target note in a new tab unless it is already open, otherwise set focus to the target tab that is already open. However, in all cases, I would like the main page to remain open.

I am unable to get this behavior either simply by left clicking on the target note link within the main note or right-mouse clicking on the target note in the main page and clicking "open in new tab." I essentially have to know whether the note is already open in order to perform the action that will give me the desired result. if I know that the target note is already open, I can left mouse click on the note link and "no-dup-leaves" will leave the main note up and set the focus to the already open target note. However, if the note is not already open, left-clicking on the note will result in the current tab which contains my main note being replaced by the target note.

i also don't want to right mouse click on a note and select "open to the right". Doing so causes two problems. First of all, it divides the display area for the notes in two leaving me insufficient room for either note to be displayed. Next, "no-dup-leaves" does not enforce that only one window is open, which you may want to consider.

I appreciate you plug in and hope that i can find ways to better make it fit into how I like to work. Thank you for your efforts and consideration.

scambier commented 1 year ago

Can't you pin your main page? This way, it will never get replaced, and a simple click on a link will trigger no-dupe-leaves behavior.

Next, "no-dup-leaves" does not enforce that only one window is open, which you may want to consider.

This plugin's goal is to avoid "unintended" duplicates when doing simple clicks on links. A ctrl+click is an explicit "open in a new tab", so no-dupe-leaves won't hijack it.

dokmanc commented 1 year ago

Thank you for the reply. I guess that simple suggestion is probably the solution but it just seems less intuitive to my expectations on how I would expect it to work and more importantly, requires a lot of pinning. I guess my hang up is that I can't imagine every wanting to open up a second tab for the same note that is already open unless i wanted to compare them side by side, in which case, I would use the open to "Open to the Right". I suppose a person could possibly want to open 2 tabs for the same note not side-by-side if one were in edit mode and the other in view mode...

The bottom line is that your suggestion to pin is probably the way to go.....I think....

Thank you!

scambier commented 1 year ago

I understand. If it were up to me I'd revamp the whole navigation, but there is 0 api for it, and no-dupe-leaves is already a hack šŸ¤·ā€ā™‚ļø

dokmanc commented 1 year ago

So I pinned the main page, the only page open, and clicked on the first link. It opened up on a new tab, child1. I now have two tabs open.

If I click on a second link, child2, in the main page, it will overwrite the contents on the child1 tab with child2. So, I decide that the thing to do is to pin child1 also to keep this from happening. So, I pin child2 having come to the conclusion that need to pin every child tab after opening it if I want to continue to prevent the tab from being reused when I do a subsequent click on the main page.

The whole idea of no-dupe-leaves as i see it is to reuse a tab if it is already open so I dont end up with a dupe tab unless it is really intended. I would indicate that it is intended only by right mouse-clicking on a tab and select "open in a new tab", otherwise, a new tab shouldn't be opened is my thought.

However, now if i go back to the main page and click on the child2 link again, because I pinned the child2 tab, a new tab is opened even though I did a simple left click and not an "open in a new tab" right mouse click option.

if I were to put aside the coding challenges that I am ignorant of and just tried to image how I would like it to work in a perfect world, I would want this:

If I right mouse click on a link and select "open in a new tab", no-dupe-leaves would open up the note in a new tab unless it were already open. If it were open, it would set focus to the requested note that was already open. It looks like no-dup-leaves effects the left-mouse outcome rather than the right mouse one. I think it would work better if the plug in impacted the right mouse "open in new tab" option. Your plug in would essentially change the behavior to "open in a new tab (unless it's already open, then reuse the tab).

It sounds like the coding effort is substantial due to their be a good interface and documentation resulting in a hack, so I understand reluctance to re-think this and consider a code change. as the plug in stands, it probably doesn't help me - at least in how my brain works at the moment. I just wanted to throw my last 2 cents in.

Thank you for your consideration!

scambier commented 1 year ago

However, now if i go back to the main page and click on the child2 link again, because I pinned the child2 tab, a new tab is opened

It shouldn't šŸ¤” I just tried it, I have a link from A to B, both notes are open and pinned. When I click on the "B" link in A, it doesn't reopen another B and just switches to it. Don't know why it doesn't work for you šŸ¤·ā€ā™‚ļø

You can also add your vote and voice to the feature request in the official forum