feat(wm): promote containers by swapping indices

This commit adds a new SocketMessage variant PromoteSwap and
corresponding komorebic promote-swap command.

PromoteSwap will also promote the focused window container to the
largest tile in the layout, but instead of removing the focused
container x from the Ring and inserting it into position 0, possibly
changing the positions of other windows between 0 and x, the indices x
and 0 in the Ring will be swapped directly.
This commit is contained in:
LGUG2Z
2025-11-04 08:02:05 -08:00
parent d0ae92ca3a
commit 416dd94670
7 changed files with 47 additions and 2 deletions
+6 -1
View File
@@ -1267,8 +1267,10 @@ enum SubCommand {
/// Flip the layout on the focused workspace
#[clap(arg_required_else_help = true)]
FlipLayout(FlipLayout),
/// Promote the focused window to the top of the tree
/// Promote the focused window to the largest tile via container removal and re-insertion
Promote,
/// Promote the focused window to the largest tile by swapping container indices with the largest tile
PromoteSwap,
/// Promote the user focus to the top of the tree
PromoteFocus,
/// Promote the window in the specified direction
@@ -2029,6 +2031,9 @@ fn main() -> eyre::Result<()> {
SubCommand::Promote => {
send_message(&SocketMessage::Promote)?;
}
SubCommand::PromoteSwap => {
send_message(&SocketMessage::PromoteSwap)?;
}
SubCommand::PromoteFocus => {
send_message(&SocketMessage::PromoteFocus)?;
}