forked from quickshell/quickshell
		
	service/tray: add activate, secondaryActivate and scroll methods
This commit is contained in:
		
							parent
							
								
									94a1140aab
								
							
						
					
					
						commit
						97bcdbecc1
					
				
					 5 changed files with 25 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -22,9 +22,7 @@ void ProxyPopupWindow::completeWindow() {
 | 
			
		|||
	this->updateTransientParent();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ProxyPopupWindow::postCompleteWindow() {
 | 
			
		||||
	this->ProxyWindowBase::setVisible(this->mVisible);
 | 
			
		||||
}
 | 
			
		||||
void ProxyPopupWindow::postCompleteWindow() { this->ProxyWindowBase::setVisible(this->mVisible); }
 | 
			
		||||
 | 
			
		||||
bool ProxyPopupWindow::deleteOnInvisible() const {
 | 
			
		||||
	// 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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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() {
 | 
			
		||||
	this->iconIndex++;
 | 
			
		||||
	emit this->iconChanged();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,6 +7,7 @@
 | 
			
		|||
#include <qobject.h>
 | 
			
		||||
#include <qpixmap.h>
 | 
			
		||||
#include <qtmetamacros.h>
 | 
			
		||||
#include <qtypes.h>
 | 
			
		||||
 | 
			
		||||
#include "../../dbus/dbusutil.hpp"
 | 
			
		||||
#include "dbus_item.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -27,6 +28,10 @@ public:
 | 
			
		|||
	[[nodiscard]] QString iconId() const;
 | 
			
		||||
	[[nodiscard]] QPixmap createPixmap(const QSize& size) const;
 | 
			
		||||
 | 
			
		||||
	void activate();
 | 
			
		||||
	void secondaryActivate();
 | 
			
		||||
	void scroll(qint32 delta, bool horizontal);
 | 
			
		||||
 | 
			
		||||
	// clang-format off
 | 
			
		||||
	dbus::DBusPropertyGroup properties;
 | 
			
		||||
	dbus::DBusProperty<QString> id {this->properties, "Id"};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -89,6 +89,14 @@ bool SystemTrayItem::onlyMenu() const {
 | 
			
		|||
	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) {
 | 
			
		||||
	auto* host = StatusNotifierHost::instance();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -69,13 +69,13 @@ public:
 | 
			
		|||
	);
 | 
			
		||||
 | 
			
		||||
	// 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.
 | 
			
		||||
	//Q_INVOKABLE void secondaryActivate();
 | 
			
		||||
	Q_INVOKABLE void secondaryActivate();
 | 
			
		||||
 | 
			
		||||
	// 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 title() const;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue