pjeby / pane-relief

Obsidian plugin for per-pane history, pane movement/navigation hotkeys, and more
223 stars 6 forks source link

Location-based Pane Swap Hotkeys [Feature Request] #15

Open Craftidore opened 2 years ago

Craftidore commented 2 years ago

Currently Pane Relief only has pane-swapping functionality for panes that are on either side of a split, with

2022-06-26-050615_1066x116_scrot

Unfortunately this doesn't allow for up-and-down swapping of panes. It'd be very convenient to have hotkey options for all directions, similar to the build-in 'focus on pane' commands.

2022-06-26-050704_1073x203_scrot

I will try and code this in myself, then make a pull request, but I've never worked on an Obsidian plugin before and it might be beyond my meager capabilities, so I'm also putting this feature request here.

pjeby commented 2 years ago

If the split is a pure vertical split, the pane is moved up or down within that split. What it doesn't do is movement between splits.

Basically, a split is a collection of panes arranged vertically or horizontally. If you split the screen into top and bottom, that is a vertical split. If you keep splitting things in a vertically stacked way, then that is a split that things can move up or down in.

However, if you split into top and bottom, then split the top and bottom into a series of horizontal panes, then you have two horizontal splits instead of one vertical split. So the panes in them can only move horizontally. If you split horizontally first, however, and then divide each pane into top and bottom, then you can swap the top and bottom within that section.

Hope that makes more sense as to what's going on: for any given pane, the pane relief commands can move it either vertically or horizontally depending on how the splits were performed, But moving between splits requires drag and drop. I chose not to try to implement between-split moving because it creates a lot of challenges and design questions that I have no idea how to answer. But if somebody can come up with a workable implementation that does something with easy-to-understand behavioral results, then great!

One challenge they'll run into, though, is that you will have to figure out where to insert the item if it's in a different split, since each split can have different sized items. There's also the question of how to size the pane on arrival, and how the size of the other panes should be affected. These things are not issues within the same split, as the number of panes and their sizes are unchanged.

That's probably not the only problem that would need to be solved in order to do this, it's just the first one that comes to mind when I try to recall why I didn't do it. :wink:

trainbuffer commented 1 year ago

The OP and your reply are from a while ago. I assume the situation hasn't changed with Obsidian v.1 and tab groups (panes)?

I was going to create a new Feature Request, but then saw this:

But moving between splits requires drag and drop. I chose not to try to implement between-split moving because it creates a lot of challenges and design questions that I have no idea how to answer.

I wrote it up so will put it here for now. 😉

FR: Move current tab to another tab group and focus it

I'd like move the current tab I'm working in to a different tab group and focus on it. I can't seem to do that with Obsidian's built in commands or PaneRelief. Let me know if I'm missing something basic or a work-around.

If this were possible, I assume the issue then becomes "which tab group?" if you have more than two open. "Move tab to right tab group" or "Move tab to left tab group" seems fine? If the tab moves to a tab group to the right and focuses, you could do another "move to the right" to move it again to a third tab group. That seems reasonable.

Yet, what if your groups are vertical? What if there are fourteen of them? I understand that with Obsidian's flexibility in workspaces that there will be lots of variation (beyond two or three open tab groups).

PaneRelief takes care of most things I want to do using keyboard navigation, but an addition of something like this would be useful. If not, no worries. Still a wonderful plugin, bravo!

pjeby commented 1 year ago

The current plan is to simply make the tab swap commands move tabs between groups, provided that there is more than one tab in the origin group; otherwise swapping the entire group. But it's subject to change once I actually get around to implementation, which won't be until I'm actually targeting the 1.0 API as the minimum version supported by Pane Relief. (I still use 0.15.9, and will be continuing to do so until I have a satisfactory set of CSS mods to address the many visual issues I have with using 1.0.)

trainbuffer commented 1 year ago

Appreciate your candor.

Looking forward to more relief from tabs and tab group management. Please take your time.

prurph commented 11 months ago

Following this issue; I think it would be great to have commands to move tabs between tab groups.

prurph commented 11 months ago

I wrote a very rough poc plugin to do this: prurph/obsidian-move-tabs (not available on community plugins, install manually at your own risk, etc, etc). The commands will move the current tab to the pane to the left/right/top/bottom. If there isn't a pane in that direction, nothing happens.

I had to resort to using executeCommandById which isn't included in the official API, but without it navigating the workspace tree to determine its spatial layout is extremely onerous. This means the plugin will obviously break if they remove that functionality.