Small CLI that resizes and moves application windows by name pattern. Detects the session at runtime: on KDE Plasma + Wayland it talks to KWin via D-Bus scripting; on X11 it falls back to wmctrl or xdotool. Built mostly to force apps to a consistent 1920x1080 for screenshots without dragging window borders around.
What you'd usually want:
resize-window -w qbz -s 1920x1080
Generic for any app:
resize-window -w firefox -s 1600x900 -c # -c = center on screen
resize-window -w "com.blitzfc.qbz" -l # list matching windows
resize-window -w code -s 1280x720 -p 100,50 # size + position
resize-window -h
Auto-detection: KDE + Wayland goes through KWin scripting via qdbus6. On X11 it uses wmctrl or xdotool automatically.
Drop the script anywhere on your PATH:
install -m 0755 resize-window ~/.local/bin/resize-window
Requirements: qdbus6 (or qdbus) and dbus-monitor for the KDE Wayland backend; wmctrl or xdotool for the X11 backend.
Things the script already handles, worth knowing if you ever modify it:
- KWin 6 doesn't expose
Qt.rect()—frameGeometrymust be assigned a plain{x, y, width, height}object. - KWin's
print()output isn't captured by journalctl or~/.xsession-errors, so feedback is reported via anorg.freedesktop.Notifications.NotifyD-Bus call captured bydbus-monitor. - Matching is against
resourceClass/resourceNameonly (not the window caption), because titles often contain the cwd or document name and cause false positives.
MIT