feat(cli): add focused ws padding cmds

This commit adds dedicated komorebic commands for setting the padding
values of the focused workspace and containers.

re #570
This commit is contained in:
LGUG2Z
2023-11-16 15:05:04 -08:00
parent 4283dfb0ba
commit 0d1595e543
3 changed files with 54 additions and 0 deletions

View File

@@ -431,6 +431,24 @@ pub struct SendToMonitorWorkspace {
target_workspace: usize,
}
macro_rules! gen_focused_workspace_padding_subcommand_args {
// SubCommand Pattern
( $( $name:ident ),+ $(,)? ) => {
$(
#[derive(clap::Parser, derive_ahk::AhkFunction)]
pub struct $name {
/// Pixels size to set as an integer
size: i32,
}
)+
};
}
gen_focused_workspace_padding_subcommand_args! {
FocusedWorkspaceContainerPadding,
FocusedWorkspacePadding,
}
macro_rules! gen_padding_subcommand_args {
// SubCommand Pattern
( $( $name:ident ),+ $(,)? ) => {
@@ -857,6 +875,12 @@ enum SubCommand {
/// Set offsets for a monitor to exclude parts of the work area from tiling
#[clap(arg_required_else_help = true)]
MonitorWorkAreaOffset(MonitorWorkAreaOffset),
/// Set container padding on the focused workspace
#[clap(arg_required_else_help = true)]
FocusedWorkspaceContainerPadding(FocusedWorkspaceContainerPadding),
/// Set workspace padding on the focused workspace
#[clap(arg_required_else_help = true)]
FocusedWorkspacePadding(FocusedWorkspacePadding),
/// Adjust container padding on the focused workspace
#[clap(arg_required_else_help = true)]
AdjustContainerPadding(AdjustContainerPadding),
@@ -1358,6 +1382,12 @@ fn main() -> Result<()> {
&SocketMessage::NamedWorkspacePadding(arg.workspace, arg.size).as_bytes()?,
)?;
}
SubCommand::FocusedWorkspacePadding(arg) => {
send_message(&SocketMessage::FocusedWorkspacePadding(arg.size).as_bytes()?)?;
}
SubCommand::FocusedWorkspaceContainerPadding(arg) => {
send_message(&SocketMessage::FocusedWorkspaceContainerPadding(arg.size).as_bytes()?)?;
}
SubCommand::AdjustWorkspacePadding(arg) => {
send_message(
&SocketMessage::AdjustWorkspacePadding(arg.sizing, arg.adjustment).as_bytes()?,