main pane splitting

This commit is contained in:
Gregor Lohaus
2026-05-29 21:27:17 +02:00
parent 4c3449129c
commit ebba6cc44f
3 changed files with 23 additions and 4 deletions

View File

@@ -36,7 +36,7 @@ public record AppConfig(
"navigate_up",
"navigate_right",
"toggle_floating",
"new_floating",
"new_pane",
"next_floating",
"close_pane",
"open_font_selector",
@@ -92,7 +92,7 @@ public record AppConfig(
"navigate_up", KeyBinding.parse("ALT+K"),
"navigate_right", KeyBinding.parse("ALT+L"),
"toggle_floating", KeyBinding.parse("ALT+F"),
"new_floating", KeyBinding.parse("ALT+SHIFT+F"),
"new_pane", KeyBinding.parse("ALT+N"),
"next_floating", KeyBinding.parse("ALT+F12"),
"close_pane", KeyBinding.parse("ALT+X"),
"open_font_selector", KeyBinding.parse("ALT+T"),

View File

@@ -71,8 +71,8 @@ public final class Main extends Application {
} else if (config.keybindings().get("toggle_floating").matches(event)) {
workspace.toggleFloating();
event.consume();
} else if (config.keybindings().get("new_floating").matches(event)) {
workspace.createFloatingPane();
} else if (config.keybindings().get("new_pane").matches(event)) {
workspace.createPane();
event.consume();
} else if (config.keybindings().get("next_floating").matches(event)) {
workspace.nextFloatingPane();

View File

@@ -131,6 +131,25 @@ public final class TerminalWorkspace implements AutoCloseable {
version++;
}
/**
* "New pane": adds a floating pane while floating panes are shown, otherwise adds a
* tiled pane (the tiled row is redistributed equally by the layout).
*/
public void createPane() {
if (anyFloatingVisible()) {
createFloatingPane();
} else {
TerminalPane pane = openPane(false);
panes.add(pane);
activeIndex = panes.size() - 1;
version++;
}
}
private boolean anyFloatingVisible() {
return panes.stream().anyMatch(pane -> pane.floating() && pane.visible());
}
public void nextFloatingPane() {
TerminalPane next = nextFloatingAfter(activeIndex);
next.setVisible(true);