feat(wm): mouse follows focus enable/disable cmd

This commit adds a command to explicitly specify the desired state of
mouse follows focus to complement the previously added toggle command.
This commit is contained in:
LGUG2Z
2021-10-30 15:24:27 -07:00
parent a55069df48
commit 4e6e2b3aa8
4 changed files with 20 additions and 0 deletions

View File

@@ -88,6 +88,7 @@ gen_enum_subcommand_args! {
FlipLayout: Flip,
ChangeLayout: DefaultLayout,
WatchConfiguration: BooleanState,
MouseFollowsFocus: BooleanState,
Query: StateQuery,
}
@@ -499,6 +500,9 @@ enum SubCommand {
/// Toggle focus follows mouse for the operating system
#[clap(setting = AppSettings::ArgRequiredElseHelp)]
ToggleFocusFollowsMouse(ToggleFocusFollowsMouse),
/// Enable or disable mouse follows focus on all workspaces
#[clap(setting = AppSettings::ArgRequiredElseHelp)]
MouseFollowsFocus(MouseFollowsFocus),
/// Toggle mouse follows focus on all workspaces
ToggleMouseFollowsFocus,
/// Generate a library of AutoHotKey helper functions
@@ -924,6 +928,14 @@ fn main() -> Result<()> {
SubCommand::ToggleMouseFollowsFocus => {
send_message(&*SocketMessage::ToggleMouseFollowsFocus.as_bytes()?)?;
}
SubCommand::MouseFollowsFocus(arg) => {
let enable = match arg.boolean_state {
BooleanState::Enable => true,
BooleanState::Disable => false,
};
send_message(&*SocketMessage::MouseFollowsFocus(enable).as_bytes()?)?;
}
}
Ok(())