Skip to content

Commit

Permalink
picker: Save the output name to a proper variable instead of parsing …
Browse files Browse the repository at this point in the history
…it from the button text
  • Loading branch information
rurigk committed Feb 18, 2024
1 parent c06fd88 commit ed336bd
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions hyprland-share-picker/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,17 @@ int main(int argc, char* argv[]) {
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() + ")");
QString outputName = SCREENS[i]->name();
ElidedButton* button = new ElidedButton(text);
button->setMinimumSize(0, BUTTON_HEIGHT);
SCREENS_SCROLL_AREA_CONTENTS_LAYOUT->addWidget(button);

QObject::connect(button, &QPushButton::clicked, [=]() {
std::string ID = button->text().toStdString();
ID = ID.substr(ID.find_last_of('(') + 1);
ID = ID.substr(0, ID.find_last_of(')'));

std::cout << "[SELECTION]";
std::cout << (ALLOWTOKENBUTTON->isChecked() ? "r" : "");
std::cout << "/";

std::cout << "screen:" << ID << "\n";
std::cout << "screen:" << outputName.toStdString() << "\n";

settings->setValue("width", mainPickerPtr->width());
settings->setValue("height", mainPickerPtr->height());
Expand Down

0 comments on commit ed336bd

Please sign in to comment.