mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-30 22:22:08 +02:00
feat(cli): add eager-focus command
This commit adds a new komorebic command "eager-focus", which takes a full case-sensitive exe identifier as an argument. When komorebi receives this message, it will look through each monitor and workspace for the first matching managed window and then focus it. This allows users who have well defined workspaces and rules to bind semantic hotkeys to commands like "komorebic eager-focus Discord.exe" to immediately jump to applications instead of mentally looking up their assigned workspaces or positions within container stacks.
This commit is contained in:
@@ -927,6 +927,12 @@ struct ReplaceConfiguration {
|
||||
path: PathBuf,
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
struct EagerFocus {
|
||||
/// Case-sensitive exe identifier
|
||||
exe: String,
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
#[clap(author, about, version = build::CLAP_LONG_VERSION)]
|
||||
struct Opts {
|
||||
@@ -1020,6 +1026,9 @@ enum SubCommand {
|
||||
/// Move the focused window in the specified cycle direction
|
||||
#[clap(arg_required_else_help = true)]
|
||||
CycleMove(CycleMove),
|
||||
/// Focus the first managed window matching the given exe
|
||||
#[clap(arg_required_else_help = true)]
|
||||
EagerFocus(EagerFocus),
|
||||
/// Stack the focused window in the specified direction
|
||||
#[clap(arg_required_else_help = true)]
|
||||
Stack(Stack),
|
||||
@@ -1726,6 +1735,9 @@ fn main() -> Result<()> {
|
||||
SubCommand::CycleMove(arg) => {
|
||||
send_message(&SocketMessage::CycleMoveWindow(arg.cycle_direction))?;
|
||||
}
|
||||
SubCommand::EagerFocus(arg) => {
|
||||
send_message(&SocketMessage::EagerFocus(arg.exe))?;
|
||||
}
|
||||
SubCommand::MoveToMonitor(arg) => {
|
||||
send_message(&SocketMessage::MoveContainerToMonitorNumber(arg.target))?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user