mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-18 23:44:00 +01: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,
|
||||
Promote,
|
||||
PromoteFocus,
|
||||
PromoteWindow(OperationDirection),
|
||||
ToggleFloat,
|
||||
ToggleMonocle,
|
||||
ToggleMaximize,
|
||||
|
||||
@@ -185,6 +185,10 @@ impl WindowManager {
|
||||
match message {
|
||||
SocketMessage::Promote => self.promote_container_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) => {
|
||||
self.focus_container_in_direction(direction)?;
|
||||
}
|
||||
|
||||
@@ -227,6 +227,11 @@ impl Window {
|
||||
// If the target window is already focused, do nothing.
|
||||
if let Ok(ihwnd) = WindowsApi::foreground_window() {
|
||||
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(());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,6 +172,7 @@ gen_enum_subcommand_args! {
|
||||
WindowHidingBehaviour: HidingBehaviour,
|
||||
CrossMonitorMoveBehaviour: MoveBehaviour,
|
||||
UnmanagedWindowOperationBehaviour: OperationBehaviour,
|
||||
PromoteWindow: OperationDirection,
|
||||
}
|
||||
|
||||
macro_rules! gen_target_subcommand_args {
|
||||
@@ -1004,6 +1005,8 @@ enum SubCommand {
|
||||
Promote,
|
||||
/// Promote the user focus to the top of the tree
|
||||
PromoteFocus,
|
||||
/// Promote the window in the specified direction
|
||||
PromoteWindow(PromoteWindow),
|
||||
/// Force the retiling of all managed windows
|
||||
Retile,
|
||||
/// Set the monitor index preference for a monitor identified using its size
|
||||
@@ -1513,6 +1516,9 @@ fn main() -> Result<()> {
|
||||
SubCommand::PromoteFocus => {
|
||||
send_message(&SocketMessage::PromoteFocus.as_bytes()?)?;
|
||||
}
|
||||
SubCommand::PromoteWindow(arg) => {
|
||||
send_message(&SocketMessage::PromoteWindow(arg.operation_direction).as_bytes()?)?;
|
||||
}
|
||||
SubCommand::TogglePause => {
|
||||
send_message(&SocketMessage::TogglePause.as_bytes()?)?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user