mirror of
https://github.com/hyprwm/xdg-desktop-portal-hyprland.git
synced 2024-11-22 06:35:57 +01:00
fix shell tab behavior in headers
This commit is contained in:
parent
a0fa7909cd
commit
8707444cf5
2 changed files with 24 additions and 31 deletions
|
@ -1,23 +1,22 @@
|
||||||
#include "mainpicker.h"
|
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QScreen>
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QTabWidget>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QtWidgets>
|
|
||||||
#include <QtDebug>
|
|
||||||
#include <QObject>
|
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <string>
|
#include <QObject>
|
||||||
#include <iostream>
|
#include <QPushButton>
|
||||||
|
#include <QScreen>
|
||||||
|
#include <QTabWidget>
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QtDebug>
|
||||||
|
#include <QtWidgets>
|
||||||
|
#include <array>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <array>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "mainpicker.h"
|
||||||
|
|
||||||
std::string execAndGet(const char* cmd) {
|
std::string execAndGet(const char* cmd) {
|
||||||
std::array<char, 128> buffer;
|
std::array<char, 128> buffer;
|
||||||
std::string result;
|
std::string result;
|
||||||
|
@ -50,15 +49,15 @@ std::vector<SWindowEntry> getWindows(const char* env) {
|
||||||
|
|
||||||
while (!rolling.empty()) {
|
while (!rolling.empty()) {
|
||||||
// ID
|
// ID
|
||||||
const auto IDSEPPOS = rolling.find("[HC\011]");
|
const auto IDSEPPOS = rolling.find("[HC>]");
|
||||||
const auto IDSTR = rolling.substr(0, IDSEPPOS);
|
const auto IDSTR = rolling.substr(0, IDSEPPOS);
|
||||||
|
|
||||||
// class
|
// class
|
||||||
const auto CLASSSEPPOS = rolling.find("[HT\011]");
|
const auto CLASSSEPPOS = rolling.find("[HT>]");
|
||||||
const auto CLASSSTR = rolling.substr(IDSEPPOS + 5, CLASSSEPPOS - IDSEPPOS - 5);
|
const auto CLASSSTR = rolling.substr(IDSEPPOS + 5, CLASSSEPPOS - IDSEPPOS - 5);
|
||||||
|
|
||||||
// title
|
// title
|
||||||
const auto TITLESEPPOS = rolling.find("[HE\011]");
|
const auto TITLESEPPOS = rolling.find("[HE>]");
|
||||||
const auto TITLESTR = rolling.substr(CLASSSEPPOS + 5, TITLESEPPOS - 5 - CLASSSEPPOS);
|
const auto TITLESTR = rolling.substr(CLASSSEPPOS + 5, TITLESEPPOS - 5 - CLASSSEPPOS);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -102,9 +101,7 @@ int main(int argc, char *argv[]) {
|
||||||
for (int i = 0; i < SCREENS.size(); ++i) {
|
for (int i = 0; i < SCREENS.size(); ++i) {
|
||||||
const auto GEOMETRY = SCREENS[i]->geometry();
|
const auto GEOMETRY = SCREENS[i]->geometry();
|
||||||
|
|
||||||
QString text = QString::fromStdString(std::string("Screen " + std::to_string(i) + " at " + std::to_string(GEOMETRY.x()) + ", "
|
QString text = QString::fromStdString(std::string("Screen " + std::to_string(i) + " at " + std::to_string(GEOMETRY.x()) + ", " + std::to_string(GEOMETRY.y()) + " (" + std::to_string(GEOMETRY.width()) + "x" + std::to_string(GEOMETRY.height()) + ") (") + SCREENS[i]->name().toStdString() + ")");
|
||||||
+ std::to_string(GEOMETRY.y()) + " (" + std::to_string(GEOMETRY.width()) + "x"
|
|
||||||
+ std::to_string(GEOMETRY.height()) + ") (") + SCREENS[i]->name().toStdString() + ")");
|
|
||||||
QPushButton* button = new QPushButton(text, (QWidget*)SCREENS_SCROLL_AREA_CONTENTS);
|
QPushButton* button = new QPushButton(text, (QWidget*)SCREENS_SCROLL_AREA_CONTENTS);
|
||||||
button->move(9, 5 + (BUTTON_HEIGHT + BUTTON_PAD) * i);
|
button->move(9, 5 + (BUTTON_HEIGHT + BUTTON_PAD) * i);
|
||||||
button->resize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
button->resize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||||
|
@ -124,13 +121,9 @@ int main(int argc, char *argv[]) {
|
||||||
// windows
|
// windows
|
||||||
const auto WINDOWS_SCROLL_AREA_CONTENTS = (QWidget*)TAB1->findChild<QWidget*>("windows")->findChild<QScrollArea*>("scrollArea_2")->findChild<QWidget*>("scrollAreaWidgetContents_2");
|
const auto WINDOWS_SCROLL_AREA_CONTENTS = (QWidget*)TAB1->findChild<QWidget*>("windows")->findChild<QScrollArea*>("scrollArea_2")->findChild<QWidget*>("scrollAreaWidgetContents_2");
|
||||||
|
|
||||||
// get all windows from hyprctl
|
|
||||||
std::string windowsList = execAndGet("hyprctl clients");
|
|
||||||
|
|
||||||
// loop over them
|
// loop over them
|
||||||
int windowIterator = 0;
|
int windowIterator = 0;
|
||||||
for (auto& window : WINDOWLIST) {
|
for (auto& window : WINDOWLIST) {
|
||||||
|
|
||||||
QString text = QString::fromStdString(window.clazz + ": " + window.name);
|
QString text = QString::fromStdString(window.clazz + ": " + window.name);
|
||||||
|
|
||||||
QPushButton* button = new QPushButton(text, (QWidget*)WINDOWS_SCROLL_AREA_CONTENTS);
|
QPushButton* button = new QPushButton(text, (QWidget*)WINDOWS_SCROLL_AREA_CONTENTS);
|
||||||
|
|
|
@ -41,7 +41,7 @@ void handleTitle(void *data, struct zwlr_foreign_toplevel_handle_v1 *handle, con
|
||||||
if (current->handle == handle) {
|
if (current->handle == handle) {
|
||||||
strncpy(current->name, title, 255);
|
strncpy(current->name, title, 255);
|
||||||
for (int i = 0; i < 255; ++i)
|
for (int i = 0; i < 255; ++i)
|
||||||
if (current->name[i] == '\"' || current->name[i] == '\011' || current->name[i] == '\'')
|
if (current->name[i] == '\"' || current->name[i] == '>' || current->name[i] == '\'')
|
||||||
current->name[i] = ' ';
|
current->name[i] = ' ';
|
||||||
current->name[255] = '\0';
|
current->name[255] = '\0';
|
||||||
break;
|
break;
|
||||||
|
@ -57,7 +57,7 @@ void handleAppID(void *data, struct zwlr_foreign_toplevel_handle_v1 *handle, con
|
||||||
if (current->handle == handle) {
|
if (current->handle == handle) {
|
||||||
strncpy(current->clazz, app_id, 255);
|
strncpy(current->clazz, app_id, 255);
|
||||||
for (int i = 0; i < 255; ++i)
|
for (int i = 0; i < 255; ++i)
|
||||||
if (current->clazz[i] == '\"' || current->clazz[i] == '\011' || current->clazz[i] == '\'')
|
if (current->clazz[i] == '\"' || current->clazz[i] == '>' || current->clazz[i] == '\'')
|
||||||
current->clazz[i] = ' ';
|
current->clazz[i] = ' ';
|
||||||
current->name[255] = '\0';
|
current->name[255] = '\0';
|
||||||
break;
|
break;
|
||||||
|
@ -689,7 +689,7 @@ char *buildWindowList(struct xdpw_screencast_context *ctx) {
|
||||||
wl_list_for_each(current, &ctx->toplevel_resource_list, link) {
|
wl_list_for_each(current, &ctx->toplevel_resource_list, link) {
|
||||||
char *oldRolling = rolling;
|
char *oldRolling = rolling;
|
||||||
|
|
||||||
rolling = getFormat("%s%u[HC\011]%s[HT\011]%s[HE\011]", rolling, (uint32_t)(((uint64_t)current->handle) & 0xFFFFFFFF), current->clazz, current->name);
|
rolling = getFormat("%s%u[HC>]%s[HT>]%s[HE>]", rolling, (uint32_t)(((uint64_t)current->handle) & 0xFFFFFFFF), current->clazz, current->name);
|
||||||
|
|
||||||
free(oldRolling);
|
free(oldRolling);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue