swaymux/Keys/PrevOutputKeyListener.h

39 lines
1.0 KiB
C
Raw Normal View History

//
// Created by grimmauld on 09.03.24.
//
#ifndef SWAYMUX_PREVOUTPUTKEYLISTENER_H
#define SWAYMUX_PREVOUTPUTKEYLISTENER_H
#include <QTreeView>
#include <iostream>
#include <QGuiApplication>
#include "AbstractKeyListener.h"
#include "../tree/SwayTreeModel.h"
#include "../sway_bindings/swayoutputs.h"
#include "JumpOutputKeyListener.h"
class PrevOutputKeyListener : public JumpOutputKeyListener {
public:
explicit PrevOutputKeyListener(SwayTreeModel *swayTreeModel, QTreeView *treeView) : JumpOutputKeyListener(
swayTreeModel, treeView) {};
std::string getDescription() override {
return "Jump focus to output above";
}
std::string getKeyText() override {
return "Page Up";
}
[[nodiscard]] bool canAcceptKey(int key) const override {
return key == Qt::Key_PageUp;
}
int getOffset(const SwayTreeNode *selected) const override {
return selected != nullptr && selected->node.type != NodeType::output ? 0 : -1;
}
};
#endif //SWAYMUX_PREVOUTPUTKEYLISTENER_H