mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-07-12 08:02:40 +02:00
feat(wm): add cmd to focus ws on target monitor
This commit adds a new command which allows the focusing of workspaces on monitors other than the currently focused monitor by specifying a monitor index. Sending this command to komorebi will make the target monitor index the currently focused monitor. resolve #85
This commit is contained in:
Generated
+2
-2
@@ -577,9 +577,9 @@ checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memoffset"
|
name = "memoffset"
|
||||||
version = "0.6.4"
|
version = "0.6.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9"
|
checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -308,6 +308,7 @@ send-to-monitor Send the focused window to the specified mo
|
|||||||
send-to-workspace Send the focused window to the specified workspace
|
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
|
||||||
|
focus-monitor-workspace Focus the specified workspace on the target monitor
|
||||||
cycle-monitor Focus the monitor in the given cycle direction
|
cycle-monitor Focus the monitor in the given cycle direction
|
||||||
cycle-workspace Focus the workspace in the given cycle direction
|
cycle-workspace Focus the workspace in the given cycle direction
|
||||||
new-workspace Create and append a new workspace on the focused monitor
|
new-workspace Create and append a new workspace on the focused monitor
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ pub enum SocketMessage {
|
|||||||
CycleFocusWorkspace(CycleDirection),
|
CycleFocusWorkspace(CycleDirection),
|
||||||
FocusMonitorNumber(usize),
|
FocusMonitorNumber(usize),
|
||||||
FocusWorkspaceNumber(usize),
|
FocusWorkspaceNumber(usize),
|
||||||
|
FocusMonitorWorkspaceNumber(usize, usize),
|
||||||
ContainerPadding(usize, usize, i32),
|
ContainerPadding(usize, usize, i32),
|
||||||
WorkspacePadding(usize, usize, i32),
|
WorkspacePadding(usize, usize, i32),
|
||||||
WorkspaceTiling(usize, usize, bool),
|
WorkspaceTiling(usize, usize, bool),
|
||||||
|
|||||||
@@ -220,6 +220,10 @@ impl WindowManager {
|
|||||||
self.focus_monitor(monitor_idx)?;
|
self.focus_monitor(monitor_idx)?;
|
||||||
self.focus_workspace(workspace_idx)?;
|
self.focus_workspace(workspace_idx)?;
|
||||||
}
|
}
|
||||||
|
SocketMessage::FocusMonitorWorkspaceNumber(monitor_idx, workspace_idx) => {
|
||||||
|
self.focus_monitor(monitor_idx)?;
|
||||||
|
self.focus_workspace(workspace_idx)?;
|
||||||
|
}
|
||||||
SocketMessage::Stop => {
|
SocketMessage::Stop => {
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
"received stop command, restoring all hidden windows and terminating process"
|
"received stop command, restoring all hidden windows and terminating process"
|
||||||
|
|||||||
@@ -104,6 +104,10 @@ FocusWorkspace(target) {
|
|||||||
Run, komorebic.exe focus-workspace %target%, , Hide
|
Run, komorebic.exe focus-workspace %target%, , Hide
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FocusMonitorWorkspace(target_monitor, target_workspace) {
|
||||||
|
Run, komorebic.exe focus-monitor-workspace %target_monitor% %target_workspace%, , Hide
|
||||||
|
}
|
||||||
|
|
||||||
CycleMonitor(cycle_direction) {
|
CycleMonitor(cycle_direction) {
|
||||||
Run, komorebic.exe cycle-monitor %cycle_direction%, , Hide
|
Run, komorebic.exe cycle-monitor %cycle_direction%, , Hide
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -216,6 +216,14 @@ struct EnsureWorkspaces {
|
|||||||
workspace_count: usize,
|
workspace_count: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Parser, AhkFunction)]
|
||||||
|
struct FocusMonitorWorkspace {
|
||||||
|
/// Target monitor index (zero-indexed)
|
||||||
|
target_monitor: usize,
|
||||||
|
/// Workspace index on the target monitor (zero-indexed)
|
||||||
|
target_workspace: usize,
|
||||||
|
}
|
||||||
|
|
||||||
macro_rules! gen_padding_subcommand_args {
|
macro_rules! gen_padding_subcommand_args {
|
||||||
// SubCommand Pattern
|
// SubCommand Pattern
|
||||||
( $( $name:ident ),+ $(,)? ) => {
|
( $( $name:ident ),+ $(,)? ) => {
|
||||||
@@ -428,6 +436,9 @@ enum SubCommand {
|
|||||||
/// Focus the specified workspace on the focused monitor
|
/// Focus the specified workspace on the focused monitor
|
||||||
#[clap(setting = AppSettings::ArgRequiredElseHelp)]
|
#[clap(setting = AppSettings::ArgRequiredElseHelp)]
|
||||||
FocusWorkspace(FocusWorkspace),
|
FocusWorkspace(FocusWorkspace),
|
||||||
|
/// Focus the specified workspace on the target monitor
|
||||||
|
#[clap(setting = AppSettings::ArgRequiredElseHelp)]
|
||||||
|
FocusMonitorWorkspace(FocusMonitorWorkspace),
|
||||||
/// Focus the monitor in the given cycle direction
|
/// Focus the monitor in the given cycle direction
|
||||||
#[clap(setting = AppSettings::ArgRequiredElseHelp)]
|
#[clap(setting = AppSettings::ArgRequiredElseHelp)]
|
||||||
CycleMonitor(CycleMonitor),
|
CycleMonitor(CycleMonitor),
|
||||||
@@ -797,6 +808,15 @@ fn main() -> Result<()> {
|
|||||||
SubCommand::FocusWorkspace(arg) => {
|
SubCommand::FocusWorkspace(arg) => {
|
||||||
send_message(&*SocketMessage::FocusWorkspaceNumber(arg.target).as_bytes()?)?;
|
send_message(&*SocketMessage::FocusWorkspaceNumber(arg.target).as_bytes()?)?;
|
||||||
}
|
}
|
||||||
|
SubCommand::FocusMonitorWorkspace(arg) => {
|
||||||
|
send_message(
|
||||||
|
&*SocketMessage::FocusMonitorWorkspaceNumber(
|
||||||
|
arg.target_monitor,
|
||||||
|
arg.target_workspace,
|
||||||
|
)
|
||||||
|
.as_bytes()?,
|
||||||
|
)?;
|
||||||
|
}
|
||||||
SubCommand::CycleMonitor(arg) => {
|
SubCommand::CycleMonitor(arg) => {
|
||||||
send_message(&*SocketMessage::CycleFocusMonitor(arg.cycle_direction).as_bytes()?)?;
|
send_message(&*SocketMessage::CycleFocusMonitor(arg.cycle_direction).as_bytes()?)?;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user