docs(readme): add section about custom layouts

This commit adds some documentation around custom layouts as well as a
YAML example.

The load-layout command has been renamed to load-custom-layout for
consistency.

resolve #50
This commit is contained in:
LGUG2Z
2021-10-21 16:30:07 -07:00
parent 6981d778a9
commit 840af215a0
3 changed files with 78 additions and 7 deletions

View File

@@ -144,10 +144,21 @@ macro_rules! gen_workspace_subcommand_args {
gen_workspace_subcommand_args! {
Name: String,
Layout: #[enum] DefaultLayout,
CustomLayout: String,
Tiling: #[enum] BooleanState,
}
#[derive(Clap, AhkFunction)]
pub struct WorkspaceCustomLayout {
/// Monitor index (zero-indexed)
monitor: usize,
/// Workspace index on the specified monitor (zero-indexed)
workspace: usize,
/// JSON or YAML file from which the custom layout definition should be loaded
path: String,
}
#[derive(Clap, AhkFunction)]
struct Resize {
#[clap(arg_enum)]
@@ -298,7 +309,7 @@ struct Load {
}
#[derive(Clap, AhkFunction)]
struct LoadLayout {
struct LoadCustomLayout {
/// JSON or YAML file from which the custom layout definition should be loaded
path: String,
}
@@ -399,7 +410,7 @@ enum SubCommand {
ChangeLayout(ChangeLayout),
/// Load a custom layout from file for the focused workspace
#[clap(setting = AppSettings::ArgRequiredElseHelp)]
LoadLayout(LoadLayout),
LoadCustomLayout(LoadCustomLayout),
/// Flip the layout on the focused workspace (BSP only)
#[clap(setting = AppSettings::ArgRequiredElseHelp)]
FlipLayout(FlipLayout),
@@ -625,7 +636,7 @@ fn main() -> Result<()> {
&*SocketMessage::WorkspaceLayoutCustom(
arg.monitor,
arg.workspace,
resolve_windows_path(&arg.value)?,
resolve_windows_path(&arg.path)?,
)
.as_bytes()?,
)?;
@@ -716,7 +727,7 @@ fn main() -> Result<()> {
SubCommand::ChangeLayout(arg) => {
send_message(&*SocketMessage::ChangeLayout(arg.default_layout).as_bytes()?)?;
}
SubCommand::LoadLayout(arg) => {
SubCommand::LoadCustomLayout(arg) => {
send_message(
&*SocketMessage::ChangeLayoutCustom(resolve_windows_path(&arg.path)?).as_bytes()?,
)?;