9#include <phosphortiles_export.h>
64 std::shared_ptr<PhosphorScripting::LuauWatchdog> watchdog =
nullptr,
65 QObject* parent =
nullptr);
70 LuauTileAlgorithm(
const QString& filePath, std::shared_ptr<PhosphorScripting::LuauEngine> sharedEngine,
71 std::shared_ptr<PhosphorScripting::LuauWatchdog> watchdog, QObject* parent =
nullptr);
78 static std::shared_ptr<PhosphorScripting::LuauEngine>
92 QString
name()
const override;
103 bool supportsMemory() const noexcept override;
104 QString zoneNumberDisplay() const noexcept override;
105 bool centerLayout() const override;
106 bool isScripted() const noexcept override;
107 bool isUserScript() const noexcept override;
111 bool supportsLifecycleHooks() const noexcept override;
113 void onWindowRemoved(
TilingState* state,
int windowIndex) override;
117 bool supportsResizeHook() const noexcept override;
119 bool supportsScriptState() const noexcept override;
122 bool supportsCustomParams() const noexcept override;
123 QVariantList customParamDefList() const override;
124 bool hasCustomParam(const QString& name) const override;
127 bool loadScript(const QString& filePath);
128 void cacheMetadataAndOverrides();
131 QVariantMap buildContext(const
TilingParams& params, const QRect& area) const;
133 QVariantMap buildStateMap(const
TilingState* state,
bool includeCountAfterRemoval) const;
148 bool m_valid = false;
149 bool m_isUserScript = false;
150 bool m_hasOnWindowAdded = false;
151 bool m_hasOnWindowRemoved = false;
152 bool m_hasOnWindowResized = false;
154 ScriptedHelpers::ScriptMetadata m_metadata;
157 int m_cachedMasterZoneIndex = -1;
158 int m_cachedMinimumWindows = 1;
159 int m_cachedDefaultMaxWindows = 6;
160 qreal m_cachedDefaultSplitRatio = AutotileDefaults::DefaultSplitRatio;
161 bool m_cachedSupportsMasterCount = false;
162 bool m_cachedSupportsSplitRatio = false;
163 bool m_cachedProducesOverlappingZones = false;
164 bool m_cachedCenterLayout = false;
A tiling algorithm backed by a user-provided Luau script.
Definition LuauTileAlgorithm.h:57
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:51
Tracks tiling state for a single screen.
Definition TilingState.h:40
Definition LuauTileAlgorithm.h:16
Definition AutotileEngine.h:46
Describes an interactive resize that triggered a retile.
Definition TilingParams.h:51
Parameters for zone calculation.
Definition TilingParams.h:84