forked from quickshell/quickshell
core/qmlglobal!: rename shellRoot to configDir + add configPath
This commit is contained in:
parent
71fe3d9165
commit
0140356d99
2 changed files with 12 additions and 8 deletions
|
@ -177,12 +177,6 @@ void QuickshellGlobal::reload(bool hard) {
|
||||||
root->reloadGraph(hard);
|
root->reloadGraph(hard);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QuickshellGlobal::shellRoot() const {
|
|
||||||
auto* generation = EngineGeneration::findObjectGeneration(this);
|
|
||||||
// already canonical
|
|
||||||
return generation->rootPath.path();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QuickshellGlobal::workingDirectory() const { // NOLINT
|
QString QuickshellGlobal::workingDirectory() const { // NOLINT
|
||||||
return QuickshellSettings::instance()->workingDirectory();
|
return QuickshellSettings::instance()->workingDirectory();
|
||||||
}
|
}
|
||||||
|
@ -213,6 +207,10 @@ void QuickshellGlobal::onClipboardChanged(QClipboard::Mode mode) {
|
||||||
if (mode == QClipboard::Clipboard) emit this->clipboardTextChanged();
|
if (mode == QClipboard::Clipboard) emit this->clipboardTextChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString QuickshellGlobal::configDir() const {
|
||||||
|
return EngineGeneration::findObjectGeneration(this)->rootPath.path();
|
||||||
|
}
|
||||||
|
|
||||||
QString QuickshellGlobal::dataDir() const { // NOLINT
|
QString QuickshellGlobal::dataDir() const { // NOLINT
|
||||||
return QsPaths::instance()->shellDataDir().path();
|
return QsPaths::instance()->shellDataDir().path();
|
||||||
}
|
}
|
||||||
|
@ -225,6 +223,10 @@ QString QuickshellGlobal::cacheDir() const { // NOLINT
|
||||||
return QsPaths::instance()->shellCacheDir().path();
|
return QsPaths::instance()->shellCacheDir().path();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString QuickshellGlobal::configPath(const QString& path) const {
|
||||||
|
return this->configDir() % '/' % path;
|
||||||
|
}
|
||||||
|
|
||||||
QString QuickshellGlobal::dataPath(const QString& path) const {
|
QString QuickshellGlobal::dataPath(const QString& path) const {
|
||||||
return this->dataDir() % '/' % path;
|
return this->dataDir() % '/' % path;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ class QuickshellGlobal: public QObject {
|
||||||
///
|
///
|
||||||
/// The root directory is the folder containing the entrypoint to your shell, often referred
|
/// The root directory is the folder containing the entrypoint to your shell, often referred
|
||||||
/// to as `shell.qml`.
|
/// to as `shell.qml`.
|
||||||
Q_PROPERTY(QString shellRoot READ shellRoot CONSTANT);
|
Q_PROPERTY(QString configDir READ configDir CONSTANT);
|
||||||
/// Quickshell's working directory. Defaults to whereever quickshell was launched from.
|
/// Quickshell's working directory. Defaults to whereever quickshell was launched from.
|
||||||
Q_PROPERTY(QString workingDirectory READ workingDirectory WRITE setWorkingDirectory NOTIFY workingDirectoryChanged);
|
Q_PROPERTY(QString workingDirectory READ workingDirectory WRITE setWorkingDirectory NOTIFY workingDirectoryChanged);
|
||||||
/// If true then the configuration will be reloaded whenever any files change.
|
/// If true then the configuration will be reloaded whenever any files change.
|
||||||
|
@ -167,6 +167,8 @@ public:
|
||||||
/// Setting the `fallback` parameter of `iconPath` will attempt to load the fallback
|
/// Setting the `fallback` parameter of `iconPath` will attempt to load the fallback
|
||||||
/// icon if the requested one could not be loaded.
|
/// icon if the requested one could not be loaded.
|
||||||
Q_INVOKABLE static QString iconPath(const QString& icon, const QString& fallback);
|
Q_INVOKABLE static QString iconPath(const QString& icon, const QString& fallback);
|
||||||
|
/// Equivalent to `${Quickshell.configDir}/${path}`
|
||||||
|
Q_INVOKABLE [[nodiscard]] QString configPath(const QString& path) const;
|
||||||
/// Equivalent to `${Quickshell.dataDir}/${path}`
|
/// Equivalent to `${Quickshell.dataDir}/${path}`
|
||||||
Q_INVOKABLE [[nodiscard]] QString dataPath(const QString& path) const;
|
Q_INVOKABLE [[nodiscard]] QString dataPath(const QString& path) const;
|
||||||
/// Equivalent to `${Quickshell.stateDir}/${path}`
|
/// Equivalent to `${Quickshell.stateDir}/${path}`
|
||||||
|
@ -182,7 +184,7 @@ public:
|
||||||
void clearReloadPopupInhibit() { this->mInhibitReloadPopup = false; }
|
void clearReloadPopupInhibit() { this->mInhibitReloadPopup = false; }
|
||||||
[[nodiscard]] bool isReloadPopupInhibited() const { return this->mInhibitReloadPopup; }
|
[[nodiscard]] bool isReloadPopupInhibited() const { return this->mInhibitReloadPopup; }
|
||||||
|
|
||||||
[[nodiscard]] QString shellRoot() const;
|
[[nodiscard]] QString configDir() const;
|
||||||
|
|
||||||
[[nodiscard]] QString workingDirectory() const;
|
[[nodiscard]] QString workingDirectory() const;
|
||||||
void setWorkingDirectory(QString workingDirectory);
|
void setWorkingDirectory(QString workingDirectory);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue