Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

kwin-resize-window

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.

Usage

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.

Install

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.

Notes

Things the script already handles, worth knowing if you ever modify it:

  • KWin 6 doesn't expose Qt.rect()frameGeometry must 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 an org.freedesktop.Notifications.Notify D-Bus call captured by dbus-monitor.
  • Matching is against resourceClass / resourceName only (not the window caption), because titles often contain the cwd or document name and cause false positives.

License

MIT

About

Resize and move application windows by name pattern. KDE Plasma + Wayland (KWin scripting) and X11 (wmctrl/xdotool) backends.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages