10#include "phosphortiles_export.h"
65 std::shared_ptr<PhosphorScripting::LuauWatchdog> watchdog =
nullptr,
66 QObject* parent =
nullptr);
72 std::shared_ptr<PhosphorScripting::LuauWatchdog> watchdog, QObject* parent =
nullptr);
79 static std::shared_ptr<PhosphorScripting::LuauEngine>
93 QString
name()
const override;
131 bool loadScript(const QString&
filePath);
132 void cacheMetadataAndOverrides();
135 QVariantMap buildContext(const
TilingParams& params, const QRect& area) const;
137 QVariantMap buildStateMap(const
TilingState* state,
bool includeCountAfterRemoval) const;
152 bool m_valid = false;
153 bool m_isUserScript = false;
154 bool m_hasOnWindowAdded = false;
155 bool m_hasOnWindowRemoved = false;
156 bool m_hasOnWindowResized = false;
161 int m_cachedMasterZoneIndex = -1;
162 int m_cachedMinimumWindows = 1;
163 int m_cachedDefaultMaxWindows =
AutotileDefaults::ScriptedDefaultMaxWindows;
165 bool m_cachedSupportsMasterCount = false;
166 bool m_cachedSupportsSplitRatio = false;
167 bool m_cachedProducesOverlappingZones = false;
168 bool m_cachedOverlapFirstOnTop = false;
169 bool m_cachedCenterLayout = false;
Algorithm-layer constants for the autotile/tile primitives.
An embedded, sandboxed Luau virtual machine with a QVariant API.
Definition LuauEngine.h:40
One supervisor thread that interrupts runaway scripts across many engines.
Definition LuauWatchdog.h:38
bool supportsScriptState() const noexcept override
Whether this algorithm persists an opaque per-screen script-state bag (TilingState::scriptState) acro...
void setUserScript(bool isUser)
QVariantList customParamDefList() const override
Get custom parameter definitions as a QVariantList for QML.
bool supportsMinSizes() const noexcept override
Whether this algorithm supports per-window minimum size constraints.
~LuauTileAlgorithm() override
LuauTileAlgorithm(const QString &filePath, std::shared_ptr< PhosphorScripting::LuauEngine > sharedEngine, std::shared_ptr< PhosphorScripting::LuauWatchdog > watchdog, QObject *parent=nullptr)
Shared-engine ctor: loads this script's module into sharedEngine (an already init+prelude+sandbox'd V...
LuauTileAlgorithm(const QString &filePath, std::shared_ptr< PhosphorScripting::LuauWatchdog > watchdog=nullptr, QObject *parent=nullptr)
Owned-engine ctor: creates an isolated, per-engine-capped VM for this script.
int minimumWindows() const override
Get minimum number of windows for meaningful tiling.
static std::shared_ptr< PhosphorScripting::LuauEngine > createSandboxedEngine(std::shared_ptr< PhosphorScripting::LuauWatchdog > watchdog, QString *error=nullptr)
Build a sandboxed VM with the pluau standard library installed and frozen, ready for loadModule().
bool supportsSplitRatio() const override
Check if algorithm supports split ratio adjustment.
bool supportsCustomParams() const noexcept override
Whether this algorithm declares custom parameters.
void onWindowAdded(TilingState *state, int windowIndex) override
Called when a window is added to the tiling before retile.
bool isValid() const
Whether the script loaded and exposes a callable tile() function.
bool supportsMemory() const noexcept override
Whether this algorithm maintains persistent state across retiles.
int defaultMaxWindows() const override
Get default maximum number of windows for this algorithm.
bool supportsSingleWindow() const noexcept override
Whether this algorithm lays out the single-window case itself.
bool isScripted() const noexcept override
Whether this algorithm is a user-provided scripted algorithm.
int masterZoneIndex() const override
Get the index of the "master" zone (if applicable).
QString name() const override
Human-readable name of the algorithm.
bool supportsLifecycleHooks() const noexcept override
Whether this algorithm implements any lifecycle hooks.
qreal defaultSplitRatio() const override
Get default split ratio for this algorithm.
bool supportsMasterCount() const override
Check if algorithm supports variable master count.
bool retilesOnFocusChange() const noexcept override
Whether the layout must be recomputed when focus moves.
void onWindowRemoved(TilingState *state, int windowIndex) override
Called when a window is removed from the tiling before retile.
bool hasCustomParam(const QString &name) const override
Check if a named custom parameter is declared by this algorithm.
QString overlapStacking() const noexcept override
Stacking direction for overlap layouts.
QVector< QRect > calculateZones(const TilingParams ¶ms) const override
Calculate zone geometries for N windows.
QString id() const
Optional algorithm id declared in metadata (empty if unset).
void prepareTilingState(TilingState *state) const override
Prepare the TilingState before calculateZones() is called.
bool supportsResizeHook() const noexcept override
Whether this algorithm reacts to interactive window resizes.
QString zoneNumberDisplay() const noexcept override
How zone numbers should be displayed in previews.
bool isUserScript() const noexcept override
Whether this scripted algorithm was loaded from a user directory.
void onWindowResized(TilingState *state, const ResizeEvent &resize) override
Called when a tiled window finished an interactive resize.
bool producesOverlappingZones() const override
Whether this algorithm intentionally produces overlapping zones.
bool centerLayout() const override
Whether this algorithm uses a center layout.
QString description() const override
Description of the algorithm behavior.
TilingAlgorithm(QObject *parent=nullptr)
Tracks tiling state for a single screen.
Definition TilingState.h:40
Definition LuauEngine.h:19
Auto-tiling algorithm defaults.
Definition AutotileConstants.h:36
Definition TileScriptMetadata.h:17
Definition AutotileEngine.h:52
Describes an interactive resize that triggered a retile.
Definition TilingParams.h:51
A single node in the binary split tree.
Definition SplitTree.h:26
Parameters for zone calculation.
Definition TilingParams.h:84