# LibTmux\Set-TmuxPaneSize

- **Package:** LibTmux
- **Language:** PowerShell
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/src/LibTmux.PowerShell/SetTmuxPaneSizeCommand.cs#L7
- **Page:** https://libtmux.org/en/powershell/latest/reference/libtmux-set-tmuxpanesize/

```
Direction:
Set-TmuxPaneSize
    [-Pane] <LibTmux.Pane>
    -Direction <LibTmux.ResizeDirection>
    -Adjustment <System.Int32>
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Size (default):
Set-TmuxPaneSize
    [-Pane] <LibTmux.Pane>
    [-Width <System.String>]
    [-Height <System.String>]
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Zoom:
Set-TmuxPaneSize
    [-Pane] <LibTmux.Pane>
    -Zoom
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]
```

Resize a pane or toggle its zoom.

Specify at least one positive cell or percentage dimension, an edge Direction
with positive Adjustment, or Zoom. These forms cannot be combined. Zoom toggles
the current state; repeating it turns zoom off. tmux clamps sizes that do not
fit. PassThru returns the observed replacement [`Pane`](/en/csharp/latest/reference/libtmux-pane/), which may differ from the
requested dimensions.

### Notes

A disappeared target or stale generation writes a per-target error. Use
[`-ErrorAction`](/en/powershell/latest/reference/libtmux-set-tmuxpanesize/#LibTmux%5CSet-TmuxPaneSize.parameter.ErrorAction) Stop to terminate. Cancellation cannot undo an already dispatched
change.

## Command details

- **Command type:** [`cmdlet`](/en/powershell/latest/reference/glossary/#cmdlet)
- **Default parameter set:** Size
- **Confirmation:** Supports `-WhatIf` and `-Confirm`; confirm impact: Medium.
- **Positional binding:** Enabled.
- **Pipeline inputs:** `LibTmux.Pane`: Native pipeline owner.
- **Outputs:** `LibTmux.Pane`

Related APIs:

- [Task guide](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/layout.md)

## Examples

Example 1

Give a previously selected native $pane 40 columns in a window with a horizontal
split.

[Source example](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux/Set-TmuxPaneSize.md).

```powershell
$pane | LibTmux\Set-TmuxPaneSize -Width 40 -PassThru
```

## Parameters

- `Pane` (`LibTmux.Pane`): The native pane to change.
  Required. Position 0. Accepts pipeline input by value. [`ValidateNotNull()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnullattribute?view=powershellsdk-7.4.0).
- `Direction` (`LibTmux.ResizeDirection`): Move the Up, Down, Left or Right edge. (for `Direction`)
  Required. Named parameter. Does not accept pipeline input. [`ValidateSet(["Up","Down","Left","Right"])`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatesetattribute?view=powershellsdk-7.4.0).
- `Adjustment` (`System.Int32`): Positive number of cells to move the selected edge. (for `Direction`)
  Required. Named parameter. Does not accept pipeline input. [`ValidateRange(1, 2147483647)`](https://learn.microsoft.com/dotnet/api/system.management.automation.validaterangeattribute?view=powershellsdk-7.4.0).
- `PassThru` (`System.Management.Automation.SwitchParameter`): Emit the native replacement handle carrying observed state.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input.
- `Verbose` (`System.Management.Automation.SwitchParameter`): Display verbose messages produced by this command.
  Optional. Named parameter. Switch parameter. Common parameter. Does not accept pipeline input. Aliases: `vb`.
- `Debug` (`System.Management.Automation.SwitchParameter`): Display debug messages produced by this command.
  Optional. Named parameter. Switch parameter. Common parameter. Does not accept pipeline input. Aliases: `db`.
- `ErrorAction` (`System.Management.Automation.ActionPreference`): Choose how this command responds to non-terminating errors.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ea`.
- `WarningAction` (`System.Management.Automation.ActionPreference`): Choose how this command responds to warning messages.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `wa`.
- `InformationAction` (`System.Management.Automation.ActionPreference`): Choose how this command handles information messages.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `infa`.
- `ProgressAction` (`System.Management.Automation.ActionPreference`): Choose how this command handles progress updates.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `proga`.
- `ErrorVariable` (`System.String`): Store the command's error records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ev`.
- `WarningVariable` (`System.String`): Store the command's warning records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `wv`.
- `InformationVariable` (`System.String`): Store the command's information records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `iv`.
- `OutVariable` (`System.String`): Save output in the named variable while passing it down the pipeline.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ov`.
- `OutBuffer` (`System.Int32`): Buffer output before passing it to the next pipeline command.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ob`.
- `PipelineVariable` (`System.String`): Make the most recent output object available through a named variable within the pipeline.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `pv`.
- `WhatIf` (`System.Management.Automation.SwitchParameter`): Preview the change without contacting tmux.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input. Aliases: `wi`.
- `Confirm` (`System.Management.Automation.SwitchParameter`): Ask for confirmation before changing tmux.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input. Aliases: `cf`.
- `Width` (`System.String`): Positive width in cells or as a percentage such as 50%. At least one of Width or
Height is required in the Size parameter set. (for `Size`)
  Optional. Named parameter. Does not accept pipeline input. [`ValidateNotNullOrEmpty()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnulloremptyattribute?view=powershellsdk-7.4.0). [`ValidatePattern("\\A0*[1-9][0-9]*%?\\z")`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatepatternattribute?view=powershellsdk-7.4.0).
- `Height` (`System.String`): Positive height in cells or as a percentage. (for `Size`)
  Optional. Named parameter. Does not accept pipeline input. [`ValidateNotNullOrEmpty()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnulloremptyattribute?view=powershellsdk-7.4.0). [`ValidatePattern("\\A0*[1-9][0-9]*%?\\z")`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatepatternattribute?view=powershellsdk-7.4.0).
- `Zoom` (`System.Management.Automation.SwitchParameter`): Toggle pane zoom; this does not mean set zoom to true. (for `Zoom`)
  Required. Named parameter. Switch parameter. Does not accept pipeline input.

## Returns

`LibTmux.Pane`: Emitted only with PassThru.
