This is the issue
https://wiki.garudalinux.org/en/dr460nized-migration
I think I found an easy fix but i'm not sure how to implement it or if it would work.
The idea is a widget that acts like the panel spacers but when you click on them you can drag the active window on the current monitor.
I asked AI to make it and this is what it came up with:
(unfortunately I don't understand it super well)
#include <QApplication>
#include <QMouseEvent>
#include <QPainter>
#include <QRect>
#include <QScreen>
#include <QWindow>
#include <QPoint>
#include <QSize>
#include <QWidget>
class WindowDraggerWidget : public QWidget {
public:
explicit WindowDraggerWidget(QWidget *parent = nullptr) : QWidget(parent) {
// set a fixed size for the widget
setFixedSize(20, 20);
}
protected:
void paintEvent(QPaintEvent *event) override {
// draw a simple icon on the widget
QPainter painter(this);
painter.setPen(Qt::white);
painter.drawLine(0, 10, 20, 10);
painter.drawLine(10, 0, 10, 20);
}
void mousePressEvent(QMouseEvent *event) override {
// get the active window
QWindow *activeWindow = qApp->activeWindow();
if (activeWindow) {
// save the initial mouse position and window position
m_mousePressPosition = event->globalPos();
m_windowPosition = activeWindow->position();
}
}
void mouseMoveEvent(QMouseEvent *event) override {
// calculate the new window position based on the mouse movement
QWindow *activeWindow = qApp->activeWindow();
if (activeWindow) {
QPoint delta = event->globalPos() - m_mousePressPosition;
QRect screenGeometry = QGuiApplication::screens().at(activeWindow->screen())->geometry();
QSize windowSize = activeWindow->size();
QPoint newPosition = m_windowPosition + delta;
newPosition.setX(qMax(screenGeometry.left(), qMin(newPosition.x(), screenGeometry.right() - windowSize.width())));
newPosition.setY(qMax(screenGeometry.top(), qMin(newPosition.y(), screenGeometry.bottom() - windowSize.height())));
activeWindow->setPosition(newPosition);
}
}
private:
QPoint m_mousePressPosition;
QPoint m_windowPosition;
};
int main(int argc, char **argv) {
QApplication app(argc, argv);
// create the dragger widget and add it to the plasma panel
WindowDraggerWidget *draggerWidget = new WindowDraggerWidget();
draggerWidget->show();
draggerWidget->setAttribute(Qt::WA_TransparentForMouseEvents);
return app.exec();
}
In this implementation, we create a
WindowDraggerWidget
class that extendsQWidget
and represents the draggable icon in the plasma panel. We override thepaintEvent
,mousePressEvent
, andmouseMoveEvent
methods to implement the desired functionality.When the user clicks on the dragger widget (
mousePressEvent
), we get the active window and save its initial position and the mouse press position. When the user moves the mouse (mouseMoveEvent
), we calculate the new position for the window and set it usingQWindow::setPosition
.Note that we also use the
QGuiApplication::screens
method to get the geometry of the current screen and ensure that the window position stays within its bounds. Finally, we add the dragger widget to the plasma panel and set theQt::WA_TransparentForMouseEvents
attribute to make it non-interactive so that clicks on it are passed through to the underlying panel.
Is there any way this could work or am i wasting my time?