diff --git a/src/core/qmlglobal.cpp b/src/core/qmlglobal.cpp index 0aba3065..07238f61 100644 --- a/src/core/qmlglobal.cpp +++ b/src/core/qmlglobal.cpp @@ -210,10 +210,22 @@ void QuickshellGlobal::onClipboardChanged(QClipboard::Mode mode) { if (mode == QClipboard::Clipboard) emit this->clipboardTextChanged(); } -QString QuickshellGlobal::configDir() const { +QString QuickshellGlobal::shellDir() const { return EngineGeneration::findObjectGeneration(this)->rootPath.path(); } +QString QuickshellGlobal::configDir() const { + qWarning() << "Quickshell.configDir is deprecated and may be removed in a future release. Use " + "Quickshell.shellDir."; + return this->shellDir(); +} + +QString QuickshellGlobal::shellRoot() const { + qWarning() << "Quickshell.shellRoot is deprecated and may be removed in a future release. Use " + "Quickshell.shellDir."; + return this->shellDir(); +} + QString QuickshellGlobal::dataDir() const { // NOLINT return QsPaths::instance()->shellDataDir().path(); } @@ -226,8 +238,14 @@ QString QuickshellGlobal::cacheDir() const { // NOLINT return QsPaths::instance()->shellCacheDir().path(); } +QString QuickshellGlobal::shellPath(const QString& path) const { + return this->shellDir() % '/' % path; +} + QString QuickshellGlobal::configPath(const QString& path) const { - return this->configDir() % '/' % path; + qWarning() << "Quickshell.configPath() is deprecated and may be removed in a future release. Use " + "Quickshell.shellPath()."; + return this->shellPath(path); } QString QuickshellGlobal::dataPath(const QString& path) const { diff --git a/src/core/qmlglobal.hpp b/src/core/qmlglobal.hpp index d05b96d4..9d88591e 100644 --- a/src/core/qmlglobal.hpp +++ b/src/core/qmlglobal.hpp @@ -108,9 +108,11 @@ class QuickshellGlobal: public QObject { /// /// The root directory is the folder containing the entrypoint to your shell, often referred /// to as `shell.qml`. + Q_PROPERTY(QString shellDir READ shellDir CONSTANT); + /// > [!WARNING] Deprecated: Renamed to @@shellDir for clarity. Q_PROPERTY(QString configDir READ configDir CONSTANT); - /// > [!WARNING] Deprecated: Returns @@configDir. - Q_PROPERTY(QString shellRoot READ configDir CONSTANT); + /// > [!WARNING] Deprecated: Renamed to @@shellDir for consistency. + Q_PROPERTY(QString shellRoot READ shellRoot CONSTANT); /// Quickshell's working directory. Defaults to whereever quickshell was launched from. Q_PROPERTY(QString workingDirectory READ workingDirectory WRITE setWorkingDirectory NOTIFY workingDirectoryChanged); /// If true then the configuration will be reloaded whenever any files change. @@ -198,6 +200,8 @@ public: /// icon if the requested one could not be loaded. Q_INVOKABLE static QString iconPath(const QString& icon, const QString& fallback); /// Equivalent to `${Quickshell.configDir}/${path}` + Q_INVOKABLE [[nodiscard]] QString shellPath(const QString& path) const; + /// > [!WARNING] Deprecated: Renamed to @@shellPath() for clarity. Q_INVOKABLE [[nodiscard]] QString configPath(const QString& path) const; /// Equivalent to `${Quickshell.dataDir}/${path}` Q_INVOKABLE [[nodiscard]] QString dataPath(const QString& path) const; @@ -214,7 +218,9 @@ public: void clearReloadPopupInhibit() { this->mInhibitReloadPopup = false; } [[nodiscard]] bool isReloadPopupInhibited() const { return this->mInhibitReloadPopup; } + [[nodiscard]] QString shellDir() const; [[nodiscard]] QString configDir() const; + [[nodiscard]] QString shellRoot() const; [[nodiscard]] QString workingDirectory() const; void setWorkingDirectory(QString workingDirectory); diff --git a/src/services/mpris/player.cpp b/src/services/mpris/player.cpp index 116a6e9e..751a4e73 100644 --- a/src/services/mpris/player.cpp +++ b/src/services/mpris/player.cpp @@ -477,9 +477,7 @@ QString DBusDataTransform::toWire(MprisPlaybackState:: case MprisPlaybackState::Playing: return "Playing"; case MprisPlaybackState::Paused: return "Paused"; case MprisPlaybackState::Stopped: return "Stopped"; - default: - qFatal() << "Tried to convert an invalid MprisPlaybackState to String"; - return QString(); + default: qFatal() << "Tried to convert an invalid MprisPlaybackState to String"; return QString(); } } @@ -496,9 +494,7 @@ QString DBusDataTransform::toWire(MprisLoopState::Enum dat case MprisLoopState::None: return "None"; case MprisLoopState::Track: return "Track"; case MprisLoopState::Playlist: return "Playlist"; - default: - qFatal() << "Tried to convert an invalid MprisLoopState to String"; - return QString(); + default: qFatal() << "Tried to convert an invalid MprisLoopState to String"; return QString(); } }