Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorRules::WindowQuery Struct Reference

The evaluation input — an attribute bag matched against a MatchExpression. More...

#include <PhosphorRules/WindowQuery.h>

Public Member Functions

bool hasWindow () const
 True if any window attribute is set — i.e.
std::optional< QVariant > valueForField (Field field) const
 Resolve field to its current value.

Public Attributes

std::optional< QString > appId
std::optional< QString > windowClass
std::optional< QString > title
std::optional< QString > windowRole
std::optional< QString > desktopFile
std::optional< int > pid
std::optional< PhosphorProtocol::WindowType > windowType
std::optional< bool > isSticky
std::optional< bool > isFullscreen
std::optional< bool > isMinimized
std::optional< bool > isMaximized
std::optional< bool > isFocused
std::optional< bool > isTransient
 dialog/utility/popup/menu/tooltip/splash family, or has a transient parent
std::optional< bool > isNotification
 notification / critical-notification / on-screen-display surface
std::optional< int > width
 frame width in px
std::optional< int > height
 frame height in px
std::optional< bool > keepAbove
 window set to stay above others
std::optional< bool > keepBelow
 window set to stay below others
std::optional< bool > skipTaskbar
 hidden from the taskbar
std::optional< bool > skipPager
 hidden from the pager
std::optional< bool > skipSwitcher
 hidden from the window switcher
std::optional< bool > isModal
 modal dialog
std::optional< bool > hasDecoration
 has a server-side title-bar / border
std::optional< bool > isResizable
 window can be resized
std::optional< bool > isMovable
 window can be moved
std::optional< bool > isMaximizable
 window can be maximized
std::optional< int > positionX
 frame left edge X in px
std::optional< int > positionY
 frame top edge Y in px
std::optional< QString > captionNormal
 title without the WM-added app-name suffix
std::optional< bool > isFloating
 floated out of any placement engine (snapping, autotile, or scrolling)
std::optional< bool > isSnapped
 occupies a snap zone (snap mode only)
std::optional< QString > zone
 the snap zone's UUID the window occupies
std::optional< bool > isTiled
 managed by a tiling-family engine — autotile or scrolling (distinct from isSnapped)
QString screenId
int virtualDesktop = 0
 0 = all desktops
QString activity
 empty = all activities
QString mode
 placement-mode wire token — the ModeToken vocabulary in MatchTypes.h; a floating window has no mode (empty, which is not a token)
QString screenOrientation
 "portrait" / "landscape" of the resolving screen; empty = unknown (no geometry provider)
QString activeLayout
 layout id resolved for the screen (snap UUID / "autotile:<algo>" / "scrolling:"); empty where unpopulated
QString colorScheme
 "light" / "dark" system colour scheme; empty = unknown (no provider)
std::optional< int > tiledWindowCount
 Tiled-window count for the screen + desktop being resolved.
QString screenAspectRatio
 nearest common aspect ratio of the resolving screen ("16:9", "32:9", …); empty = the size is unknown
std::optional< int > screenWidth
 The resolving screen's size in DEVICE pixels (its mode, not the scaled logical size).
std::optional< int > screenHeight

Detailed Description

The evaluation input — an attribute bag matched against a MatchExpression.

Window attributes are std::optional: absent when evaluating a windowless context query (zone-assignment resolution). A predicate over an absent window field evaluates false, so a POSITIVE window-property leaf is naturally inert during context resolution — no special-casing in the evaluator. That inertness does NOT extend to negation: none{} matches when no child matched, so a NEGATED leaf over an absent field matches unconditionally. The context resolvers therefore exclude rules that negate any Window-sourced field, via MatchExpression::negatesAnyField over windowSourcedFields().

Context attributes are present even for a windowless context query, with three exceptions: tiledWindowCount, screenWidth and screenHeight are optional and absent when unknown. virtualDesktop == 0 means "all desktops" (a sticky window); empty activity means "all activities".

Member Function Documentation

◆ hasWindow()

bool PhosphorRules::WindowQuery::hasWindow ( ) const
inline

True if any window attribute is set — i.e.

this is a per-window query rather than a windowless context query.

◆ valueForField()

std::optional< QVariant > PhosphorRules::WindowQuery::valueForField ( Field field) const
inline

Resolve field to its current value.

Returns an engaged QVariant for present attributes; an empty std::optional for an absent attribute (which a predicate treats as a non-match). Context fields always resolve, except the three optional ones (tiledWindowCount, screenWidth, screenHeight) while disengaged.

Bool flags resolve to bool, numeric fields to int, the window type to its underlying int (so Equals comparisons are uniform), everything else to QString.

Member Data Documentation

◆ activeLayout

QString PhosphorRules::WindowQuery::activeLayout

layout id resolved for the screen (snap UUID / "autotile:<algo>" / "scrolling:"); empty where unpopulated

◆ activity

QString PhosphorRules::WindowQuery::activity

empty = all activities

◆ appId

std::optional<QString> PhosphorRules::WindowQuery::appId

◆ captionNormal

std::optional<QString> PhosphorRules::WindowQuery::captionNormal

title without the WM-added app-name suffix

◆ colorScheme

QString PhosphorRules::WindowQuery::colorScheme

"light" / "dark" system colour scheme; empty = unknown (no provider)

◆ desktopFile

std::optional<QString> PhosphorRules::WindowQuery::desktopFile

◆ hasDecoration

std::optional<bool> PhosphorRules::WindowQuery::hasDecoration

has a server-side title-bar / border

◆ height

std::optional<int> PhosphorRules::WindowQuery::height

frame height in px

◆ isFloating

std::optional<bool> PhosphorRules::WindowQuery::isFloating

floated out of any placement engine (snapping, autotile, or scrolling)

◆ isFocused

std::optional<bool> PhosphorRules::WindowQuery::isFocused

◆ isFullscreen

std::optional<bool> PhosphorRules::WindowQuery::isFullscreen

◆ isMaximizable

std::optional<bool> PhosphorRules::WindowQuery::isMaximizable

window can be maximized

◆ isMaximized

std::optional<bool> PhosphorRules::WindowQuery::isMaximized

◆ isMinimized

std::optional<bool> PhosphorRules::WindowQuery::isMinimized

◆ isModal

std::optional<bool> PhosphorRules::WindowQuery::isModal

modal dialog

◆ isMovable

std::optional<bool> PhosphorRules::WindowQuery::isMovable

window can be moved

◆ isNotification

std::optional<bool> PhosphorRules::WindowQuery::isNotification

notification / critical-notification / on-screen-display surface

◆ isResizable

std::optional<bool> PhosphorRules::WindowQuery::isResizable

window can be resized

◆ isSnapped

std::optional<bool> PhosphorRules::WindowQuery::isSnapped

occupies a snap zone (snap mode only)

◆ isSticky

std::optional<bool> PhosphorRules::WindowQuery::isSticky

◆ isTiled

std::optional<bool> PhosphorRules::WindowQuery::isTiled

managed by a tiling-family engine — autotile or scrolling (distinct from isSnapped)

◆ isTransient

std::optional<bool> PhosphorRules::WindowQuery::isTransient

dialog/utility/popup/menu/tooltip/splash family, or has a transient parent

◆ keepAbove

std::optional<bool> PhosphorRules::WindowQuery::keepAbove

window set to stay above others

◆ keepBelow

std::optional<bool> PhosphorRules::WindowQuery::keepBelow

window set to stay below others

◆ mode

QString PhosphorRules::WindowQuery::mode

placement-mode wire token — the ModeToken vocabulary in MatchTypes.h; a floating window has no mode (empty, which is not a token)

◆ pid

std::optional<int> PhosphorRules::WindowQuery::pid

◆ positionX

std::optional<int> PhosphorRules::WindowQuery::positionX

frame left edge X in px

◆ positionY

std::optional<int> PhosphorRules::WindowQuery::positionY

frame top edge Y in px

◆ screenAspectRatio

QString PhosphorRules::WindowQuery::screenAspectRatio

nearest common aspect ratio of the resolving screen ("16:9", "32:9", …); empty = the size is unknown

◆ screenHeight

std::optional<int> PhosphorRules::WindowQuery::screenHeight

◆ screenId

QString PhosphorRules::WindowQuery::screenId

◆ screenOrientation

QString PhosphorRules::WindowQuery::screenOrientation

"portrait" / "landscape" of the resolving screen; empty = unknown (no geometry provider)

◆ screenWidth

std::optional<int> PhosphorRules::WindowQuery::screenWidth

The resolving screen's size in DEVICE pixels (its mode, not the scaled logical size).

Optional for the same reason as tiledWindowCount: there is no width that means "unknown", so each is engaged only where a size provider answered and absent otherwise. Absence makes a POSITIVE size leaf false; a negated one inverts and matches, which is why the context resolvers refuse a rule negating a size field while the size is unknown.

◆ skipPager

std::optional<bool> PhosphorRules::WindowQuery::skipPager

hidden from the pager

◆ skipSwitcher

std::optional<bool> PhosphorRules::WindowQuery::skipSwitcher

hidden from the window switcher

◆ skipTaskbar

std::optional<bool> PhosphorRules::WindowQuery::skipTaskbar

hidden from the taskbar

◆ tiledWindowCount

std::optional<int> PhosphorRules::WindowQuery::tiledWindowCount

Tiled-window count for the screen + desktop being resolved.

Optional rather than defaulted because 0 is a meaningful value (an empty tiled desktop): engaged only when the resolver knows the count (the autotile engine supplies it for an actively-tiling context), absent otherwise so a count predicate is inert wherever the count is unknown.

◆ title

std::optional<QString> PhosphorRules::WindowQuery::title

◆ virtualDesktop

int PhosphorRules::WindowQuery::virtualDesktop = 0

0 = all desktops

◆ width

std::optional<int> PhosphorRules::WindowQuery::width

frame width in px

◆ windowClass

std::optional<QString> PhosphorRules::WindowQuery::windowClass

◆ windowRole

std::optional<QString> PhosphorRules::WindowQuery::windowRole

◆ windowType

std::optional<PhosphorProtocol::WindowType> PhosphorRules::WindowQuery::windowType

◆ zone

std::optional<QString> PhosphorRules::WindowQuery::zone

the snap zone's UUID the window occupies


The documentation for this struct was generated from the following file: