make promoteActiveFloating -> toggleActiveFloating (works in reverse)

This commit is contained in:
2026-06-05 11:57:41 +02:00
parent 217e865448
commit c762e53bf4
3 changed files with 13 additions and 13 deletions

View File

@@ -180,11 +180,11 @@ public final class Compositor {
layoutVersion++; layoutVersion++;
} }
public void promoteActiveFloating() { public void toggleActiveFloating() {
if (isEmpty()) { if (isEmpty()) {
return; return;
} }
currentTab().promoteActiveFloating(); currentTab().toggleActiveFloating();
layoutVersion++; layoutVersion++;
} }

View File

@@ -244,19 +244,19 @@ final class Tab implements AutoCloseable {
} }
/** Promotes the active floating pane to a tiled pane, joining the tiled row. No-op otherwise. */ /** Promotes the active floating pane to a tiled pane, joining the tiled row. No-op otherwise. */
void promoteActiveFloating() { void toggleActiveFloating() {
TerminalPane promote = active; TerminalPane toggled = active;
if (!floating.remove(promote)) { if (floating.remove(toggled)) {
return; // active pane is tiled (or there is none); nothing to promote
}
if (promote == lastFocusedFloating) {
lastFocusedFloating = floating.isEmpty() ? null : floating.get(floating.size() - 1); lastFocusedFloating = floating.isEmpty() ? null : floating.get(floating.size() - 1);
} tiled.add(toggled);
tiled.add(promote);
if (floating.isEmpty()) {
floatingVisible = false; floatingVisible = false;
setActive(toggled);
} else if (tiled.remove(toggled)) {
lastFocusedTiled = tiled.isEmpty() ? null : tiled.get(tiled.size() -1);
floating.add(toggled);
floatingVisible = true;
setActive(toggled);
} }
setActive(promote);
} }
void closeActivePane() { void closeActivePane() {

View File

@@ -129,7 +129,7 @@ final class TerminalWindow {
compositor.nextFloatingPane(); compositor.nextFloatingPane();
event.consume(); event.consume();
} else if (config.keybindings().get("promote_floating").matches(event)) { } else if (config.keybindings().get("promote_floating").matches(event)) {
compositor.promoteActiveFloating(); compositor.toggleActiveFloating();
event.consume(); event.consume();
} else if (config.keybindings().get("close_pane").matches(event)) { } else if (config.keybindings().get("close_pane").matches(event)) {
// Closing the last pane closes this window, via the compositor's onEmpty hook. // Closing the last pane closes this window, via the compositor's onEmpty hook.