feat(wm): add focus follows mouse toggle

This commit is contained in:
LGUG2Z
2021-08-09 07:49:00 -07:00
parent 8b4ce48a66
commit f3661325d9
6 changed files with 90 additions and 25 deletions

View File

@@ -60,6 +60,7 @@ enum SubCommand {
AdjustContainerPadding(SizingAdjustment),
AdjustWorkspacePadding(SizingAdjustment),
FlipLayout(LayoutFlip),
FocusFollowsMouse(BooleanState),
}
#[derive(Clap)]
@@ -111,6 +112,12 @@ struct Resize {
sizing: Sizing,
}
#[derive(Clap)]
enum BooleanState {
Enable,
Disable,
}
pub fn send_message(bytes: &[u8]) -> Result<()> {
let mut socket = dirs::home_dir().context("there is no home directory")?;
socket.push("komorebi.sock");
@@ -322,6 +329,15 @@ fn main() -> Result<()> {
.unwrap();
send_message(&*bytes)?;
}
SubCommand::FocusFollowsMouse(enable) => {
let enable = match enable {
BooleanState::Enable => true,
BooleanState::Disable => false,
};
let bytes = SocketMessage::FocusFollowsMouse(enable).as_bytes().unwrap();
send_message(&*bytes)?;
}
}
Ok(())