feat: add per monitor enabled prop
Enabled prop should be used in favour of general.excludedScreens. The latter has been removed
This commit is contained in:
parent
bea72b4a64
commit
41ba4f6271
7 changed files with 28 additions and 8 deletions
|
|
@ -238,6 +238,7 @@ For example, to disable the bar on DP-1:
|
|||
|
||||
```json
|
||||
{
|
||||
"enabled": true,
|
||||
"appearance": {
|
||||
"anim": {
|
||||
"durations": {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "config.hpp"
|
||||
#include "configscope.hpp"
|
||||
#include "monitorconfigmanager.hpp"
|
||||
#include "tokens.hpp"
|
||||
|
||||
#include <qqmlengine.h>
|
||||
|
|
@ -91,6 +92,10 @@ void GlobalConfig::bindAppearanceTokens() {
|
|||
m_tokensBound = true;
|
||||
}
|
||||
|
||||
GlobalConfig* GlobalConfig::forScreen(const QString& screen) {
|
||||
return MonitorConfigManager::instance()->configForScreen(screen);
|
||||
}
|
||||
|
||||
GlobalConfig* GlobalConfig::create(QQmlEngine*, QJSEngine*) {
|
||||
QQmlEngine::setObjectOwnership(instance(), QQmlEngine::CppOwnership);
|
||||
return instance();
|
||||
|
|
@ -139,6 +144,10 @@ CONFIG_ATTACHED_GETTER(UserPaths, paths)
|
|||
|
||||
#undef CONFIG_ATTACHED_GETTER
|
||||
|
||||
GlobalConfig* Config::forScreen(const QString& screen) {
|
||||
return GlobalConfig::forScreen(screen);
|
||||
}
|
||||
|
||||
Config* Config::qmlAttachedProperties(QObject* object) {
|
||||
return new Config(ConfigScope::find(object), object);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ class GlobalConfig : public RootConfig {
|
|||
QML_ELEMENT
|
||||
QML_SINGLETON
|
||||
|
||||
CONFIG_PROPERTY(bool, enabled, true)
|
||||
CONFIG_SUBOBJECT(AppearanceConfig, appearance)
|
||||
CONFIG_SUBOBJECT(GeneralConfig, general)
|
||||
CONFIG_SUBOBJECT(BackgroundConfig, background)
|
||||
|
|
@ -49,6 +50,7 @@ class GlobalConfig : public RootConfig {
|
|||
public:
|
||||
static GlobalConfig* instance();
|
||||
[[nodiscard]] Q_INVOKABLE GlobalConfig* defaults();
|
||||
[[nodiscard]] Q_INVOKABLE static GlobalConfig* forScreen(const QString& screen);
|
||||
static GlobalConfig* create(QQmlEngine*, QJSEngine*);
|
||||
|
||||
void bindAppearanceTokens();
|
||||
|
|
@ -114,6 +116,8 @@ public:
|
|||
[[nodiscard]] const ServiceConfig* services() const;
|
||||
[[nodiscard]] const UserPaths* paths() const;
|
||||
|
||||
[[nodiscard]] Q_INVOKABLE static GlobalConfig* forScreen(const QString& screen);
|
||||
|
||||
static Config* qmlAttachedProperties(QObject* object);
|
||||
|
||||
signals:
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ class GeneralConfig : public ConfigObject {
|
|||
QML_ANONYMOUS
|
||||
|
||||
CONFIG_PROPERTY(QString, logo)
|
||||
CONFIG_PROPERTY(QStringList, excludedScreens)
|
||||
CONFIG_PROPERTY(qreal, mediaGifSpeedAdjustment, 300)
|
||||
CONFIG_PROPERTY(qreal, sessionGifSpeed, 0.7)
|
||||
CONFIG_SUBOBJECT(GeneralApps, apps)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "tokens.hpp"
|
||||
#include "config.hpp"
|
||||
#include "configscope.hpp"
|
||||
#include "monitorconfigmanager.hpp"
|
||||
|
||||
#include <qqmlengine.h>
|
||||
#include <qstandardpaths.h>
|
||||
|
|
@ -43,6 +44,10 @@ TokenConfig* TokenConfig::defaults() {
|
|||
return m_defaults;
|
||||
}
|
||||
|
||||
TokenConfig* TokenConfig::forScreen(const QString& screen) {
|
||||
return MonitorConfigManager::instance()->tokensForScreen(screen);
|
||||
}
|
||||
|
||||
TokenConfig* TokenConfig::create(QQmlEngine*, QJSEngine*) {
|
||||
QQmlEngine::setObjectOwnership(instance(), QQmlEngine::CppOwnership);
|
||||
return instance();
|
||||
|
|
@ -119,6 +124,10 @@ const SizeTokens* Tokens::sizes() const {
|
|||
return global ? global->sizes() : nullptr;
|
||||
}
|
||||
|
||||
TokenConfig* Tokens::forScreen(const QString& screen) {
|
||||
return TokenConfig::forScreen(screen);
|
||||
}
|
||||
|
||||
Tokens* Tokens::qmlAttachedProperties(QObject* object) {
|
||||
return new Tokens(ConfigScope::find(object), object);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -330,6 +330,7 @@ class TokenConfig : public RootConfig {
|
|||
public:
|
||||
static TokenConfig* instance();
|
||||
[[nodiscard]] Q_INVOKABLE TokenConfig* defaults();
|
||||
[[nodiscard]] Q_INVOKABLE static TokenConfig* forScreen(const QString& screen);
|
||||
static TokenConfig* create(QQmlEngine*, QJSEngine*);
|
||||
|
||||
private:
|
||||
|
|
@ -369,6 +370,8 @@ public:
|
|||
|
||||
[[nodiscard]] const AnimTokens* anim() const { return m_anim; }
|
||||
|
||||
[[nodiscard]] Q_INVOKABLE static TokenConfig* forScreen(const QString& screen);
|
||||
|
||||
static Tokens* qmlAttachedProperties(QObject* object);
|
||||
|
||||
signals:
|
||||
|
|
|
|||
|
|
@ -7,14 +7,9 @@ import qs.utils
|
|||
Singleton {
|
||||
id: root
|
||||
|
||||
readonly property list<ShellScreen> screens: {
|
||||
const excluded = Config.general.excludedScreens;
|
||||
if (excluded.length === 0)
|
||||
return Quickshell.screens;
|
||||
return Quickshell.screens.filter(s => !Strings.testRegexList(excluded, s.name));
|
||||
}
|
||||
readonly property list<ShellScreen> screens: Quickshell.screens.filter(s => GlobalConfig.forScreen(s.name).enabled)
|
||||
|
||||
function isExcluded(screen: ShellScreen): bool {
|
||||
return Strings.testRegexList(Config.general.excludedScreens, screen.name);
|
||||
return !GlobalConfig.forScreen(screen.name).enabled;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue