feat(wm): add force-focus command

On rare occasions and usually with Firefox, the desired application will
fail to be focused with the regular focus commands. This commit
introduces a new command, force-focus, which can be used to simulate a
left-click on a window that has failed to take focus, since this is what
I have to do to work around the issue anyway.
This commit is contained in:
LGUG2Z
2022-12-15 17:08:23 -08:00
parent ca09b9b300
commit 613d69a737
5 changed files with 56 additions and 0 deletions

View File

@@ -557,6 +557,8 @@ enum SubCommand {
Minimize,
/// Close the focused window
Close,
/// Forcibly focus the window at the cursor with a left mouse click
ForceFocus,
/// Change focus to the window in the specified cycle direction
#[clap(arg_required_else_help = true)]
CycleFocus(CycleFocus),
@@ -831,6 +833,9 @@ fn main() -> Result<()> {
SubCommand::Focus(arg) => {
send_message(&SocketMessage::FocusWindow(arg.operation_direction).as_bytes()?)?;
}
SubCommand::ForceFocus => {
send_message(&SocketMessage::ForceFocus.as_bytes()?)?;
}
SubCommand::Close => {
send_message(&SocketMessage::Close.as_bytes()?)?;
}