10#include <phosphortiles_export.h>
65 std::shared_ptr<PhosphorScripting::LuauWatchdog> watchdog =
nullptr,
66 QObject* parent =
nullptr);
71 LuauTileAlgorithm(
const QString& filePath, std::shared_ptr<PhosphorScripting::LuauEngine> sharedEngine,
72 std::shared_ptr<PhosphorScripting::LuauWatchdog> watchdog, QObject* parent =
nullptr);
79 static std::shared_ptr<PhosphorScripting::LuauEngine>
93 QString
name()
const override;
104 QString overlapStacking() const noexcept override;
105 bool supportsMemory() const noexcept override;
106 QString zoneNumberDisplay() const noexcept override;
107 bool centerLayout() const override;
108 bool supportsSingleWindow() const noexcept override;
109 bool retilesOnFocusChange() const noexcept override;
110 bool isScripted() const noexcept override;
111 bool isUserScript() const noexcept override;
115 bool supportsLifecycleHooks() const noexcept override;
117 void onWindowRemoved(
TilingState* state,
int windowIndex) override;
121 bool supportsResizeHook() const noexcept override;
123 bool supportsScriptState() const noexcept override;
126 bool supportsCustomParams() const noexcept override;
127 QVariantList customParamDefList() const override;
128 bool hasCustomParam(const 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;
158 ScriptedHelpers::ScriptMetadata m_metadata;
161 int m_cachedMasterZoneIndex = -1;
162 int m_cachedMinimumWindows = 1;
163 int m_cachedDefaultMaxWindows = AutotileDefaults::ScriptedDefaultMaxWindows;
164 qreal m_cachedDefaultSplitRatio = AutotileDefaults::DefaultSplitRatio;
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.
A tiling algorithm backed by a user-provided Luau script.
Definition LuauTileAlgorithm.h:58
void setUserScript(bool isUser)
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 isValid() const
Whether the script loaded and exposes a callable tile() function.
int defaultMaxWindows() const override
Get default maximum number of windows for this algorithm.
int masterZoneIndex() const override
Get the index of the "master" zone (if applicable)
QString name() const override
Human-readable name of the algorithm.
qreal defaultSplitRatio() const override
Get default split ratio for this algorithm.
bool supportsMasterCount() const override
Check if algorithm supports variable master count.
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).
bool producesOverlappingZones() const override
Whether this algorithm intentionally produces overlapping zones.
QString description() const override
Description of the algorithm behavior.
Abstract base class for tiling algorithms.
Definition TilingAlgorithm.h:54
Tracks tiling state for a single screen.
Definition TilingState.h:40
Definition LuauTileAlgorithm.h:17
Definition AutotileEngine.h:59
Describes an interactive resize that triggered a retile.
Definition TilingParams.h:51
Parameters for zone calculation.
Definition TilingParams.h:84