SonicWin scripting API
This page describes the API of SonicWin scripts and scripted effects. Types keep the KWin namespace they inherited.
Global
Methods and properties added to the global JavaScript object.
Read-only properties
KWin::Options options: all configuration values of the window manager coreKWin::Workspace workspace: the core wrapper of the window managerobject KWin: provides access to the enums defined inKWin::WorkspaceWrapper
Functions
print(QVariant ... values): prints all provided valuesQVariant readConfig(QString key, QVariant defaultValue = QVariant()): reads the value ofkeyin the script's configuration. Without a default and with no stored value, the result is undefined.bool registerScreenEdge(ElectricBorder border, QJSValue callback): registers the callback for a screen edge, invoked when the mouse is pushed against the edge. Scripts can also addX-KWin-Border-Activateto their metadata to be listed in the screen edges settings. This writes aBorderConfig=entry in the script's configuration, with the edges the user selected.bool unregisterScreenEdge(ElectricBorder border): disconnects all callbacks of this script from that edgebool registerShortcut(QString title, QString text, QString keySequence, QJSValue callback): registerskeySequenceas a global shortcut, and calls the callback when it is used.titleandtextname the shortcut in the shortcut settings.bool assert(bool value, QString message = QString()): aborts the script ifvalueisn't true, with the given message or a default onebool assertTrue(bool value, QString message = QString()): the same asassertbool assertFalse(bool value, QString message = QString()): aborts the script ifvalueisn't falsebool assertEquals(QVariant expected, QVariant actual, QString message = QString()): aborts the script if the values differbool assertNull(QVariant value, QString message = QString()): aborts the script ifvalueisn't nullbool assertNotNull(QVariant value, QString message = QString()): aborts the script ifvalueis nullcallDBus(QString service, QString path, QString interface, QString method, QVariant arg..., QJSValue callback = QJSValue()): calls a D-Bus method. Any number of arguments can be added. The call is always asynchronous, and the reply values go to the optional callback in the last position.registerUserActionsMenu(QJSValue callback): registers a callback invoked when the window's actions menu (Alt+F3, or right-clicking the decoration) is about to be shown. It receives the window, and can return one menu entry or a submenu.
A menu entry:
{
title: "My Menu entry",
checkable: true,
checked: false,
triggered: function (action) {
// callback with the triggered QAction
}
}
A submenu:
{
title: "My menu",
items: [{...}, {...}, ...] // list of entries as above
}
KWin::WorkspaceWrapper
Enums
ClientAreaOption
PlacementArea, MovementArea, MaximizeArea, MaximizeFullArea, FullScreenArea, WorkArea, FullArea, ScreenArea
ElectricBorder
ElectricTop, ElectricTopRight, ElectricRight, ElectricBottomRight, ElectricBottom, ElectricBottomLeft, ElectricLeft, ElectricTopLeft, ELECTRIC_COUNT, ElectricNone
Read-only properties
QList<KWin::VirtualDesktop *> desktopsQSize desktopGridSizeint desktopGridWidthint desktopGridHeightint workspaceWidthint workspaceHeightQSize workspaceSizeKWin::Output *activeScreenQList<KWin::Output *> screensQList<KWin::Output *> screenOrderQStringList activitiesQSize virtualScreenSize: the bounding size of all screens combined. Overlapping areas aren't counted more than once.QRect virtualScreenGeometry: the bounding geometry of all screens combined. It always starts at (0,0).QList<KWin::Window *> stackingOrder: the windows managed by SonicWin, ordered by visibility (later ones cover earlier ones)QPoint cursorPos: the current position of the cursorQQmlListProperty<KWin::Window> windows: the windows, in QML scripts only
Read-write properties
KWin::VirtualDesktop *currentDesktop: the current virtual desktopKWin::Window *activeWindowQString currentActivity
Signals
windowAdded(KWin::Window *window)windowRemoved(KWin::Window *window)windowActivated(KWin::Window *window)desktopsChanged(): a virtual desktop was added or removeddesktopLayoutChanged(): the layout of virtual desktops changed, sodesktopGridSize,desktopGridWidthanddesktopGridHeighthave new valuesscreensChanged(): the output list changed, for example when one is connected or removedscreenOrderChanged()currentActivityChanged(const QString &id): the current activity changedactivitiesChanged(const QString &id): the list of activities changedactivityAdded(const QString &id)activityRemoved(const QString &id)virtualScreenSizeChanged()virtualScreenGeometryChanged()currentDesktopChanged(KWin::VirtualDesktop *previous): the current virtual desktop changedcursorPosChanged()
Functions
These act on the active window or the desktop, like the matching shortcuts:
slotSwitchDesktopNext(),slotSwitchDesktopPrevious(),slotSwitchDesktopRight(),slotSwitchDesktopLeft(),slotSwitchDesktopUp(),slotSwitchDesktopDown()slotSwitchToNextScreen(),slotSwitchToPrevScreen(),slotSwitchToRightScreen(),slotSwitchToLeftScreen(),slotSwitchToAboveScreen(),slotSwitchToBelowScreen()slotWindowToNextScreen(),slotWindowToPrevScreen(),slotWindowToRightScreen(),slotWindowToLeftScreen(),slotWindowToAboveScreen(),slotWindowToBelowScreen()slotToggleShowDesktop()slotWindowMaximize(),slotWindowMaximizeVertical(),slotWindowMaximizeHorizontal(),slotWindowMinimize(),slotWindowShade(),slotWindowRaise(),slotWindowLower(),slotWindowRaiseOrLower()slotActivateAttentionWindow()slotWindowMoveLeft(),slotWindowMoveRight(),slotWindowMoveUp(),slotWindowMoveDown()slotWindowExpandHorizontal(),slotWindowExpandVertical(),slotWindowShrinkHorizontal(),slotWindowShrinkVertical()slotWindowQuickTileLeft(),slotWindowQuickTileRight(),slotWindowQuickTileTop(),slotWindowQuickTileBottom(),slotWindowQuickTileTopLeft(),slotWindowQuickTileTopRight(),slotWindowQuickTileBottomLeft(),slotWindowQuickTileBottomRight()slotSwitchWindowUp(),slotSwitchWindowDown(),slotSwitchWindowRight(),slotSwitchWindowLeft()slotIncreaseWindowOpacity(),slotLowerWindowOpacity()slotWindowOperations(),slotWindowClose(),slotWindowMove(),slotWindowResize(),slotWindowAbove(),slotWindowBelow(),slotWindowOnAllDesktops(),slotWindowFullScreen(),slotWindowNoBorder()slotWindowToNextDesktop(),slotWindowToPreviousDesktop(),slotWindowToDesktopRight(),slotWindowToDesktopLeft(),slotWindowToDesktopUp(),slotWindowToDesktopDown()
Others:
QList<KWin::Window *> windowList() const: the windows, in JavaScript scripts onlysendClientToScreen(KWin::Window *client, KWin::Output *output): sends the window to the outputshowOutline(const QRect &geometry): shows an outline at the geometry, or moves the current one thereshowOutline(int x, int y, int width, int height): the same, for conveniencehideOutline(): hides the outlineKWin::Output *screenAt(const QPointF &pos) constKWin::TileManager *tilingForScreen(const QString &screenName) constKWin::TileManager *tilingForScreen(KWin::Output *output) constQRectF clientArea(ClientAreaOption option, KWin::Output *output, KWin::VirtualDesktop *desktop) const: the geometry a window can use with that option. Prefer this over other ways of finding screen sizes, as it takes constraints such as panels into account, and it is aware of multiple screens.QRectF clientArea(ClientAreaOption option, KWin::Window *client) const: the same for a windowcreateDesktop(int position, const QString &name) const: creates a virtual desktop at a position from 0 to the current count. With an empty name, the default name is used.removeDesktop(KWin::VirtualDesktop *desktop) constQString supportInformation() const: support information about the running window managerraiseWindow(KWin::Window *window): raises a window above all othersKWin::Window *getClient(qulonglong windowId): the window with the given ID, or nullQList<KWin::Window *> windowAt(const QPointF &pos, int count = 1) const: up tocountwindows at a location, topmost first. A negative count returns all.bool isEffectActive(const QString &pluginId) const: whether an effect is loaded and currently active
KWin::VirtualDesktop
Read-only properties:
QString iduint x11DesktopNumber
Read-write properties:
QString name
Signals:
nameChanged()x11DesktopNumberChanged()aboutToBeDestroyed(): emitted just before the desktop is destroyed
KWin::Output
Enums
DpmsMode:On,Standby,Suspend,OffCapability:Dpms,Overscan,Vrr,RgbRange,HighDynamicRange,WideColorGamut,AutoRotation,IccProfile,TearingSubPixel:Unknown,None,Horizontal_RGB,Horizontal_BGR,Vertical_RGB,Vertical_BGRRgbRange:Automatic,Full,LimitedAutoRotationPolicy:Never,InTabletMode,Always
Read-only properties
QRect geometryqreal devicePixelRatioQString nameQString manufacturerQString modelQString serialNumber
Signals
geometryChanged()enabledChanged(): the output was enabled or disabledscaleChanged(): the device pixel ratio changedaboutToTurnOff(std::chrono::milliseconds time): the display will be dimmed intimemilliseconds, so that effects can plan for itwakeUp(): the output was turned onaboutToChange(OutputChangeSet *changeSet): the output is about to change configuration through user interaction. Only for effects.changed(): the output changed through user interaction. Only for effects.currentModeChanged(),modesChanged(),outputChange(const QRegion &damagedRegion),transformChanged(),dpmsModeChanged(),capabilitiesChanged(),overscanChanged(),vrrPolicyChanged(),rgbRangeChanged(),wideColorGamutChanged(),highDynamicRangeChanged(),autoRotationPolicyChanged(),iccProfileChanged(),iccProfilePathChanged(),brightnessMetadataChanged(),sdrGamutWidenessChanged(),colorDescriptionChanged(),referenceLuminanceChanged(),colorProfileSourceChanged(),brightnessChanged(),colorPowerTradeoffChanged(),dimmingChanged()
Functions
QPointF mapToGlobal(const QPointF &pos) constQPointF mapFromGlobal(const QPointF &pos) const
KWin::Window
Enums
SizeMode:SizeModeAny,SizeModeFixedW,SizeModeFixedH,SizeModeMaxSameApplicationCheck:RelaxedForActive,AllowCrossProcesses
Read-only properties
Geometry:
QRectF bufferGeometry: the rectangle the window's pixmap or buffer occupies on the screen, including invisible portions such as client-side drop shadowsQRectF clientGeometry: the geometry without frame bordersQPointF pos,QSizeF size,qreal x,qreal y,qreal width,qreal height: the position and size of the frame geometryQRectF rectKWin::Output *output: the output the window's center is onQRectF iconGeometry: the optional geometry representing the minimized window, for example in a taskbar (_NET_WM_ICON_GEOMETRY)QSizeF minSize,QSizeF maxSize: the sizes given inWM_NORMAL_HINTS
Identity:
QString resourceName,QString resourceClass,QString windowRoleQUuid internalId: a unique ID for this windowint pid: the process owning the windowQString caption: the caption, fromWM_NAMEwith a suffix for hostname and shortcutQString captionNormal: the caption without that suffixQIcon iconQString desktopFileName: the desktop file name of the application, normally the base name, such asorg.example.foo, or a full path if it isn't in a standard locationQString colorScheme: the requested color scheme, as an absolute path or a name in the user's config directory. An empty string means the default palette. It might differ from the applied theme if the scheme can't be found.
Window type. These follow the _NET_WM_WINDOW_TYPE values unless noted:
bool desktopWindow: a desktop background window, the one with the wallpaperbool dock: a panelbool toolbar: a standalone (detached) toolbar windowbool menu: a torn-off menubool normalWindow: an application or other window that no specialized type fitsbool dialogbool splash: a splash screen. Many older applications don't mark theirs.bool utility: for example a tool windowbool dropdownMenu: a popup opened directly or indirectly from the application's menu barbool popupMenu: a popup menu that isn't torn off or dropdownbool tooltipbool notificationbool criticalNotification: a window with a critical notification (non-standard type)bool appletPopup: an applet popup (non-standard type)bool onScreenDisplay: an on-screen display (non-standard type)bool comboBox: a combo box popupbool dndIcon: a drag and drop iconint windowType: the NETWM window typebool specialWindow: any special type (desktop, dock, splash and so on), usually without a frame or window management
State:
bool managed: whether SonicWin manages this window, controlling its placement and more, as opposed to override-redirect windowsbool deleted: an already deleted window, kept for the compositor's animationsbool popupWindow: whether the window is a popupbool outline: whether this is the outlineint stackingOrder: the window's position in the stackbool active: whether the window is activebool transient: whether the window is a transient of anotherKWin::Window *transientFor: the window it is a transient of, if anybool modalbool move,bool resize: whether the user is currently moving or resizing itKWin::MaximizeMode maximizeMode:0restored,1maximized vertically,2horizontally,3fullybool decorationHasAlpha: whether the decoration currently uses an alpha channelbool providesContextHelp: mostly for decorations, to decide whether to show the help buttonbool hasApplicationMenu: whether an application menu is availablebool applicationMenuActive: whether the application menu is openbool unresponsive: whether the application failed to answer a ping in time, usually because it froze or crashedKWin::Layer layerbool hidden: usually true of auto-hiding panelsbool inputMethod: whether it is an input method window
Abilities. These are evaluated each time they are read, so they have no notify signal:
bool fullScreenable,bool closeable,bool shadeable,bool minimizable,bool maximizable,bool resizeablebool moveable: a window that isn't movable might still be movable to another screenbool moveableAcrossScreensbool wantsInput: whether it can accept keyboard focus
Read-write properties
qreal opacitybool skipsCloseAnimation: the window doesn't want to be animated on close. A screenshot application, for example, may not want its window captured.bool fullScreen: to be sure the state changed, connect to the notify signalQList<KWin::VirtualDesktop *> desktops: the desktops the window is on. Empty means all desktops.bool onAllDesktopsQStringList activities: the activities the window is on. Empty means all activities.bool skipTaskbar,bool skipPager,bool skipSwitcher: exclude it from taskbars, pagers and window switchingbool keepAbove,bool keepBelowbool shade,bool minimizedbool demandsAttention: whether_NET_WM_STATE_DEMANDS_ATTENTIONis set, meaning something happened in or with the windowQRectF frameGeometry: the geometry of the window. Depending on the resize mode,frameGeometryChangedmight be emitted at each step or only at the end.bool noBorder: whether the window has no decoration. Whether it has a border is the window manager's decision, not the application's.KWin::Tile *tile: the tile this window is associated with, if any
Signals
stackingOrderChanged(),shadeChanged(),opacityChanged(KWin::Window *window, qreal oldOpacity),damaged(KWin::Window *window),inputTransformationChanged(),closed()outputChanged(): the window's screen changed, because a screen was added or removed or the geometry changedskipCloseAnimationChanged(),windowRoleChanged(),windowClassChanged(),surfaceChanged(),shadowChanged()bufferGeometryChanged(const QRectF &oldGeometry),frameGeometryChanged(const QRectF &oldGeometry),clientGeometryChanged(const QRectF &oldGeometry)frameGeometryAboutToChange(): the new geometry isn't known yetvisibleGeometryChanged()tileChanged(KWin::Tile *tile): the associated tile changed, including from and to nonerequestedTileChanged(),offscreenRenderingChanged(),targetScaleChanged(),nextTargetScaleChanged(),noBorderChanged(),borderRadiusChanged()fullScreenChanged(),skipTaskbarChanged(),skipPagerChanged(),skipSwitcherChanged(),iconChanged(),activeChanged()keepAboveChanged(bool),keepBelowChanged(bool),demandsAttentionChanged(),desktopsChanged(),activitiesChanged(),minimizedChanged()paletteChanged(const QPalette &p),colorSchemeChanged(),captionChanged(),captionNormalChanged()maximizedAboutToChange(MaximizeMode mode),maximizedChanged()transientChanged(),modalChanged(),quickTileModeChanged(),moveResizedChanged(),moveResizeCursorChanged(CursorShape)interactiveMoveResizeStarted(),interactiveMoveResizeStepped(const QRectF &geometry),interactiveMoveResizeFinished()closeableChanged(bool),minimizeableChanged(bool),shadeableChanged(bool),maximizeableChanged(bool)desktopFileNameChanged(),applicationMenuChanged(),hasApplicationMenuChanged(bool),applicationMenuActiveChanged(bool)unresponsiveChanged(bool),decorationChanged(),hiddenChanged(),hiddenByShowDesktopChanged(),lockScreenOverlayChanged(),readyForPaintingChanged(),maximizeGeometryRestoreChanged(),fullscreenGeometryRestoreChanged()
Functions
closeWindow()setMaximize(bool vertically, bool horizontally): sets the maximization
KWin::TileManager
KWin::Tile *rootTile(read-only)TileModel *model(read-only)tileRemoved(KWin::Tile *tile)(signal)KWin::Tile *bestTileForPosition(qreal x, qreal y)
KWin::Tile
LayoutDirection is Floating, Horizontal or Vertical.
Read-only properties:
QRectF absoluteGeometry,QRectF absoluteGeometryInScreenint positionInLayoutTile *parentQList<KWin::Tile *> tilesQList<KWin::Window *> windowsbool isLayout,bool canBeRemoved
Read-write properties:
QRectF relativeGeometryqreal padding
Signals: relativeGeometryChanged(), absoluteGeometryChanged(), windowGeometryChanged(), paddingChanged(qreal padding), rowChanged(int row), isLayoutChanged(bool isLayout), childTilesChanged(), windowAdded(Window *window), windowRemoved(Window *window), windowsChanged()
Functions:
resizeByPixels(qreal delta, Qt::Edge edge)
Global in scripted effects
Methods and properties added to the global JavaScript object of scripted effects.
Read-only properties
KWin::EffectsHandler effects: the core wrapper of the effects systemKWin::ScriptedEffect effect: the actual effectobject Effect: access to the enums ofKWin::AnimationEffectandKWin::ScriptedEffectobject KWin: access to the enums ofKWin::WorkspaceWrapperobject QEasingCurve: access to the enums ofQEasingCurve
Functions
QList<quint64> animate(settings): schedules one or many animations for one window. The settings object declares them, as shown below. At least one animation or attribute setter must be given, in the top-level properties or inanimations.QList<quint64> set(settings): likeanimate, except that the change doesn't end with the animation. The attribute stays at the target value until you cancel it.bool cancel(QList<quint64>): cancels animations returned byanimateorset. A single value also works.print(QVariant ... values): prints all provided valuesint animationTime(int duration): adjusts a duration by the global animation time factorint displayWidth(),int displayHeight(): the size of the complete display, all screens togetherbool registerScreenEdge(ElectricBorder border, QJSValue callback): registers the callback for a screen edgebool registerShortcut(QString title, QString text, QString keySequence, QJSValue callback): registers a global shortcutuint addFragmentShader(ShaderTrait traits, QString fragmentShaderFile): creates a shader and returns an ID usable inanimateorset. The source must be in theshaderssubdirectory of the package'scontentsdirectory, with the extensionfrag. The vertex shader is generated from theShaderTraitflags.uint setUniform(uint shaderId, QString name, QJSValue value): updates a uniform of a shader. The value can be a float (integer uniforms aren't supported), an array of 2, 3 or 4 numbers, a color string or a color as returned byreadConfig.
The settings object:
{
window: EffectWindow, // the window to animate, required
duration: int, // duration in ms, required
curve: QEasingCurve.Type, // global easing curve, optional
type: Effect.Attribute, // for the first animation, optional
from: FPx2, // for the first animation, optional
to: FPx2, // for the first animation, optional
delay: int, // for the first animation, optional
shader: int, // for the first animation, optional
animations: [ // additional animations, optional
{
curve: QEasingCurve.Type, // overrides the global one
type: Effect.Attribute,
from: FPx2,
to: FPx2,
delay: int,
shader: int
}
]
}
KWin::EffectsHandler
The manager class that handles all the effects.
OnScreenMessageHideFlag: SkipsCloseAnimation means the on-screen message should skip the close animation.
Read-only properties
QStringList activeEffects,QStringList loadedEffects,QStringList listOfEffectsQString currentActivityQSize desktopGridSize,int desktopGridWidth,int desktopGridHeight,int workspaceWidth,int workspaceHeightQList<KWin::VirtualDesktop *> desktopsbool optionRollOverDesktopsKWin::Output *activeScreenqreal animationTimeFactor: the factor to multiply animation speed by. Get the actual value withanimationTime(). It can be 0, so make sure your code copes with a time of 0 ms if used manually.QList<EffectWindow *> stackingOrderbool decorationsHaveAlpha: whether decorations use the alpha channelCompositingType compositingTypeQPointF cursorPosQSize virtualScreenSize,QRect virtualScreenGeometrybool hasActiveFullScreenEffectKWin::SessionState sessionState: the state of the session, for example whether the user is logging outbool colorPickerActive
Read-write properties
KWin::VirtualDesktop *currentDesktopKWin::EffectWindow *activeWindow
Signals
screenAdded(KWin::Output *screen),screenRemoved(KWin::Output *screen)desktopChanged(KWin::VirtualDesktop *oldDesktop, KWin::VirtualDesktop *newDesktop, KWin::EffectWindow *with): the current desktop changed.withis the window taken over to the new desktop, and can be null.desktopChanging(KWin::VirtualDesktop *currentDesktop, QPointF offset, KWin::EffectWindow *with): emitted during the animation.offsetis the current offset: anxof 0.6 means 60% of the way to the desktop to the right. Positive values mean up and right.desktopChangingCancelled(),desktopAdded(KWin::VirtualDesktop *desktop),desktopRemoved(KWin::VirtualDesktop *desktop)desktopGridSizeChanged(const QSize &size),desktopGridWidthChanged(int width),desktopGridHeightChanged(int height)showingDesktopChanged(bool): the show desktop state changed. The desktop rises to the keep-above layer, so you may want to elevate windows.windowAdded(KWin::EffectWindow *w): a new window was addedwindowClosed(KWin::EffectWindow *w): a window is being removed. An effect that animates closing should connect to this and reference the window.windowActivated(KWin::EffectWindow *w): a window was activated, or null if there is no active windowwindowDeleted(KWin::EffectWindow *w): a closed window is no longer referenced. Effects keeping track of closed windows should clean up here.tabBoxAdded(int mode): a task switcher was added. An effect replacing it should reference it.tabBoxClosed(): the switcher was closedtabBoxUpdated(): the selected window or the list changedtabBoxKeyEvent(QKeyEvent *event): a key not handled by the switcher was pressed while it was activemouseChanged(const QPointF &pos, const QPointF &oldpos, Qt::MouseButtons buttons, Qt::MouseButtons oldbuttons, Qt::KeyboardModifiers modifiers, Qt::KeyboardModifiers oldmodifiers): the mouse changed. An effect needing updated positions must first callstartMousePolling.cursorShapeChanged(): the cursor shape changed. This connection is tracked, so disconnect when you no longer need it to stop cursor event filtering.propertyNotify(KWin::EffectWindow *w, long atom): receives events registered withregisterPropertyType. UsereadProperty()for the data. The property may already be set on the window, so doing the same fromwindowAddedis usually needed.wis null for a property of the root window.currentActivityAboutToChange(),currentActivityChanged(const QString &id),activityAdded(const QString &id),activityRemoved(const QString &id)screenLockingChanged(bool locked): the screen was locked or unlockedscreenAboutToLock(): emitted just before the screen locker grabs keys. Effects should release any grabs immediately.stackingOrderChanged(): a window was raised or loweredscreenEdgeApproaching(ElectricBorder border, qreal factor, const QRect &geometry): the mouse is approaching an edge.factorruns from 0.0, when first entered and on leaving, to 1.0 at the edge, which suits animations.virtualScreenSizeChanged(),virtualScreenGeometryChanged()windowDataChanged(KWin::EffectWindow *w, int role): the data on a window for a role changed. An effect that doesn't work on windows grabbed by another effect can, for example, cancel its animation when a grab is added.xcbConnectionChanged(): the xcb connection was created or destroyed. Effects can use this to refetch properties. The root window also becomes invalid.activeFullScreenEffectChanged(),hasActiveFullScreenEffectChanged(),sessionStateChanged(),colorPickerActiveChanged()startupAdded(const QString &id, const QIcon &icon),startupChanged(const QString &id, const QIcon &icon),startupRemoved(const QString &id)
Functions
reconfigureEffect(const QString &name),bool loadEffect(const QString &name),toggleEffect(const QString &name),unloadEffect(const QString &name)bool isEffectLoaded(const QString &name) const,bool isEffectSupported(const QString &name),QList<bool> areEffectsSupported(const QStringList &names)QString supportInformation(const QString &name) const,QString debug(const QString &name, const QString ¶meter = QString()) constmoveWindow(KWin::EffectWindow *w, const QPoint &pos, bool snap = false, double snapAdjust = 1.0)windowToDesktops(KWin::EffectWindow *w, const QList<KWin::VirtualDesktop *> &desktops): moves a window to the given desktops; it ends up on the last in the list, and an empty list means all desktopswindowToScreen(KWin::EffectWindow *w, Output *screen)KWin::VirtualDesktop *desktopAbove(KWin::VirtualDesktop *desktop = nullptr, bool wrap = true) const, and likewisedesktopToRight,desktopBelowanddesktopToLeft: the neighboring desktop, wrapping around ifwrapis set, starting from the current desktop if none is givenQString desktopName(KWin::VirtualDesktop *desktop) constKWin::EffectWindow *findWindow(WId id) constKWin::EffectWindow *findWindow(QWindow *w) const: finds the window for an internal windowKWin::EffectWindow *findWindow(const QUuid &id) const: finds a window by its internal IDsetElevatedWindow(KWin::EffectWindow *w, bool set)addRepaintFull(): schedules the whole workspace to be repainted next time. During painting, it doesn't affect the current paint.addRepaint(const QRectF &r),addRepaint(const QRect &r),addRepaint(const QRegion &r),addRepaint(int x, int y, int w, int h)
KWin::EffectWindow
Represents a window used by effects.
Paint flags: PAINT_DISABLED, PAINT_DISABLED_BY_DESKTOP, PAINT_DISABLED_BY_MINIMIZE, PAINT_DISABLED_BY_ACTIVITY
Read-only properties
QRectF geometry,QRectF expandedGeometry,QRectF rect,QPointF pos,QSizeF size,qreal x,qreal y,qreal width,qreal heightqreal opacityKWin::Output *screenQList<KWin::VirtualDesktop *> desktops,bool onAllDesktops,bool onCurrentDesktopQString windowClass,QString windowRole,QString caption,QIcon iconbool desktopWindow,bool dock,bool toolbar,bool menu,bool normalWindow,bool dialog,bool splash,bool utility,bool dropdownMenu,bool popupMenu,bool tooltip,bool notification,bool criticalNotification,bool onScreenDisplay,bool comboBox,bool dndIcon: the window types, as for Windowint windowTypebool specialWindowbool deleted: an already deleted window, kept for animationsbool keepAbove,bool keepBelow,bool modal,bool fullScreen,bool unresponsivebool moveable,bool moveableAcrossScreens,bool move,bool resizeQSizeF basicUnit: how much the window wishes to grow or shrink at least. For information only; don't rely on it.QRectF iconGeometrybool skipSwitcherQRectF contentsRect: the geometry of the window's contents inside the whole windowbool hasDecoration,bool decorationHasAlphaQStringList activities,bool onCurrentActivity,bool onAllActivitiesbool visible: not minimized, and on the current desktop and activitybool skipsCloseAnimation: an animation on close isn't useful, as the window won't be visiblebool x11Client: whether this is an X11 clientbool popupWindowQWindow *internalWindow: the internal window, or nullbool outlinepid_t pid: the process the window belongs tobool lockScreen: whether this is the screen locker's greeterbool hiddenByShowDesktop
Read-write properties
bool minimized
Signals
windowStartUserMovedResized(KWin::EffectWindow *w): the user began moving or resizing. Only one window can be moved or resized at a time.windowStepUserMovedResized(KWin::EffectWindow *w, const QRectF &geometry): the geometry changed during that. The window's geometry might not matchgeometryuntil the end, depending on the mode.windowFinishUserMovedResized(KWin::EffectWindow *w): the user finishedwindowMaximizedStateChanged(KWin::EffectWindow *w, bool horizontal, bool vertical): the maximized state changedwindowMaximizedStateAboutToChange(KWin::EffectWindow *w, bool horizontal, bool vertical): emitted before any change, useful for grabbing an image of the window firstwindowFrameGeometryChanged(KWin::EffectWindow *window, const QRectF &oldGeometry)windowFrameGeometryAboutToChange(KWin::EffectWindow *window): the new geometry isn't known yetwindowOpacityChanged(KWin::EffectWindow *w, qreal oldOpacity, qreal newOpacity)minimizedChanged(KWin::EffectWindow *w)windowModalityChanged(KWin::EffectWindow *w)windowUnresponsiveChanged(KWin::EffectWindow *w, bool unresponsive)windowDamaged(KWin::EffectWindow *w): an area is scheduled for repaintingwindowKeepAboveChanged(KWin::EffectWindow *w),windowKeepBelowChanged(KWin::EffectWindow *w),windowFullScreenChanged(KWin::EffectWindow *w),windowDecorationChanged(KWin::EffectWindow *window)windowExpandedGeometryChanged(KWin::EffectWindow *window): the visible geometry changedwindowDesktopsChanged(KWin::EffectWindow *window): the window entered or left a virtual desktopwindowHiddenChanged()
Functions
addRepaint(const QRect &r),addRepaint(int x, int y, int w, int h),addRepaintFull(),addLayerRepaint(const QRect &r),addLayerRepaint(int x, int y, int w, int h)bool isOnActivity(const QString &id) const,bool isOnDesktop(KWin::VirtualDesktop *desktop) constKWin::EffectWindow *findModal(),KWin::EffectWindow *transientFor(),QList<KWin::EffectWindow *> mainWindows() constcloseWindow()setData(int role, const QVariant &data): stores arbitrary data, and emitswindowDataChangedQVariant data(int role) const
KWin::AnimationEffect
Anchor:Left,Top,Right,Bottom,Horizontal,Vertical,MouseAttribute:Opacity,Brightness,Saturation,Scale,Rotation,Position,Size,Translation,Clip,Generic,CrossFadePrevious,Shader,ShaderUniform,NonFloatBaseShaderanimates with a provided shader, whose float uniformanimationProgressis the animation's progress.ShaderUniformalso animates a float uniform passed to the shader, whose location is given as metadata.
MetaType:SourceAnchor,TargetAnchor,RelativeSourceX,RelativeSourceY,RelativeTargetX,RelativeTargetY,AxisDirection:Forward,BackwardTerminationFlag:DontTerminate: don't end when reaching the source or target positionTerminateAtSource: end at the source position, which the animation can reach if its direction was changed to backwardTerminateAtTarget: end at the target position. Without this flag, the animation is persistent.
KWin::ScriptedEffect
Enums
DataRole:WindowAddedGrabRole,WindowClosedGrabRole,WindowMinimizedGrabRole,WindowUnminimizedGrabRole,WindowForceBlurRole,WindowForceBackgroundContrastRoleEasingCurve:GaussianCurveShaderTrait:MapTexture,UniformColor,Modulate,AdjustSaturation
Read-only properties
QString pluginId: the effect's plugin IDbool isActiveFullScreenEffect: whether this is the active fullscreen effect
Signals
configChanged(): the effect's configuration changedanimationEnded(KWin::EffectWindow *w, quint64 animationId)isActiveFullScreenEffectChanged()
Functions
bool borderActivated(ElectricBorder border)bool isGrabbed(KWin::EffectWindow *w, DataRole grabRole): whether another effect has grabbed the window with that rolebool grab(KWin::EffectWindow *w, DataRole grabRole, bool force = false): grabs the window. Unlessforceis true, a window grabbed by another effect isn't grabbed. Returns whether it succeeded.bool ungrab(KWin::EffectWindow *w, DataRole grabRole): ungrabs the window. Returns whether it succeeded.QJSValue readConfig(const QString &key, const QJSValue &defaultValue = QJSValue()): reads a configuration valueint displayWidth() const,int displayHeight() const,int animationTime(int defaultTime) constregisterShortcut(const QString &objectName, const QString &text, const QString &keySequence, const QJSValue &callback)bool registerScreenEdge(int edge, const QJSValue &callback),bool registerRealtimeScreenEdge(int edge, const QJSValue &callback),bool unregisterScreenEdge(int edge)bool registerTouchScreenEdge(int edge, const QJSValue &callback),bool unregisterTouchScreenEdge(int edge),QList<int> touchEdgesForAction(const QString &action) constquint64 animate(KWin::EffectWindow *window, Attribute attribute, int ms, const QJSValue &to, const QJSValue &from = QJSValue(), uint metaData = 0, int curve = QEasingCurve::Linear, int delay = 0, bool fullScreen = false, bool keepAlive = true, uint shaderId = 0)QJSValue animate(const QJSValue &object)quint64 set(KWin::EffectWindow *window, Attribute attribute, int ms, const QJSValue &to, const QJSValue &from = QJSValue(), uint metaData = 0, int curve = QEasingCurve::Linear, int delay = 0, bool fullScreen = false, bool keepAlive = true, uint shaderId = 0)QJSValue set(const QJSValue &object)bool retarget(quint64 animationId, const QJSValue &newTarget, int newRemainingTime = -1), and the same withconst QList<quint64> &animationIdsbool freezeInTime(quint64 animationId, qint64 frozenTime), and the same with a listbool redirect(quint64 animationId, Direction direction, TerminationFlags terminationFlags = TerminateAtSource), and the same with a listbool complete(quint64 animationId), and the same with a listbool cancel(quint64 animationId), and the same with a listuint addFragmentShader(ShaderTrait traits, const QString &fragmentShaderFile = {})setUniform(uint shaderId, const QString &name, const QJSValue &value)