Skip to content

Commit 0140356

Browse files
committed
core/qmlglobal!: rename shellRoot to configDir + add configPath
1 parent 71fe3d9 commit 0140356

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/core/qmlglobal.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,6 @@ void QuickshellGlobal::reload(bool hard) {
177177
root->reloadGraph(hard);
178178
}
179179

180-
QString QuickshellGlobal::shellRoot() const {
181-
auto* generation = EngineGeneration::findObjectGeneration(this);
182-
// already canonical
183-
return generation->rootPath.path();
184-
}
185-
186180
QString QuickshellGlobal::workingDirectory() const { // NOLINT
187181
return QuickshellSettings::instance()->workingDirectory();
188182
}
@@ -213,6 +207,10 @@ void QuickshellGlobal::onClipboardChanged(QClipboard::Mode mode) {
213207
if (mode == QClipboard::Clipboard) emit this->clipboardTextChanged();
214208
}
215209

210+
QString QuickshellGlobal::configDir() const {
211+
return EngineGeneration::findObjectGeneration(this)->rootPath.path();
212+
}
213+
216214
QString QuickshellGlobal::dataDir() const { // NOLINT
217215
return QsPaths::instance()->shellDataDir().path();
218216
}
@@ -225,6 +223,10 @@ QString QuickshellGlobal::cacheDir() const { // NOLINT
225223
return QsPaths::instance()->shellCacheDir().path();
226224
}
227225

226+
QString QuickshellGlobal::configPath(const QString& path) const {
227+
return this->configDir() % '/' % path;
228+
}
229+
228230
QString QuickshellGlobal::dataPath(const QString& path) const {
229231
return this->dataDir() % '/' % path;
230232
}

src/core/qmlglobal.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class QuickshellGlobal: public QObject {
104104
///
105105
/// The root directory is the folder containing the entrypoint to your shell, often referred
106106
/// to as `shell.qml`.
107-
Q_PROPERTY(QString shellRoot READ shellRoot CONSTANT);
107+
Q_PROPERTY(QString configDir READ configDir CONSTANT);
108108
/// Quickshell's working directory. Defaults to whereever quickshell was launched from.
109109
Q_PROPERTY(QString workingDirectory READ workingDirectory WRITE setWorkingDirectory NOTIFY workingDirectoryChanged);
110110
/// If true then the configuration will be reloaded whenever any files change.
@@ -167,6 +167,8 @@ class QuickshellGlobal: public QObject {
167167
/// Setting the `fallback` parameter of `iconPath` will attempt to load the fallback
168168
/// icon if the requested one could not be loaded.
169169
Q_INVOKABLE static QString iconPath(const QString& icon, const QString& fallback);
170+
/// Equivalent to `${Quickshell.configDir}/${path}`
171+
Q_INVOKABLE [[nodiscard]] QString configPath(const QString& path) const;
170172
/// Equivalent to `${Quickshell.dataDir}/${path}`
171173
Q_INVOKABLE [[nodiscard]] QString dataPath(const QString& path) const;
172174
/// Equivalent to `${Quickshell.stateDir}/${path}`
@@ -182,7 +184,7 @@ class QuickshellGlobal: public QObject {
182184
void clearReloadPopupInhibit() { this->mInhibitReloadPopup = false; }
183185
[[nodiscard]] bool isReloadPopupInhibited() const { return this->mInhibitReloadPopup; }
184186

185-
[[nodiscard]] QString shellRoot() const;
187+
[[nodiscard]] QString configDir() const;
186188

187189
[[nodiscard]] QString workingDirectory() const;
188190
void setWorkingDirectory(QString workingDirectory);

0 commit comments

Comments
 (0)