swaymux/Keys/ToggleDetailsKeyListener.h

35 lines
898 B
C
Raw Normal View History

2024-03-12 11:48:43 +01:00
//
// Created by grimmauld on 12.03.24.
//
#ifndef SWAYMUX_TOGGLEDETAILSKEYLISTENER_H
#define SWAYMUX_TOGGLEDETAILSKEYLISTENER_H
#include "MainWindowAwareKeyListener.h"
class ToggleDetailsKeyListener : public MainWindowAwareKeyListener {
public:
explicit ToggleDetailsKeyListener(MainWindow *pWindow) : MainWindowAwareKeyListener(pWindow) {}
void handleKeyEvent(const QKeyEvent *keyEvent) const override {
if (window->ui->windowDetails->isHidden())
window->ui->windowDetails->show();
else
window->ui->windowDetails->hide();
}
std::string getDescription() override {
return "toggle window detail view";
}
std::string getKeyText() override {
return "Tab";
}
[[nodiscard]] bool canAcceptKey(int key) const override {
return key == Qt::Key_Tab;
}
};
#endif //SWAYMUX_TOGGLEDETAILSKEYLISTENER_H