mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-07-10 23:22:43 +02:00
feat(cli): add promote-window cmd
This commit adds the promote-window command, which allows the user to promote the window in the specified OperationDirection from the currently focused window to the largest tile on the workspace layout.
This commit is contained in:
@@ -67,6 +67,7 @@ pub enum SocketMessage {
|
|||||||
Minimize,
|
Minimize,
|
||||||
Promote,
|
Promote,
|
||||||
PromoteFocus,
|
PromoteFocus,
|
||||||
|
PromoteWindow(OperationDirection),
|
||||||
ToggleFloat,
|
ToggleFloat,
|
||||||
ToggleMonocle,
|
ToggleMonocle,
|
||||||
ToggleMaximize,
|
ToggleMaximize,
|
||||||
|
|||||||
@@ -185,6 +185,10 @@ impl WindowManager {
|
|||||||
match message {
|
match message {
|
||||||
SocketMessage::Promote => self.promote_container_to_front()?,
|
SocketMessage::Promote => self.promote_container_to_front()?,
|
||||||
SocketMessage::PromoteFocus => self.promote_focus_to_front()?,
|
SocketMessage::PromoteFocus => self.promote_focus_to_front()?,
|
||||||
|
SocketMessage::PromoteWindow(direction) => {
|
||||||
|
self.focus_container_in_direction(direction)?;
|
||||||
|
self.promote_container_to_front()?
|
||||||
|
}
|
||||||
SocketMessage::FocusWindow(direction) => {
|
SocketMessage::FocusWindow(direction) => {
|
||||||
self.focus_container_in_direction(direction)?;
|
self.focus_container_in_direction(direction)?;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -227,6 +227,11 @@ impl Window {
|
|||||||
// If the target window is already focused, do nothing.
|
// If the target window is already focused, do nothing.
|
||||||
if let Ok(ihwnd) = WindowsApi::foreground_window() {
|
if let Ok(ihwnd) = WindowsApi::foreground_window() {
|
||||||
if HWND(ihwnd) == self.hwnd() {
|
if HWND(ihwnd) == self.hwnd() {
|
||||||
|
// Center cursor in Window
|
||||||
|
if mouse_follows_focus {
|
||||||
|
WindowsApi::center_cursor_in_rect(&WindowsApi::window_rect(self.hwnd())?)?;
|
||||||
|
}
|
||||||
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ gen_enum_subcommand_args! {
|
|||||||
WindowHidingBehaviour: HidingBehaviour,
|
WindowHidingBehaviour: HidingBehaviour,
|
||||||
CrossMonitorMoveBehaviour: MoveBehaviour,
|
CrossMonitorMoveBehaviour: MoveBehaviour,
|
||||||
UnmanagedWindowOperationBehaviour: OperationBehaviour,
|
UnmanagedWindowOperationBehaviour: OperationBehaviour,
|
||||||
|
PromoteWindow: OperationDirection,
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! gen_target_subcommand_args {
|
macro_rules! gen_target_subcommand_args {
|
||||||
@@ -1004,6 +1005,8 @@ enum SubCommand {
|
|||||||
Promote,
|
Promote,
|
||||||
/// Promote the user focus to the top of the tree
|
/// Promote the user focus to the top of the tree
|
||||||
PromoteFocus,
|
PromoteFocus,
|
||||||
|
/// Promote the window in the specified direction
|
||||||
|
PromoteWindow(PromoteWindow),
|
||||||
/// Force the retiling of all managed windows
|
/// Force the retiling of all managed windows
|
||||||
Retile,
|
Retile,
|
||||||
/// Set the monitor index preference for a monitor identified using its size
|
/// Set the monitor index preference for a monitor identified using its size
|
||||||
@@ -1513,6 +1516,9 @@ fn main() -> Result<()> {
|
|||||||
SubCommand::PromoteFocus => {
|
SubCommand::PromoteFocus => {
|
||||||
send_message(&SocketMessage::PromoteFocus.as_bytes()?)?;
|
send_message(&SocketMessage::PromoteFocus.as_bytes()?)?;
|
||||||
}
|
}
|
||||||
|
SubCommand::PromoteWindow(arg) => {
|
||||||
|
send_message(&SocketMessage::PromoteWindow(arg.operation_direction).as_bytes()?)?;
|
||||||
|
}
|
||||||
SubCommand::TogglePause => {
|
SubCommand::TogglePause => {
|
||||||
send_message(&SocketMessage::TogglePause.as_bytes()?)?;
|
send_message(&SocketMessage::TogglePause.as_bytes()?)?;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user