forked from quickshell/quickshell
rename: QuickShell => Quickshell
This commit is contained in:
parent
307e6c05be
commit
4ae7ff8c72
2
docs
2
docs
|
@ -1 +1 @@
|
||||||
Subproject commit cc201afd3a352a28f5daddbe00d7aed974d52d30
|
Subproject commit 5aaacb9a1eea9086d6da9e21eed6e30456c6c5d6
|
|
@ -17,4 +17,4 @@ qt_add_executable(quickshell
|
||||||
panelinterface.cpp
|
panelinterface.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_add_qml_module(quickshell URI QuickShell)
|
qt_add_qml_module(quickshell URI Quickshell)
|
||||||
|
|
|
@ -52,7 +52,7 @@ QQuickItem* FloatingWindowInterface::contentItem() const { return this->window->
|
||||||
proxyPair(bool, isVisible, setVisible);
|
proxyPair(bool, isVisible, setVisible);
|
||||||
proxyPair(qint32, width, setWidth);
|
proxyPair(qint32, width, setWidth);
|
||||||
proxyPair(qint32, height, setHeight);
|
proxyPair(qint32, height, setHeight);
|
||||||
proxyPair(QuickShellScreenInfo*, screen, setScreen);
|
proxyPair(QuickshellScreenInfo*, screen, setScreen);
|
||||||
proxyPair(QColor, color, setColor);
|
proxyPair(QColor, color, setColor);
|
||||||
proxyPair(PendingRegion*, mask, setMask);
|
proxyPair(PendingRegion*, mask, setMask);
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,8 @@ public:
|
||||||
[[nodiscard]] qint32 height() const override;
|
[[nodiscard]] qint32 height() const override;
|
||||||
void setHeight(qint32 height) override;
|
void setHeight(qint32 height) override;
|
||||||
|
|
||||||
[[nodiscard]] QuickShellScreenInfo* screen() const override;
|
[[nodiscard]] QuickshellScreenInfo* screen() const override;
|
||||||
void setScreen(QuickShellScreenInfo* screen) override;
|
void setScreen(QuickshellScreenInfo* screen) override;
|
||||||
|
|
||||||
[[nodiscard]] QColor color() const override;
|
[[nodiscard]] QColor color() const override;
|
||||||
void setColor(QColor color) override;
|
void setColor(QColor color) override;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name = "QuickShell"
|
name = "Quickshell"
|
||||||
description = "Core QuickShell types"
|
description = "Core Quickshell types"
|
||||||
headers = [
|
headers = [
|
||||||
"qmlglobal.hpp",
|
"qmlglobal.hpp",
|
||||||
"qmlscreen.hpp",
|
"qmlscreen.hpp",
|
||||||
|
|
|
@ -124,7 +124,7 @@ void ProxyWindowBase::setHeight(qint32 height) {
|
||||||
} else this->window->setHeight(height);
|
} else this->window->setHeight(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProxyWindowBase::setScreen(QuickShellScreenInfo* screen) {
|
void ProxyWindowBase::setScreen(QuickshellScreenInfo* screen) {
|
||||||
if (this->mScreen != nullptr) {
|
if (this->mScreen != nullptr) {
|
||||||
QObject::disconnect(this->mScreen, nullptr, this, nullptr);
|
QObject::disconnect(this->mScreen, nullptr, this, nullptr);
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ void ProxyWindowBase::setScreen(QuickShellScreenInfo* screen) {
|
||||||
|
|
||||||
void ProxyWindowBase::onScreenDestroyed() { this->mScreen = nullptr; }
|
void ProxyWindowBase::onScreenDestroyed() { this->mScreen = nullptr; }
|
||||||
|
|
||||||
QuickShellScreenInfo* ProxyWindowBase::screen() const {
|
QuickshellScreenInfo* ProxyWindowBase::screen() const {
|
||||||
QScreen* qscreen = nullptr;
|
QScreen* qscreen = nullptr;
|
||||||
|
|
||||||
if (this->window == nullptr) {
|
if (this->window == nullptr) {
|
||||||
|
@ -149,7 +149,7 @@ QuickShellScreenInfo* ProxyWindowBase::screen() const {
|
||||||
qscreen = this->window->screen();
|
qscreen = this->window->screen();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new QuickShellScreenInfo(
|
return new QuickshellScreenInfo(
|
||||||
const_cast<ProxyWindowBase*>(this), // NOLINT
|
const_cast<ProxyWindowBase*>(this), // NOLINT
|
||||||
qscreen
|
qscreen
|
||||||
);
|
);
|
||||||
|
|
|
@ -38,7 +38,7 @@ class ProxyWindowBase: public Reloadable {
|
||||||
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged);
|
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged);
|
||||||
Q_PROPERTY(qint32 width READ width WRITE setWidth NOTIFY widthChanged);
|
Q_PROPERTY(qint32 width READ width WRITE setWidth NOTIFY widthChanged);
|
||||||
Q_PROPERTY(qint32 height READ height WRITE setHeight NOTIFY heightChanged);
|
Q_PROPERTY(qint32 height READ height WRITE setHeight NOTIFY heightChanged);
|
||||||
Q_PROPERTY(QuickShellScreenInfo* screen READ screen WRITE setScreen NOTIFY screenChanged);
|
Q_PROPERTY(QuickshellScreenInfo* screen READ screen WRITE setScreen NOTIFY screenChanged);
|
||||||
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged);
|
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged);
|
||||||
Q_PROPERTY(PendingRegion* mask READ mask WRITE setMask NOTIFY maskChanged);
|
Q_PROPERTY(PendingRegion* mask READ mask WRITE setMask NOTIFY maskChanged);
|
||||||
Q_PROPERTY(QQmlListProperty<QObject> data READ data);
|
Q_PROPERTY(QQmlListProperty<QObject> data READ data);
|
||||||
|
@ -73,8 +73,8 @@ public:
|
||||||
[[nodiscard]] virtual qint32 height() const;
|
[[nodiscard]] virtual qint32 height() const;
|
||||||
virtual void setHeight(qint32 height);
|
virtual void setHeight(qint32 height);
|
||||||
|
|
||||||
[[nodiscard]] virtual QuickShellScreenInfo* screen() const;
|
[[nodiscard]] virtual QuickshellScreenInfo* screen() const;
|
||||||
virtual void setScreen(QuickShellScreenInfo* screen);
|
virtual void setScreen(QuickshellScreenInfo* screen);
|
||||||
|
|
||||||
[[nodiscard]] QColor color() const;
|
[[nodiscard]] QColor color() const;
|
||||||
virtual void setColor(QColor color);
|
virtual void setColor(QColor color);
|
||||||
|
|
|
@ -14,40 +14,40 @@
|
||||||
#include "qmlscreen.hpp"
|
#include "qmlscreen.hpp"
|
||||||
#include "rootwrapper.hpp"
|
#include "rootwrapper.hpp"
|
||||||
|
|
||||||
QuickShellGlobal::QuickShellGlobal(QObject* parent): QObject(parent) {
|
QuickshellGlobal::QuickshellGlobal(QObject* parent): QObject(parent) {
|
||||||
auto* app = QCoreApplication::instance();
|
auto* app = QCoreApplication::instance();
|
||||||
auto* guiApp = qobject_cast<QGuiApplication*>(app);
|
auto* guiApp = qobject_cast<QGuiApplication*>(app);
|
||||||
|
|
||||||
if (guiApp != nullptr) {
|
if (guiApp != nullptr) {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
QObject::connect(guiApp, &QGuiApplication::primaryScreenChanged, this, &QuickShellGlobal::updateScreens);
|
QObject::connect(guiApp, &QGuiApplication::primaryScreenChanged, this, &QuickshellGlobal::updateScreens);
|
||||||
QObject::connect(guiApp, &QGuiApplication::screenAdded, this, &QuickShellGlobal::updateScreens);
|
QObject::connect(guiApp, &QGuiApplication::screenAdded, this, &QuickshellGlobal::updateScreens);
|
||||||
QObject::connect(guiApp, &QGuiApplication::screenRemoved, this, &QuickShellGlobal::updateScreens);
|
QObject::connect(guiApp, &QGuiApplication::screenRemoved, this, &QuickshellGlobal::updateScreens);
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
this->updateScreens();
|
this->updateScreens();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qsizetype QuickShellGlobal::screensCount(QQmlListProperty<QuickShellScreenInfo>* prop) {
|
qsizetype QuickshellGlobal::screensCount(QQmlListProperty<QuickshellScreenInfo>* prop) {
|
||||||
return static_cast<QuickShellGlobal*>(prop->object)->mScreens.size(); // NOLINT
|
return static_cast<QuickshellGlobal*>(prop->object)->mScreens.size(); // NOLINT
|
||||||
}
|
}
|
||||||
|
|
||||||
QuickShellScreenInfo*
|
QuickshellScreenInfo*
|
||||||
QuickShellGlobal::screenAt(QQmlListProperty<QuickShellScreenInfo>* prop, qsizetype i) {
|
QuickshellGlobal::screenAt(QQmlListProperty<QuickshellScreenInfo>* prop, qsizetype i) {
|
||||||
return static_cast<QuickShellGlobal*>(prop->object)->mScreens.at(i); // NOLINT
|
return static_cast<QuickshellGlobal*>(prop->object)->mScreens.at(i); // NOLINT
|
||||||
}
|
}
|
||||||
|
|
||||||
QQmlListProperty<QuickShellScreenInfo> QuickShellGlobal::screens() {
|
QQmlListProperty<QuickshellScreenInfo> QuickshellGlobal::screens() {
|
||||||
return QQmlListProperty<QuickShellScreenInfo>(
|
return QQmlListProperty<QuickshellScreenInfo>(
|
||||||
this,
|
this,
|
||||||
nullptr,
|
nullptr,
|
||||||
&QuickShellGlobal::screensCount,
|
&QuickshellGlobal::screensCount,
|
||||||
&QuickShellGlobal::screenAt
|
&QuickshellGlobal::screenAt
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickShellGlobal::reload(bool hard) {
|
void QuickshellGlobal::reload(bool hard) {
|
||||||
auto* rootobj = QQmlEngine::contextForObject(this)->engine()->parent();
|
auto* rootobj = QQmlEngine::contextForObject(this)->engine()->parent();
|
||||||
auto* root = qobject_cast<RootWrapper*>(rootobj);
|
auto* root = qobject_cast<RootWrapper*>(rootobj);
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ void QuickShellGlobal::reload(bool hard) {
|
||||||
root->reloadGraph(hard);
|
root->reloadGraph(hard);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickShellGlobal::updateScreens() {
|
void QuickshellGlobal::updateScreens() {
|
||||||
auto screens = QGuiApplication::screens();
|
auto screens = QGuiApplication::screens();
|
||||||
this->mScreens.resize(screens.size());
|
this->mScreens.resize(screens.size());
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ void QuickShellGlobal::updateScreens() {
|
||||||
this->mScreens[i]->setParent(nullptr); // delete if not owned by the js engine
|
this->mScreens[i]->setParent(nullptr); // delete if not owned by the js engine
|
||||||
}
|
}
|
||||||
|
|
||||||
this->mScreens[i] = new QuickShellScreenInfo(this, screens[i]);
|
this->mScreens[i] = new QuickshellScreenInfo(this, screens[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit this->screensChanged();
|
emit this->screensChanged();
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include "qmlscreen.hpp"
|
#include "qmlscreen.hpp"
|
||||||
|
|
||||||
class QuickShellGlobal: public QObject {
|
class QuickshellGlobal: public QObject {
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
/// All currently connected screens.
|
/// All currently connected screens.
|
||||||
///
|
///
|
||||||
|
@ -24,25 +24,25 @@ class QuickShellGlobal: public QObject {
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// // see Variants for details
|
/// // see Variants for details
|
||||||
/// variants: QuickShell.screens.map(screen => ({ screen }))
|
/// variants: Quickshell.screens.map(screen => ({ screen }))
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// This creates an instance of your window once on every screen.
|
/// This creates an instance of your window once on every screen.
|
||||||
/// As screens are added or removed your window will be created or destroyed on those screens.
|
/// As screens are added or removed your window will be created or destroyed on those screens.
|
||||||
Q_PROPERTY(QQmlListProperty<QuickShellScreenInfo> screens READ screens NOTIFY screensChanged);
|
Q_PROPERTY(QQmlListProperty<QuickshellScreenInfo> screens READ screens NOTIFY screensChanged);
|
||||||
QML_SINGLETON;
|
QML_SINGLETON;
|
||||||
QML_NAMED_ELEMENT(QuickShell);
|
QML_NAMED_ELEMENT(Quickshell);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QuickShellGlobal(QObject* parent = nullptr);
|
QuickshellGlobal(QObject* parent = nullptr);
|
||||||
|
|
||||||
QQmlListProperty<QuickShellScreenInfo> screens();
|
QQmlListProperty<QuickshellScreenInfo> screens();
|
||||||
|
|
||||||
/// Reload the shell from the [ShellRoot].
|
/// Reload the shell from the [ShellRoot].
|
||||||
///
|
///
|
||||||
/// `hard` - perform a hard reload. If this is false, QuickShell will attempt to reuse windows
|
/// `hard` - perform a hard reload. If this is false, Quickshell will attempt to reuse windows
|
||||||
/// that already exist. If true windows will be recreated.
|
/// that already exist. If true windows will be recreated.
|
||||||
///
|
///
|
||||||
/// See [Reloadable] for more information on what can be reloaded and how.
|
/// See [Reloadable] for more information on what can be reloaded and how.
|
||||||
|
@ -57,8 +57,8 @@ public slots:
|
||||||
void updateScreens();
|
void updateScreens();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static qsizetype screensCount(QQmlListProperty<QuickShellScreenInfo>* prop);
|
static qsizetype screensCount(QQmlListProperty<QuickshellScreenInfo>* prop);
|
||||||
static QuickShellScreenInfo* screenAt(QQmlListProperty<QuickShellScreenInfo>* prop, qsizetype i);
|
static QuickshellScreenInfo* screenAt(QQmlListProperty<QuickshellScreenInfo>* prop, qsizetype i);
|
||||||
|
|
||||||
QVector<QuickShellScreenInfo*> mScreens;
|
QVector<QuickshellScreenInfo*> mScreens;
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,33 +7,33 @@
|
||||||
#include <qscreen.h>
|
#include <qscreen.h>
|
||||||
#include <qtypes.h>
|
#include <qtypes.h>
|
||||||
|
|
||||||
QuickShellScreenInfo::QuickShellScreenInfo(QObject* parent, QScreen* screen)
|
QuickshellScreenInfo::QuickshellScreenInfo(QObject* parent, QScreen* screen)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, screen(screen) {
|
, screen(screen) {
|
||||||
|
|
||||||
if (this->screen != nullptr) {
|
if (this->screen != nullptr) {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
QObject::connect(this->screen, &QScreen::geometryChanged, this, &QuickShellScreenInfo::geometryChanged);
|
QObject::connect(this->screen, &QScreen::geometryChanged, this, &QuickshellScreenInfo::geometryChanged);
|
||||||
QObject::connect(this->screen, &QScreen::physicalDotsPerInchChanged, this, &QuickShellScreenInfo::physicalPixelDensityChanged);
|
QObject::connect(this->screen, &QScreen::physicalDotsPerInchChanged, this, &QuickshellScreenInfo::physicalPixelDensityChanged);
|
||||||
QObject::connect(this->screen, &QScreen::logicalDotsPerInchChanged, this, &QuickShellScreenInfo::logicalPixelDensityChanged);
|
QObject::connect(this->screen, &QScreen::logicalDotsPerInchChanged, this, &QuickshellScreenInfo::logicalPixelDensityChanged);
|
||||||
QObject::connect(this->screen, &QScreen::orientationChanged, this, &QuickShellScreenInfo::orientationChanged);
|
QObject::connect(this->screen, &QScreen::orientationChanged, this, &QuickshellScreenInfo::orientationChanged);
|
||||||
QObject::connect(this->screen, &QScreen::primaryOrientationChanged, this, &QuickShellScreenInfo::primaryOrientationChanged);
|
QObject::connect(this->screen, &QScreen::primaryOrientationChanged, this, &QuickshellScreenInfo::primaryOrientationChanged);
|
||||||
QObject::connect(this->screen, &QObject::destroyed, this, &QuickShellScreenInfo::screenDestroyed);
|
QObject::connect(this->screen, &QObject::destroyed, this, &QuickshellScreenInfo::screenDestroyed);
|
||||||
// clang-format on
|
// clang-format on
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QuickShellScreenInfo::operator==(QuickShellScreenInfo& other) const {
|
bool QuickshellScreenInfo::operator==(QuickshellScreenInfo& other) const {
|
||||||
return this->screen == other.screen;
|
return this->screen == other.screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickShellScreenInfo::warnDangling() const {
|
void QuickshellScreenInfo::warnDangling() const {
|
||||||
if (this->dangling) {
|
if (this->dangling) {
|
||||||
qWarning() << "attempted to use dangling screen object";
|
qWarning() << "attempted to use dangling screen object";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QuickShellScreenInfo::name() const {
|
QString QuickshellScreenInfo::name() const {
|
||||||
if (this->screen == nullptr) {
|
if (this->screen == nullptr) {
|
||||||
this->warnDangling();
|
this->warnDangling();
|
||||||
return "{ NULL SCREEN }";
|
return "{ NULL SCREEN }";
|
||||||
|
@ -42,7 +42,7 @@ QString QuickShellScreenInfo::name() const {
|
||||||
return this->screen->name();
|
return this->screen->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
qint32 QuickShellScreenInfo::width() const {
|
qint32 QuickshellScreenInfo::width() const {
|
||||||
if (this->screen == nullptr) {
|
if (this->screen == nullptr) {
|
||||||
this->warnDangling();
|
this->warnDangling();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -51,7 +51,7 @@ qint32 QuickShellScreenInfo::width() const {
|
||||||
return this->screen->size().width();
|
return this->screen->size().width();
|
||||||
}
|
}
|
||||||
|
|
||||||
qint32 QuickShellScreenInfo::height() const {
|
qint32 QuickshellScreenInfo::height() const {
|
||||||
if (this->screen == nullptr) {
|
if (this->screen == nullptr) {
|
||||||
this->warnDangling();
|
this->warnDangling();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -60,7 +60,7 @@ qint32 QuickShellScreenInfo::height() const {
|
||||||
return this->screen->size().height();
|
return this->screen->size().height();
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QuickShellScreenInfo::physicalPixelDensity() const {
|
qreal QuickshellScreenInfo::physicalPixelDensity() const {
|
||||||
if (this->screen == nullptr) {
|
if (this->screen == nullptr) {
|
||||||
this->warnDangling();
|
this->warnDangling();
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
@ -69,7 +69,7 @@ qreal QuickShellScreenInfo::physicalPixelDensity() const {
|
||||||
return this->screen->physicalDotsPerInch() / 25.4;
|
return this->screen->physicalDotsPerInch() / 25.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QuickShellScreenInfo::logicalPixelDensity() const {
|
qreal QuickshellScreenInfo::logicalPixelDensity() const {
|
||||||
if (this->screen == nullptr) {
|
if (this->screen == nullptr) {
|
||||||
this->warnDangling();
|
this->warnDangling();
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
@ -78,7 +78,7 @@ qreal QuickShellScreenInfo::logicalPixelDensity() const {
|
||||||
return this->screen->logicalDotsPerInch() / 25.4;
|
return this->screen->logicalDotsPerInch() / 25.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QuickShellScreenInfo::devicePixelRatio() const {
|
qreal QuickshellScreenInfo::devicePixelRatio() const {
|
||||||
if (this->screen == nullptr) {
|
if (this->screen == nullptr) {
|
||||||
this->warnDangling();
|
this->warnDangling();
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
@ -87,7 +87,7 @@ qreal QuickShellScreenInfo::devicePixelRatio() const {
|
||||||
return this->screen->devicePixelRatio();
|
return this->screen->devicePixelRatio();
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::ScreenOrientation QuickShellScreenInfo::orientation() const {
|
Qt::ScreenOrientation QuickshellScreenInfo::orientation() const {
|
||||||
if (this->screen == nullptr) {
|
if (this->screen == nullptr) {
|
||||||
this->warnDangling();
|
this->warnDangling();
|
||||||
return Qt::PrimaryOrientation;
|
return Qt::PrimaryOrientation;
|
||||||
|
@ -96,7 +96,7 @@ Qt::ScreenOrientation QuickShellScreenInfo::orientation() const {
|
||||||
return this->screen->orientation();
|
return this->screen->orientation();
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::ScreenOrientation QuickShellScreenInfo::primaryOrientation() const {
|
Qt::ScreenOrientation QuickshellScreenInfo::primaryOrientation() const {
|
||||||
if (this->screen == nullptr) {
|
if (this->screen == nullptr) {
|
||||||
this->warnDangling();
|
this->warnDangling();
|
||||||
return Qt::PrimaryOrientation;
|
return Qt::PrimaryOrientation;
|
||||||
|
@ -105,7 +105,7 @@ Qt::ScreenOrientation QuickShellScreenInfo::primaryOrientation() const {
|
||||||
return this->screen->primaryOrientation();
|
return this->screen->primaryOrientation();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickShellScreenInfo::screenDestroyed() {
|
void QuickshellScreenInfo::screenDestroyed() {
|
||||||
this->screen = nullptr;
|
this->screen = nullptr;
|
||||||
this->dangling = true;
|
this->dangling = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,10 @@
|
||||||
///
|
///
|
||||||
/// [ShellWindow]: ../shellwindow
|
/// [ShellWindow]: ../shellwindow
|
||||||
/// [Screen]: https://doc.qt.io/qt-6/qml-qtquick-screen.html
|
/// [Screen]: https://doc.qt.io/qt-6/qml-qtquick-screen.html
|
||||||
class QuickShellScreenInfo: public QObject {
|
class QuickshellScreenInfo: public QObject {
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
QML_NAMED_ELEMENT(ShellScreen);
|
QML_NAMED_ELEMENT(ShellScreen);
|
||||||
QML_UNCREATABLE("ShellScreen can only be obtained via QuickShell.screens");
|
QML_UNCREATABLE("ShellScreen can only be obtained via Quickshell.screens");
|
||||||
// clang-format off
|
// clang-format off
|
||||||
/// The name of the screen as seen by the operating system.
|
/// The name of the screen as seen by the operating system.
|
||||||
///
|
///
|
||||||
|
@ -42,9 +42,9 @@ class QuickShellScreenInfo: public QObject {
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QuickShellScreenInfo(QObject* parent, QScreen* screen); //: QObject(parent), screen(screen) {}
|
QuickshellScreenInfo(QObject* parent, QScreen* screen); //: QObject(parent), screen(screen) {}
|
||||||
|
|
||||||
bool operator==(QuickShellScreenInfo& other) const;
|
bool operator==(QuickshellScreenInfo& other) const;
|
||||||
|
|
||||||
[[nodiscard]] QString name() const;
|
[[nodiscard]] QString name() const;
|
||||||
[[nodiscard]] qint32 width() const;
|
[[nodiscard]] qint32 width() const;
|
||||||
|
|
|
@ -41,7 +41,7 @@ void RootWrapper::reloadGraph(bool hard) {
|
||||||
|
|
||||||
auto* newRoot = qobject_cast<ShellRoot*>(obj);
|
auto* newRoot = qobject_cast<ShellRoot*>(obj);
|
||||||
if (newRoot == nullptr) {
|
if (newRoot == nullptr) {
|
||||||
qWarning() << "root component was not a QuickShell.ShellRoot";
|
qWarning() << "root component was not a Quickshell.ShellRoot";
|
||||||
delete obj;
|
delete obj;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,10 +25,10 @@ public:
|
||||||
///! Creates instances of a component based on a given set of variants.
|
///! Creates instances of a component based on a given set of variants.
|
||||||
/// Creates and destroys instances of the given component when the given property changes.
|
/// Creates and destroys instances of the given component when the given property changes.
|
||||||
///
|
///
|
||||||
/// See [QuickShell.screens] for an example of using `Variants` to create copies of a window per
|
/// See [Quickshell.screens] for an example of using `Variants` to create copies of a window per
|
||||||
/// screen.
|
/// screen.
|
||||||
///
|
///
|
||||||
/// [QuickShell.screens]: ../quickshell#prop.screens
|
/// [Quickshell.screens]: ../quickshell#prop.screens
|
||||||
class Variants: public Reloadable {
|
class Variants: public Reloadable {
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
/// The component to create instances of
|
/// The component to create instances of
|
||||||
|
|
|
@ -23,7 +23,7 @@ class WindowInterface: public Reloadable {
|
||||||
/// The screen that the window currently occupies.
|
/// The screen that the window currently occupies.
|
||||||
///
|
///
|
||||||
/// > [!INFO] This cannot be changed after windowConnected.
|
/// > [!INFO] This cannot be changed after windowConnected.
|
||||||
Q_PROPERTY(QuickShellScreenInfo* screen READ screen WRITE setScreen NOTIFY screenChanged);
|
Q_PROPERTY(QuickshellScreenInfo* screen READ screen WRITE setScreen NOTIFY screenChanged);
|
||||||
/// The background color of the window. Defaults to white.
|
/// The background color of the window. Defaults to white.
|
||||||
///
|
///
|
||||||
/// > [!WARNING] This seems to behave weirdly when using transparent colors on some systems.
|
/// > [!WARNING] This seems to behave weirdly when using transparent colors on some systems.
|
||||||
|
@ -102,8 +102,8 @@ public:
|
||||||
[[nodiscard]] virtual qint32 height() const = 0;
|
[[nodiscard]] virtual qint32 height() const = 0;
|
||||||
virtual void setHeight(qint32 height) = 0;
|
virtual void setHeight(qint32 height) = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual QuickShellScreenInfo* screen() const = 0;
|
[[nodiscard]] virtual QuickshellScreenInfo* screen() const = 0;
|
||||||
virtual void setScreen(QuickShellScreenInfo* screen) = 0;
|
virtual void setScreen(QuickshellScreenInfo* screen) = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual QColor color() const = 0;
|
[[nodiscard]] virtual QColor color() const = 0;
|
||||||
virtual void setColor(QColor color) = 0;
|
virtual void setColor(QColor color) = 0;
|
||||||
|
|
|
@ -10,7 +10,7 @@ add_library(quickshell-wayland-init OBJECT init.cpp)
|
||||||
|
|
||||||
target_link_libraries(quickshell PRIVATE ${QT_DEPS} quickshell-waylandplugin quickshell-wayland-init)
|
target_link_libraries(quickshell PRIVATE ${QT_DEPS} quickshell-waylandplugin quickshell-wayland-init)
|
||||||
|
|
||||||
qt_add_qml_module(quickshell-wayland URI QuickShell.Wayland)
|
qt_add_qml_module(quickshell-wayland URI Quickshell.Wayland)
|
||||||
|
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
pkg_check_modules(wayland REQUIRED IMPORTED_TARGET wayland-client wayland-protocols)
|
pkg_check_modules(wayland REQUIRED IMPORTED_TARGET wayland-client wayland-protocols)
|
||||||
|
|
|
@ -10,15 +10,15 @@ class WaylandPlugin: public QuickshellPlugin {
|
||||||
bool applies() override { return QGuiApplication::platformName() == "wayland"; }
|
bool applies() override { return QGuiApplication::platformName() == "wayland"; }
|
||||||
|
|
||||||
void registerTypes() override {
|
void registerTypes() override {
|
||||||
qmlRegisterType<WaylandPanelInterface>("QuickShell._WaylandOverlay", 1, 0, "PanelWindow");
|
qmlRegisterType<WaylandPanelInterface>("Quickshell._WaylandOverlay", 1, 0, "PanelWindow");
|
||||||
|
|
||||||
// If any types are defined inside a module using QML_ELEMENT then all QML_ELEMENT types
|
// If any types are defined inside a module using QML_ELEMENT then all QML_ELEMENT types
|
||||||
// will not be registered. This can be worked around with a module import which makes
|
// will not be registered. This can be worked around with a module import which makes
|
||||||
// the QML_ELMENT module import the old register-type style module.
|
// the QML_ELMENT module import the old register-type style module.
|
||||||
qmlRegisterModuleImport(
|
qmlRegisterModuleImport(
|
||||||
"QuickShell",
|
"Quickshell",
|
||||||
QQmlModuleImportModuleAny,
|
QQmlModuleImportModuleAny,
|
||||||
"QuickShell._WaylandOverlay",
|
"Quickshell._WaylandOverlay",
|
||||||
QQmlModuleImportLatest
|
QQmlModuleImportLatest
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name = "QuickShell.Wayland"
|
name = "Quickshell.Wayland"
|
||||||
description = "Wayland specific QuickShell types"
|
description = "Wayland specific Quickshell types"
|
||||||
headers = [
|
headers = [
|
||||||
"layershell.hpp",
|
"layershell.hpp",
|
||||||
"waylandlayershell.hpp",
|
"waylandlayershell.hpp",
|
||||||
|
|
|
@ -79,7 +79,7 @@ void WaylandLayershell::setHeight(qint32 height) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaylandLayershell::setScreen(QuickShellScreenInfo* screen) {
|
void WaylandLayershell::setScreen(QuickshellScreenInfo* screen) {
|
||||||
this->ProxyWindowBase::setScreen(screen);
|
this->ProxyWindowBase::setScreen(screen);
|
||||||
this->ext->setUseWindowScreen(screen != nullptr);
|
this->ext->setUseWindowScreen(screen != nullptr);
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ QQuickItem* WaylandPanelInterface::contentItem() const { return this->layer->con
|
||||||
proxyPair(bool, isVisible, setVisible);
|
proxyPair(bool, isVisible, setVisible);
|
||||||
proxyPair(qint32, width, setWidth);
|
proxyPair(qint32, width, setWidth);
|
||||||
proxyPair(qint32, height, setHeight);
|
proxyPair(qint32, height, setHeight);
|
||||||
proxyPair(QuickShellScreenInfo*, screen, setScreen);
|
proxyPair(QuickshellScreenInfo*, screen, setScreen);
|
||||||
proxyPair(QColor, color, setColor);
|
proxyPair(QColor, color, setColor);
|
||||||
proxyPair(PendingRegion*, mask, setMask);
|
proxyPair(PendingRegion*, mask, setMask);
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
void setWidth(qint32 width) override;
|
void setWidth(qint32 width) override;
|
||||||
void setHeight(qint32 height) override;
|
void setHeight(qint32 height) override;
|
||||||
|
|
||||||
void setScreen(QuickShellScreenInfo* screen) override;
|
void setScreen(QuickshellScreenInfo* screen) override;
|
||||||
|
|
||||||
[[nodiscard]] Layer::Enum layer() const;
|
[[nodiscard]] Layer::Enum layer() const;
|
||||||
void setLayer(Layer::Enum layer); // NOLINT
|
void setLayer(Layer::Enum layer); // NOLINT
|
||||||
|
@ -107,8 +107,8 @@ public:
|
||||||
[[nodiscard]] qint32 height() const override;
|
[[nodiscard]] qint32 height() const override;
|
||||||
void setHeight(qint32 height) override;
|
void setHeight(qint32 height) override;
|
||||||
|
|
||||||
[[nodiscard]] QuickShellScreenInfo* screen() const override;
|
[[nodiscard]] QuickshellScreenInfo* screen() const override;
|
||||||
void setScreen(QuickShellScreenInfo* screen) override;
|
void setScreen(QuickshellScreenInfo* screen) override;
|
||||||
|
|
||||||
[[nodiscard]] QColor color() const override;
|
[[nodiscard]] QColor color() const override;
|
||||||
void setColor(QColor color) override;
|
void setColor(QColor color) override;
|
||||||
|
|
Loading…
Reference in a new issue