# LibTmux\Set-TmuxWindowSize

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

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

Mode:
Set-TmuxWindowSize
    [-Window] <LibTmux.Window>
    -Mode <LibTmux.WindowResizeMode>
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Size (default):
Set-TmuxWindowSize
    [-Window] <LibTmux.Window>
    [-Width <System.Nullable[System.Int32]>]
    [-Height <System.Nullable[System.Int32]>]
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]
```

Resize a window in cells or against its attached clients.

Specify at least one positive cell dimension, an edge Direction with positive
Adjustment, or a client-size Mode. These forms cannot be combined. Resize
delegates to the native core and switches window-size to manual. PassThru
returns the observed replacement [`Window`](/en/csharp/latest/reference/libtmux-window/); the original capture remains unchanged.

### Notes

A disappeared target or stale generation writes a per-target error. Use
[`-ErrorAction`](/en/powershell/latest/reference/libtmux-set-tmuxwindowsize/#LibTmux%5CSet-TmuxWindowSize.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.Window`: Native pipeline owner.
- **Outputs:** `LibTmux.Window`

Related APIs:

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

## Examples

Example 1

Set a previously selected native $window to 120 columns and 40 rows.

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

```powershell
$window | LibTmux\Set-TmuxWindowSize -Width 120 -Height 40 -PassThru
```

## Parameters

- `Window` (`LibTmux.Window`): The native window 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`.
- `Mode` (`LibTmux.WindowResizeMode`): Expand to the largest client or Shrink to the smallest client. (for `Mode`)
  Required. Named parameter. Does not accept pipeline input. [`ValidateSet(["Expand","Shrink"])`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatesetattribute?view=powershellsdk-7.4.0).
- `Width` (`System.Nullable[System.Int32]`): Positive width in cells. At least one of Width or Height is required in the Size
parameter set. (for `Size`)
  Optional. 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).
- `Height` (`System.Nullable[System.Int32]`): Positive height in cells. (for `Size`)
  Optional. 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).

## Returns

`LibTmux.Window`: Emitted only with PassThru.
