feat(swap-workspaces-monitor): command to swap focused monitor workspaces with another monitor

Basically this commit adds a command that allows you to swap two monitors, well it actually swaps
the workspaces between the monitors.
This commit is contained in:
Yusuf007R
2023-06-08 21:37:04 -05:00
committed by جاد
parent 647f5b7ded
commit 6fe2290d74
5 changed files with 101 additions and 0 deletions

View File

@@ -154,6 +154,7 @@ gen_target_subcommand_args! {
FocusWorkspace,
FocusWorkspaces,
MoveWorkspaceToMonitor,
SwapWorkspacesToMonitor,
}
macro_rules! gen_named_target_subcommand_args {
@@ -807,6 +808,9 @@ enum SubCommand {
/// Move the focused workspace to the specified monitor
#[clap(arg_required_else_help = true)]
MoveWorkspaceToMonitor(MoveWorkspaceToMonitor),
/// Swap focused monitior workspaces with specified monitor
#[clap(arg_required_else_help = true)]
SwapWorkspacesToMonitor(SwapWorkspacesToMonitor),
/// Create and append a new workspace on the focused monitor
NewWorkspace,
/// Set the resize delta (used by resize-edge and resize-axis)
@@ -1192,6 +1196,9 @@ fn main() -> Result<()> {
SubCommand::MoveWorkspaceToMonitor(arg) => {
send_message(&SocketMessage::MoveWorkspaceToMonitorNumber(arg.target).as_bytes()?)?;
}
SubCommand::SwapWorkspacesToMonitor(arg) => {
send_message(&SocketMessage::SwapWorkspacesToMonitorNumber(arg.target).as_bytes()?)?;
}
SubCommand::InvisibleBorders(arg) => {
send_message(
&SocketMessage::InvisibleBorders(Rect {