mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-07-12 16:12:44 +02:00
feat(cli): add move-to-monitor-workspace command
This commit adds a move-to-monitor-workspace command, which, following the existing convention, does the same action as send-to-monitor-workspace, but sets the focused monitor, workspace and container to the window container once it is inserted into the target monitor and workspace indices.
This commit is contained in:
@@ -57,6 +57,7 @@ pub enum SocketMessage {
|
|||||||
SendContainerToWorkspaceNumber(usize),
|
SendContainerToWorkspaceNumber(usize),
|
||||||
CycleSendContainerToWorkspace(CycleDirection),
|
CycleSendContainerToWorkspace(CycleDirection),
|
||||||
SendContainerToMonitorWorkspaceNumber(usize, usize),
|
SendContainerToMonitorWorkspaceNumber(usize, usize),
|
||||||
|
MoveContainerToMonitorWorkspaceNumber(usize, usize),
|
||||||
SendContainerToNamedWorkspace(String),
|
SendContainerToNamedWorkspace(String),
|
||||||
MoveWorkspaceToMonitorNumber(usize),
|
MoveWorkspaceToMonitorNumber(usize),
|
||||||
SwapWorkspacesToMonitorNumber(usize),
|
SwapWorkspacesToMonitorNumber(usize),
|
||||||
|
|||||||
@@ -465,6 +465,9 @@ impl WindowManager {
|
|||||||
SocketMessage::SendContainerToMonitorWorkspaceNumber(monitor_idx, workspace_idx) => {
|
SocketMessage::SendContainerToMonitorWorkspaceNumber(monitor_idx, workspace_idx) => {
|
||||||
self.move_container_to_monitor(monitor_idx, Option::from(workspace_idx), false)?;
|
self.move_container_to_monitor(monitor_idx, Option::from(workspace_idx), false)?;
|
||||||
}
|
}
|
||||||
|
SocketMessage::MoveContainerToMonitorWorkspaceNumber(monitor_idx, workspace_idx) => {
|
||||||
|
self.move_container_to_monitor(monitor_idx, Option::from(workspace_idx), true)?;
|
||||||
|
}
|
||||||
SocketMessage::SendContainerToNamedWorkspace(ref workspace) => {
|
SocketMessage::SendContainerToNamedWorkspace(ref workspace) => {
|
||||||
if let Some((monitor_idx, workspace_idx)) =
|
if let Some((monitor_idx, workspace_idx)) =
|
||||||
self.monitor_workspace_index_by_name(workspace)
|
self.monitor_workspace_index_by_name(workspace)
|
||||||
@@ -1411,6 +1414,8 @@ impl WindowManager {
|
|||||||
| SocketMessage::MoveWorkspaceToMonitorNumber(_)
|
| SocketMessage::MoveWorkspaceToMonitorNumber(_)
|
||||||
| SocketMessage::MoveContainerToMonitorNumber(_)
|
| SocketMessage::MoveContainerToMonitorNumber(_)
|
||||||
| SocketMessage::MoveContainerToWorkspaceNumber(_)
|
| SocketMessage::MoveContainerToWorkspaceNumber(_)
|
||||||
|
| SocketMessage::MoveContainerToMonitorWorkspaceNumber(_, _)
|
||||||
|
| SocketMessage::MoveContainerToNamedWorkspace(_)
|
||||||
| SocketMessage::ResizeWindowEdge(_, _)
|
| SocketMessage::ResizeWindowEdge(_, _)
|
||||||
| SocketMessage::ResizeWindowAxis(_, _)
|
| SocketMessage::ResizeWindowAxis(_, _)
|
||||||
| SocketMessage::ToggleFloat
|
| SocketMessage::ToggleFloat
|
||||||
|
|||||||
@@ -478,6 +478,14 @@ pub struct SendToMonitorWorkspace {
|
|||||||
target_workspace: usize,
|
target_workspace: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Parser, AhkFunction)]
|
||||||
|
pub struct MoveToMonitorWorkspace {
|
||||||
|
/// Target monitor index (zero-indexed)
|
||||||
|
target_monitor: usize,
|
||||||
|
/// Workspace index on the target monitor (zero-indexed)
|
||||||
|
target_workspace: usize,
|
||||||
|
}
|
||||||
|
|
||||||
macro_rules! gen_focused_workspace_padding_subcommand_args {
|
macro_rules! gen_focused_workspace_padding_subcommand_args {
|
||||||
// SubCommand Pattern
|
// SubCommand Pattern
|
||||||
( $( $name:ident ),+ $(,)? ) => {
|
( $( $name:ident ),+ $(,)? ) => {
|
||||||
@@ -918,6 +926,9 @@ enum SubCommand {
|
|||||||
/// Send the focused window to the specified monitor workspace
|
/// Send the focused window to the specified monitor workspace
|
||||||
#[clap(arg_required_else_help = true)]
|
#[clap(arg_required_else_help = true)]
|
||||||
SendToMonitorWorkspace(SendToMonitorWorkspace),
|
SendToMonitorWorkspace(SendToMonitorWorkspace),
|
||||||
|
/// Move the focused window to the specified monitor workspace
|
||||||
|
#[clap(arg_required_else_help = true)]
|
||||||
|
MoveToMonitorWorkspace(MoveToMonitorWorkspace),
|
||||||
/// Focus the specified monitor
|
/// Focus the specified monitor
|
||||||
#[clap(arg_required_else_help = true)]
|
#[clap(arg_required_else_help = true)]
|
||||||
FocusMonitor(FocusMonitor),
|
FocusMonitor(FocusMonitor),
|
||||||
@@ -1550,6 +1561,15 @@ fn main() -> Result<()> {
|
|||||||
.as_bytes()?,
|
.as_bytes()?,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
SubCommand::MoveToMonitorWorkspace(arg) => {
|
||||||
|
send_message(
|
||||||
|
&SocketMessage::MoveContainerToMonitorWorkspaceNumber(
|
||||||
|
arg.target_monitor,
|
||||||
|
arg.target_workspace,
|
||||||
|
)
|
||||||
|
.as_bytes()?,
|
||||||
|
)?;
|
||||||
|
}
|
||||||
SubCommand::MoveWorkspaceToMonitor(arg) => {
|
SubCommand::MoveWorkspaceToMonitor(arg) => {
|
||||||
send_message(&SocketMessage::MoveWorkspaceToMonitorNumber(arg.target).as_bytes()?)?;
|
send_message(&SocketMessage::MoveWorkspaceToMonitorNumber(arg.target).as_bytes()?)?;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user