i3-snap is a script for managing window positions in i3wm. It allows snapping floating windows to screen edges, centering them, or moving them between workspaces.
- Move floating windows left, right, up, down, or center them.
- Automatically move a window to the next workspace when reaching the edge.
- Supports setting a margin from the screen edges.
- Works with non-floating windows using standard i3 commands.
python(>=3.6)i3ipc
Install dependencies:
pip install i3ipcSave i3-snap to a convenient location and make it executable:
chmod +x i3-snap.py./i3-snap.py <direction> [-m MARGIN]<direction>– snapping direction (left,right,up,down,center).-m,--margin– margin from the edge (default: 15px).
Snap a window to the left edge:
./i3-snap.py leftSnap to the right edge with a 30px margin:
./i3-snap.py right -m 30Add key bindings to ~/.config/i3/config:
bindsym $mod+Left exec ~/scripts/i3-snap.py left
bindsym $mod+Right exec ~/scripts/i3-snap.py right
bindsym $mod+Up exec ~/scripts/i3-snap.py up
bindsym $mod+Down exec ~/scripts/i3-snap.py down