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
|
```json
|
||||||
{
|
{
|
||||||
|
"enabled": true,
|
||||||
"appearance": {
|
"appearance": {
|
||||||
"anim": {
|
"anim": {
|
||||||
"durations": {
|
"durations": {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "configscope.hpp"
|
#include "configscope.hpp"
|
||||||
|
#include "monitorconfigmanager.hpp"
|
||||||
#include "tokens.hpp"
|
#include "tokens.hpp"
|
||||||
|
|
||||||
#include <qqmlengine.h>
|
#include <qqmlengine.h>
|
||||||
|
|
@ -91,6 +92,10 @@ void GlobalConfig::bindAppearanceTokens() {
|
||||||
m_tokensBound = true;
|
m_tokensBound = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GlobalConfig* GlobalConfig::forScreen(const QString& screen) {
|
||||||
|
return MonitorConfigManager::instance()->configForScreen(screen);
|
||||||
|
}
|
||||||
|
|
||||||
GlobalConfig* GlobalConfig::create(QQmlEngine*, QJSEngine*) {
|
GlobalConfig* GlobalConfig::create(QQmlEngine*, QJSEngine*) {
|
||||||
QQmlEngine::setObjectOwnership(instance(), QQmlEngine::CppOwnership);
|
QQmlEngine::setObjectOwnership(instance(), QQmlEngine::CppOwnership);
|
||||||
return instance();
|
return instance();
|
||||||
|
|
@ -139,6 +144,10 @@ CONFIG_ATTACHED_GETTER(UserPaths, paths)
|
||||||
|
|
||||||
#undef CONFIG_ATTACHED_GETTER
|
#undef CONFIG_ATTACHED_GETTER
|
||||||
|
|
||||||
|
GlobalConfig* Config::forScreen(const QString& screen) {
|
||||||
|
return GlobalConfig::forScreen(screen);
|
||||||
|
}
|
||||||
|
|
||||||
Config* Config::qmlAttachedProperties(QObject* object) {
|
Config* Config::qmlAttachedProperties(QObject* object) {
|
||||||
return new Config(ConfigScope::find(object), object);
|
return new Config(ConfigScope::find(object), object);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ class GlobalConfig : public RootConfig {
|
||||||
QML_ELEMENT
|
QML_ELEMENT
|
||||||
QML_SINGLETON
|
QML_SINGLETON
|
||||||
|
|
||||||
|
CONFIG_PROPERTY(bool, enabled, true)
|
||||||
CONFIG_SUBOBJECT(AppearanceConfig, appearance)
|
CONFIG_SUBOBJECT(AppearanceConfig, appearance)
|
||||||
CONFIG_SUBOBJECT(GeneralConfig, general)
|
CONFIG_SUBOBJECT(GeneralConfig, general)
|
||||||
CONFIG_SUBOBJECT(BackgroundConfig, background)
|
CONFIG_SUBOBJECT(BackgroundConfig, background)
|
||||||
|
|
@ -49,6 +50,7 @@ class GlobalConfig : public RootConfig {
|
||||||
public:
|
public:
|
||||||
static GlobalConfig* instance();
|
static GlobalConfig* instance();
|
||||||
[[nodiscard]] Q_INVOKABLE GlobalConfig* defaults();
|
[[nodiscard]] Q_INVOKABLE GlobalConfig* defaults();
|
||||||
|
[[nodiscard]] Q_INVOKABLE static GlobalConfig* forScreen(const QString& screen);
|
||||||
static GlobalConfig* create(QQmlEngine*, QJSEngine*);
|
static GlobalConfig* create(QQmlEngine*, QJSEngine*);
|
||||||
|
|
||||||
void bindAppearanceTokens();
|
void bindAppearanceTokens();
|
||||||
|
|
@ -114,6 +116,8 @@ public:
|
||||||
[[nodiscard]] const ServiceConfig* services() const;
|
[[nodiscard]] const ServiceConfig* services() const;
|
||||||
[[nodiscard]] const UserPaths* paths() const;
|
[[nodiscard]] const UserPaths* paths() const;
|
||||||
|
|
||||||
|
[[nodiscard]] Q_INVOKABLE static GlobalConfig* forScreen(const QString& screen);
|
||||||
|
|
||||||
static Config* qmlAttachedProperties(QObject* object);
|
static Config* qmlAttachedProperties(QObject* object);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,6 @@ class GeneralConfig : public ConfigObject {
|
||||||
QML_ANONYMOUS
|
QML_ANONYMOUS
|
||||||
|
|
||||||
CONFIG_PROPERTY(QString, logo)
|
CONFIG_PROPERTY(QString, logo)
|
||||||
CONFIG_PROPERTY(QStringList, excludedScreens)
|
|
||||||
CONFIG_PROPERTY(qreal, mediaGifSpeedAdjustment, 300)
|
CONFIG_PROPERTY(qreal, mediaGifSpeedAdjustment, 300)
|
||||||
CONFIG_PROPERTY(qreal, sessionGifSpeed, 0.7)
|
CONFIG_PROPERTY(qreal, sessionGifSpeed, 0.7)
|
||||||
CONFIG_SUBOBJECT(GeneralApps, apps)
|
CONFIG_SUBOBJECT(GeneralApps, apps)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include "tokens.hpp"
|
#include "tokens.hpp"
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "configscope.hpp"
|
#include "configscope.hpp"
|
||||||
|
#include "monitorconfigmanager.hpp"
|
||||||
|
|
||||||
#include <qqmlengine.h>
|
#include <qqmlengine.h>
|
||||||
#include <qstandardpaths.h>
|
#include <qstandardpaths.h>
|
||||||
|
|
@ -43,6 +44,10 @@ TokenConfig* TokenConfig::defaults() {
|
||||||
return m_defaults;
|
return m_defaults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TokenConfig* TokenConfig::forScreen(const QString& screen) {
|
||||||
|
return MonitorConfigManager::instance()->tokensForScreen(screen);
|
||||||
|
}
|
||||||
|
|
||||||
TokenConfig* TokenConfig::create(QQmlEngine*, QJSEngine*) {
|
TokenConfig* TokenConfig::create(QQmlEngine*, QJSEngine*) {
|
||||||
QQmlEngine::setObjectOwnership(instance(), QQmlEngine::CppOwnership);
|
QQmlEngine::setObjectOwnership(instance(), QQmlEngine::CppOwnership);
|
||||||
return instance();
|
return instance();
|
||||||
|
|
@ -119,6 +124,10 @@ const SizeTokens* Tokens::sizes() const {
|
||||||
return global ? global->sizes() : nullptr;
|
return global ? global->sizes() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TokenConfig* Tokens::forScreen(const QString& screen) {
|
||||||
|
return TokenConfig::forScreen(screen);
|
||||||
|
}
|
||||||
|
|
||||||
Tokens* Tokens::qmlAttachedProperties(QObject* object) {
|
Tokens* Tokens::qmlAttachedProperties(QObject* object) {
|
||||||
return new Tokens(ConfigScope::find(object), object);
|
return new Tokens(ConfigScope::find(object), object);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -330,6 +330,7 @@ class TokenConfig : public RootConfig {
|
||||||
public:
|
public:
|
||||||
static TokenConfig* instance();
|
static TokenConfig* instance();
|
||||||
[[nodiscard]] Q_INVOKABLE TokenConfig* defaults();
|
[[nodiscard]] Q_INVOKABLE TokenConfig* defaults();
|
||||||
|
[[nodiscard]] Q_INVOKABLE static TokenConfig* forScreen(const QString& screen);
|
||||||
static TokenConfig* create(QQmlEngine*, QJSEngine*);
|
static TokenConfig* create(QQmlEngine*, QJSEngine*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -369,6 +370,8 @@ public:
|
||||||
|
|
||||||
[[nodiscard]] const AnimTokens* anim() const { return m_anim; }
|
[[nodiscard]] const AnimTokens* anim() const { return m_anim; }
|
||||||
|
|
||||||
|
[[nodiscard]] Q_INVOKABLE static TokenConfig* forScreen(const QString& screen);
|
||||||
|
|
||||||
static Tokens* qmlAttachedProperties(QObject* object);
|
static Tokens* qmlAttachedProperties(QObject* object);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,9 @@ import qs.utils
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property list<ShellScreen> screens: {
|
readonly property list<ShellScreen> screens: Quickshell.screens.filter(s => GlobalConfig.forScreen(s.name).enabled)
|
||||||
const excluded = Config.general.excludedScreens;
|
|
||||||
if (excluded.length === 0)
|
|
||||||
return Quickshell.screens;
|
|
||||||
return Quickshell.screens.filter(s => !Strings.testRegexList(excluded, s.name));
|
|
||||||
}
|
|
||||||
|
|
||||||
function isExcluded(screen: ShellScreen): bool {
|
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