File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ QString QsPaths::ipcPath(const QString& id) {
5151QDir* QsPaths::cacheDir () {
5252 if (this ->cacheState == DirState::Unknown) {
5353 auto dir = QDir (QStandardPaths::writableLocation (QStandardPaths::CacheLocation));
54+ dir = QDir (dir.filePath (" by-shell" ));
5455 dir = QDir (dir.filePath (this ->shellId ));
5556 this ->mCacheDir = dir;
5657
Original file line number Diff line number Diff line change 2121
2222#include " generation.hpp"
2323#include " iconimageprovider.hpp"
24+ #include " paths.hpp"
2425#include " qmlscreen.hpp"
2526#include " rootwrapper.hpp"
2627
@@ -189,6 +190,14 @@ void QuickshellGlobal::setWatchFiles(bool watchFiles) { // NOLINT
189190 QuickshellSettings::instance ()->setWatchFiles (watchFiles);
190191}
191192
193+ QString QuickshellGlobal::cacheDir () const { // NOLINT
194+ auto * dir = QsPaths::instance ()->cacheDir ();
195+ if (dir) return dir->path ();
196+
197+ qCritical () << " Could not find cache dir." ;
198+ return " /quickshell-cache-not-found" ;
199+ }
200+
192201QVariant QuickshellGlobal::env (const QString& variable) { // NOLINT
193202 auto vstr = variable.toStdString ();
194203 if (!qEnvironmentVariableIsSet (vstr.data ())) return QVariant::fromValue (nullptr );
Original file line number Diff line number Diff line change @@ -108,6 +108,10 @@ class QuickshellGlobal: public QObject {
108108 // / If true then the configuration will be reloaded whenever any files change.
109109 // / Defaults to true.
110110 Q_PROPERTY (bool watchFiles READ watchFiles WRITE setWatchFiles NOTIFY watchFilesChanged);
111+ // / The per-shell cache directory.
112+ // /
113+ // / Usually `~/.cache/quickshell/by-shell/<shell-id>`
114+ Q_PROPERTY (QString cacheDir READ cacheDir CONSTANT);
111115 // clang-format on
112116 QML_SINGLETON;
113117 QML_NAMED_ELEMENT (Quickshell);
@@ -152,6 +156,8 @@ class QuickshellGlobal: public QObject {
152156 [[nodiscard]] bool watchFiles () const ;
153157 void setWatchFiles (bool watchFiles);
154158
159+ [[nodiscard]] QString cacheDir () const ;
160+
155161 static QuickshellGlobal* create (QQmlEngine* engine, QJSEngine* /* unused*/ );
156162
157163signals:
You can’t perform that action at this time.
0 commit comments