forked from quickshell/quickshell
service/tray: add activate, secondaryActivate and scroll methods
This commit is contained in:
parent
94a1140aab
commit
97bcdbecc1
|
@ -22,9 +22,7 @@ void ProxyPopupWindow::completeWindow() {
|
||||||
this->updateTransientParent();
|
this->updateTransientParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProxyPopupWindow::postCompleteWindow() {
|
void ProxyPopupWindow::postCompleteWindow() { this->ProxyWindowBase::setVisible(this->mVisible); }
|
||||||
this->ProxyWindowBase::setVisible(this->mVisible);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ProxyPopupWindow::deleteOnInvisible() const {
|
bool ProxyPopupWindow::deleteOnInvisible() const {
|
||||||
// Currently crashes in normal mode, do not have the time to debug it now.
|
// Currently crashes in normal mode, do not have the time to debug it now.
|
||||||
|
|
|
@ -153,6 +153,14 @@ QPixmap StatusNotifierItem::createPixmap(const QSize& size) const {
|
||||||
return pixmap;
|
return pixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StatusNotifierItem::activate() { this->item->Activate(0, 0); }
|
||||||
|
|
||||||
|
void StatusNotifierItem::secondaryActivate() { this->item->SecondaryActivate(0, 0); }
|
||||||
|
|
||||||
|
void StatusNotifierItem::scroll(qint32 delta, bool horizontal) {
|
||||||
|
this->item->Scroll(delta, horizontal ? "horizontal" : "vertical");
|
||||||
|
}
|
||||||
|
|
||||||
void StatusNotifierItem::updateIcon() {
|
void StatusNotifierItem::updateIcon() {
|
||||||
this->iconIndex++;
|
this->iconIndex++;
|
||||||
emit this->iconChanged();
|
emit this->iconChanged();
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <qobject.h>
|
#include <qobject.h>
|
||||||
#include <qpixmap.h>
|
#include <qpixmap.h>
|
||||||
#include <qtmetamacros.h>
|
#include <qtmetamacros.h>
|
||||||
|
#include <qtypes.h>
|
||||||
|
|
||||||
#include "../../dbus/dbusutil.hpp"
|
#include "../../dbus/dbusutil.hpp"
|
||||||
#include "dbus_item.h"
|
#include "dbus_item.h"
|
||||||
|
@ -27,6 +28,10 @@ public:
|
||||||
[[nodiscard]] QString iconId() const;
|
[[nodiscard]] QString iconId() const;
|
||||||
[[nodiscard]] QPixmap createPixmap(const QSize& size) const;
|
[[nodiscard]] QPixmap createPixmap(const QSize& size) const;
|
||||||
|
|
||||||
|
void activate();
|
||||||
|
void secondaryActivate();
|
||||||
|
void scroll(qint32 delta, bool horizontal);
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
dbus::DBusPropertyGroup properties;
|
dbus::DBusPropertyGroup properties;
|
||||||
dbus::DBusProperty<QString> id {this->properties, "Id"};
|
dbus::DBusProperty<QString> id {this->properties, "Id"};
|
||||||
|
|
|
@ -89,6 +89,14 @@ bool SystemTrayItem::onlyMenu() const {
|
||||||
return this->item->isMenu.get();
|
return this->item->isMenu.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SystemTrayItem::activate() { this->item->activate(); }
|
||||||
|
|
||||||
|
void SystemTrayItem::secondaryActivate() { this->item->secondaryActivate(); }
|
||||||
|
|
||||||
|
void SystemTrayItem::scroll(qint32 delta, bool horizontal) {
|
||||||
|
this->item->scroll(delta, horizontal);
|
||||||
|
}
|
||||||
|
|
||||||
SystemTray::SystemTray(QObject* parent): QObject(parent) {
|
SystemTray::SystemTray(QObject* parent): QObject(parent) {
|
||||||
auto* host = StatusNotifierHost::instance();
|
auto* host = StatusNotifierHost::instance();
|
||||||
|
|
||||||
|
|
|
@ -69,13 +69,13 @@ public:
|
||||||
);
|
);
|
||||||
|
|
||||||
// Primary activation action, generally triggered via a left click.
|
// Primary activation action, generally triggered via a left click.
|
||||||
//Q_INVOKABLE void activate();
|
Q_INVOKABLE void activate();
|
||||||
|
|
||||||
// Secondary activation action, generally triggered via a middle click.
|
// Secondary activation action, generally triggered via a middle click.
|
||||||
//Q_INVOKABLE void secondaryActivate();
|
Q_INVOKABLE void secondaryActivate();
|
||||||
|
|
||||||
// Scroll action, such as changing volume on a mixer.
|
// Scroll action, such as changing volume on a mixer.
|
||||||
//Q_INVOKABLE void scroll(qint32 delta, bool horizontal);
|
Q_INVOKABLE void scroll(qint32 delta, bool horizontal);
|
||||||
|
|
||||||
[[nodiscard]] QString id() const;
|
[[nodiscard]] QString id() const;
|
||||||
[[nodiscard]] QString title() const;
|
[[nodiscard]] QString title() const;
|
||||||
|
|
Loading…
Reference in a new issue