KWin script for Plasma 6 that re-randomizes the focused window to an almost maximized size with small, configurable gaps on each side.
The goal is to keep windows close to full-screen while shifting their exact position slightly on every trigger to reduce the chance of static OLED wear patterns.
Note On Plasma 6.6.x, changing PixelShift settings in the KWin Scripts UI may not take effect immediately. The current workaround is: change the settings, disable the
PixelShiftscript, then enable it again.
Meta+Shift+Upresizes the focused window- rerolls fresh gaps on every trigger
- keeps the result roughly centered instead of drifting wildly
- respects KWin's maximize area, so panels and reserved screen space are preserved
- configurable
minGap,maxGap, andbalanceJitterin KWin Scripts settings - optional auto-apply for exact app ids such as
firefoxandorg.kde.konsole - optional periodic re-apply for matching apps at a configurable interval in minutes
.
├── package/
│ ├── contents/
│ └── metadata.json
├── scripts/
│ ├── build.sh
│ └── install.sh
└── .github/workflows/build.yml
- KDE Plasma 6
- KWin scripting support
kpackagetool6gdbus
scripts/install.sh also uses kwriteconfig6, kreadconfig6, and qdbus6 when available.
./scripts/install.shThat script:
- installs or upgrades the KWin script package
- enables it in
kwinrc - reloads KWin configuration
- assigns
Meta+Shift+Upthrough KGlobalAccel
kpackagetool6 --type=KWin/Script --install ./package
kwriteconfig6 --file kwinrc --group Plugins --key kwin_pixelshiftEnabled true
qdbus6 org.kde.KWin /KWin reconfigureIf you also want to assign the shortcut manually through D-Bus:
gdbus call \
--session \
--dest org.kde.kglobalaccel \
--object-path /kglobalaccel \
--method org.kde.KGlobalAccel.setShortcut \
"['kwin', 'PixelShift', 'KWin', 'Resize the focused window with fresh near-centered random gaps']" \
"[318767123]" \
6Open System Settings -> Window Management -> KWin Scripts -> PixelShift.
Available settings:
minGap: minimum inset per side in pixelsmaxGap: maximum inset per side in pixelsbalanceJitter: how far opposite sides may differ while still staying roughly centeredautoApplyEnabled: automatically apply PixelShift when a matching app first opensautoApplyApps: comma-separated exact app ids matched againstdesktopFileName,resourceClass, andresourceNameperiodicApplyEnabled: re-apply PixelShift to currently open matching apps on a timer-like intervalperiodicApplyMinutes: minutes between periodic re-application for matching apps, default30
Recommended defaults:
minGap = 6maxGap = 24balanceJitter = 4
Create distributable archives with:
./scripts/build.shThis writes to dist/:
kwin-pixelshift.zipkwin-pixelshift.kwinscriptkwin-pixelshift.zip.sha256
The GitHub Actions workflow builds and uploads the same artifacts on pushes, pull requests, manual runs, and version tags.
See CHANGELOG.md.
- The script is intentionally silent during normal use.
- On runtimes without JavaScript timer APIs in KWin, periodic re-apply happens on the next relevant KWin activity after the interval has elapsed.
- If KWin API behavior changes across Plasma releases, the shortcut can still be debugged by watching
journalctl -bforkwin_pixelshiftmessages.
GPL-3.0-or-later