mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-04-25 10:08:33 +02:00
feat(wm): add send-to-workspace/monitor cmds
This commit adds two commands to allow the user to send the currently focused container to a different workspace or monitor as a background operation, without following the moved container to the destination workspace or monitor. resolve #20
This commit is contained in:
@@ -183,6 +183,8 @@ unstack Unstack the focused window
|
|||||||
cycle-stack Cycle the focused stack in the specified cycle direction
|
cycle-stack Cycle the focused stack in the specified cycle direction
|
||||||
move-to-monitor Move the focused window to the specified monitor
|
move-to-monitor Move the focused window to the specified monitor
|
||||||
move-to-workspace Move the focused window to the specified workspace
|
move-to-workspace Move the focused window to the specified workspace
|
||||||
|
send-to-monitor Send the focused window to the specified monitor
|
||||||
|
send-to-workspace Send the focused window to the specified workspace
|
||||||
focus-monitor Focus the specified monitor
|
focus-monitor Focus the specified monitor
|
||||||
focus-workspace Focus the specified workspace on the focused monitor
|
focus-workspace Focus the specified workspace on the focused monitor
|
||||||
new-workspace Create and append a new workspace on the focused monitor
|
new-workspace Create and append a new workspace on the focused monitor
|
||||||
@@ -236,8 +238,10 @@ used [is available here](komorebi.sample.with.lib.ahk).
|
|||||||
- [x] Cycle through stacked windows
|
- [x] Cycle through stacked windows
|
||||||
- [x] Change focused window by direction
|
- [x] Change focused window by direction
|
||||||
- [x] Move focused window container in direction
|
- [x] Move focused window container in direction
|
||||||
- [x] Move focused window container to monitor
|
- [x] Move focused window container to monitor and follow
|
||||||
- [x] Move focused window container to workspace
|
- [x] Move focused window container to workspace follow
|
||||||
|
- [x] Send focused window container to monitor
|
||||||
|
- [x] Send focused window container to workspace
|
||||||
- [x] Mouse follows focused container
|
- [x] Mouse follows focused container
|
||||||
- [x] Resize window container in direction
|
- [x] Resize window container in direction
|
||||||
- [ ] Resize child window containers by split ratio
|
- [ ] Resize child window containers by split ratio
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ pub fn ahk_function(input: ::proc_macro::TokenStream) -> ::proc_macro::TokenStre
|
|||||||
impl AhkFunction for #name {
|
impl AhkFunction for #name {
|
||||||
fn generate_ahk_function() -> String {
|
fn generate_ahk_function() -> String {
|
||||||
::std::format!(r#"
|
::std::format!(r#"
|
||||||
{}({}) {{
|
{}({}) {{
|
||||||
Run, komorebic.exe {} {}, , Hide
|
Run, komorebic.exe {} {}, , Hide
|
||||||
}}"#,
|
}}"#,
|
||||||
::std::stringify!(#name),
|
::std::stringify!(#name),
|
||||||
#arguments,
|
#arguments,
|
||||||
@@ -88,8 +88,8 @@ pub fn ahk_library(input: ::proc_macro::TokenStream) -> ::proc_macro::TokenStrea
|
|||||||
let name = &variant.ident;
|
let name = &variant.ident;
|
||||||
stream.extend(quote! {
|
stream.extend(quote! {
|
||||||
v.push(::std::format!(r#"
|
v.push(::std::format!(r#"
|
||||||
{}() {{
|
{}() {{
|
||||||
Run, komorebic.exe {}, , Hide
|
Run, komorebic.exe {}, , Hide
|
||||||
}}"#,
|
}}"#,
|
||||||
::std::stringify!(#name),
|
::std::stringify!(#name),
|
||||||
::std::stringify!(#name).to_kebab_case()
|
::std::stringify!(#name).to_kebab_case()
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ pub enum SocketMessage {
|
|||||||
CycleStack(CycleDirection),
|
CycleStack(CycleDirection),
|
||||||
MoveContainerToMonitorNumber(usize),
|
MoveContainerToMonitorNumber(usize),
|
||||||
MoveContainerToWorkspaceNumber(usize),
|
MoveContainerToWorkspaceNumber(usize),
|
||||||
|
SendContainerToMonitorNumber(usize),
|
||||||
|
SendContainerToWorkspaceNumber(usize),
|
||||||
Promote,
|
Promote,
|
||||||
ToggleFloat,
|
ToggleFloat,
|
||||||
ToggleMonocle,
|
ToggleMonocle,
|
||||||
|
|||||||
@@ -106,6 +106,12 @@ impl WindowManager {
|
|||||||
SocketMessage::MoveContainerToMonitorNumber(monitor_idx) => {
|
SocketMessage::MoveContainerToMonitorNumber(monitor_idx) => {
|
||||||
self.move_container_to_monitor(monitor_idx, true)?;
|
self.move_container_to_monitor(monitor_idx, true)?;
|
||||||
}
|
}
|
||||||
|
SocketMessage::SendContainerToWorkspaceNumber(workspace_idx) => {
|
||||||
|
self.move_container_to_workspace(workspace_idx, false)?;
|
||||||
|
}
|
||||||
|
SocketMessage::SendContainerToMonitorNumber(monitor_idx) => {
|
||||||
|
self.move_container_to_monitor(monitor_idx, false)?;
|
||||||
|
}
|
||||||
SocketMessage::TogglePause => {
|
SocketMessage::TogglePause => {
|
||||||
tracing::info!("pausing");
|
tracing::info!("pausing");
|
||||||
self.is_paused = !self.is_paused;
|
self.is_paused = !self.is_paused;
|
||||||
|
|||||||
@@ -527,8 +527,10 @@ impl WindowManager {
|
|||||||
let monitor = self
|
let monitor = self
|
||||||
.focused_monitor_mut()
|
.focused_monitor_mut()
|
||||||
.ok_or_else(|| anyhow!("there is no monitor"))?;
|
.ok_or_else(|| anyhow!("there is no monitor"))?;
|
||||||
|
|
||||||
monitor.move_container_to_workspace(idx, follow)?;
|
monitor.move_container_to_workspace(idx, follow)?;
|
||||||
monitor.load_focused_workspace()?;
|
monitor.load_focused_workspace()?;
|
||||||
|
|
||||||
self.update_focused_workspace(true)
|
self.update_focused_workspace(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,14 @@ MoveToWorkspace(target) {
|
|||||||
Run, komorebic.exe move-to-workspace %target%, , Hide
|
Run, komorebic.exe move-to-workspace %target%, , Hide
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SendToMonitor(target) {
|
||||||
|
Run, komorebic.exe send-to-monitor %target%, , Hide
|
||||||
|
}
|
||||||
|
|
||||||
|
SendToWorkspace(target) {
|
||||||
|
Run, komorebic.exe send-to-workspace %target%, , Hide
|
||||||
|
}
|
||||||
|
|
||||||
FocusMonitor(target) {
|
FocusMonitor(target) {
|
||||||
Run, komorebic.exe focus-monitor %target%, , Hide
|
Run, komorebic.exe focus-monitor %target%, , Hide
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,8 @@ macro_rules! gen_target_subcommand_args {
|
|||||||
gen_target_subcommand_args! {
|
gen_target_subcommand_args! {
|
||||||
MoveToMonitor,
|
MoveToMonitor,
|
||||||
MoveToWorkspace,
|
MoveToWorkspace,
|
||||||
|
SendToMonitor,
|
||||||
|
SendToWorkspace,
|
||||||
FocusMonitor,
|
FocusMonitor,
|
||||||
FocusWorkspace
|
FocusWorkspace
|
||||||
}
|
}
|
||||||
@@ -270,6 +272,12 @@ enum SubCommand {
|
|||||||
/// Move the focused window to the specified workspace
|
/// Move the focused window to the specified workspace
|
||||||
#[clap(setting = AppSettings::ArgRequiredElseHelp)]
|
#[clap(setting = AppSettings::ArgRequiredElseHelp)]
|
||||||
MoveToWorkspace(MoveToWorkspace),
|
MoveToWorkspace(MoveToWorkspace),
|
||||||
|
/// Send the focused window to the specified monitor
|
||||||
|
#[clap(setting = AppSettings::ArgRequiredElseHelp)]
|
||||||
|
SendToMonitor(SendToMonitor),
|
||||||
|
/// Send the focused window to the specified workspace
|
||||||
|
#[clap(setting = AppSettings::ArgRequiredElseHelp)]
|
||||||
|
SendToWorkspace(SendToWorkspace),
|
||||||
/// Focus the specified monitor
|
/// Focus the specified monitor
|
||||||
#[clap(setting = AppSettings::ArgRequiredElseHelp)]
|
#[clap(setting = AppSettings::ArgRequiredElseHelp)]
|
||||||
FocusMonitor(FocusMonitor),
|
FocusMonitor(FocusMonitor),
|
||||||
@@ -422,6 +430,12 @@ fn main() -> Result<()> {
|
|||||||
SubCommand::MoveToWorkspace(arg) => {
|
SubCommand::MoveToWorkspace(arg) => {
|
||||||
send_message(&*SocketMessage::MoveContainerToWorkspaceNumber(arg.target).as_bytes()?)?;
|
send_message(&*SocketMessage::MoveContainerToWorkspaceNumber(arg.target).as_bytes()?)?;
|
||||||
}
|
}
|
||||||
|
SubCommand::SendToMonitor(arg) => {
|
||||||
|
send_message(&*SocketMessage::SendContainerToMonitorNumber(arg.target).as_bytes()?)?;
|
||||||
|
}
|
||||||
|
SubCommand::SendToWorkspace(arg) => {
|
||||||
|
send_message(&*SocketMessage::SendContainerToWorkspaceNumber(arg.target).as_bytes()?)?;
|
||||||
|
}
|
||||||
SubCommand::ContainerPadding(arg) => {
|
SubCommand::ContainerPadding(arg) => {
|
||||||
send_message(
|
send_message(
|
||||||
&*SocketMessage::ContainerPadding(arg.monitor, arg.workspace, arg.size)
|
&*SocketMessage::ContainerPadding(arg.monitor, arg.workspace, arg.size)
|
||||||
|
|||||||
Reference in New Issue
Block a user