mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-04-22 00:28:34 +02:00
feat(wm): add per-workspace tiling config + toggle
Added two commands, 'komorebic toggle-tiling' and 'komorebic workspace-tiling MONITOR_IDX WORKSPACE_IDX on|off' which allow for tiling on the currently focused workspace to be toggled on and off, and for the tiling for a specific workspace to be set to on or off (useful if you want a specific workspace to always have tiling set to off at startup). resolve #5
This commit is contained in:
@@ -47,7 +47,9 @@ enum SubCommand {
|
||||
ContainerPadding(SizeForMonitorWorkspace),
|
||||
WorkspacePadding(SizeForMonitorWorkspace),
|
||||
WorkspaceLayout(LayoutForMonitorWorkspace),
|
||||
WorkspaceTiling(TilingForMonitorWorkspace),
|
||||
WorkspaceName(NameForMonitorWorkspace),
|
||||
ToggleTiling,
|
||||
ToggleFloat,
|
||||
TogglePause,
|
||||
ToggleMonocle,
|
||||
@@ -91,6 +93,22 @@ struct LayoutForMonitorWorkspace {
|
||||
layout: Layout,
|
||||
}
|
||||
|
||||
fn on_or_off(s: &str) -> Result<bool, &'static str> {
|
||||
match s {
|
||||
"on" => Ok(true),
|
||||
"off" => Ok(false),
|
||||
_ => Err("expected `on` or `off`"),
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clap)]
|
||||
struct TilingForMonitorWorkspace {
|
||||
monitor: usize,
|
||||
workspace: usize,
|
||||
#[clap(parse(try_from_str = on_or_off))]
|
||||
tile: bool,
|
||||
}
|
||||
|
||||
#[derive(Clap)]
|
||||
struct Target {
|
||||
number: usize,
|
||||
@@ -187,6 +205,9 @@ fn main() -> Result<()> {
|
||||
.as_bytes()?,
|
||||
)?;
|
||||
}
|
||||
SubCommand::ToggleTiling => {
|
||||
send_message(&*SocketMessage::ToggleTiling.as_bytes()?)?;
|
||||
}
|
||||
SubCommand::ToggleFloat => {
|
||||
send_message(&*SocketMessage::ToggleFloat.as_bytes()?)?;
|
||||
}
|
||||
@@ -199,6 +220,12 @@ fn main() -> Result<()> {
|
||||
.as_bytes()?,
|
||||
)?;
|
||||
}
|
||||
SubCommand::WorkspaceTiling(layout) => {
|
||||
send_message(
|
||||
&*SocketMessage::WorkspaceTiling(layout.monitor, layout.workspace, layout.tile)
|
||||
.as_bytes()?,
|
||||
)?;
|
||||
}
|
||||
SubCommand::Start => {
|
||||
let script = r#"Start-Process komorebi -WindowStyle hidden"#;
|
||||
match powershell_script::run(script, true) {
|
||||
|
||||
Reference in New Issue
Block a user