Improve setup and add auto-enabling of the XR driver

This commit is contained in:
wheaney 2025-08-25 17:57:49 -07:00
parent 3e726bd1ee
commit fbdd5e14bb
4 changed files with 69 additions and 10 deletions

View File

@ -47,13 +47,9 @@ if [[ -f "$CONFIG_SO" ]]; then
$SUDO rm -f "$CONFIG_SO"
fi
if [ -e "$XDG_BIN_HOME/xr_driver_uninstall" ]; then
[ "$for_install" -eq 0 ] && echo "Uninstalling XRLinuxDriver"
if [ "$for_install" -eq 1 ]; then
sudo $XDG_BIN_HOME/xr_driver_uninstall --for-install
else
sudo $XDG_BIN_HOME/xr_driver_uninstall
fi
if [[ -e "$XDG_BIN_HOME/xr_driver_uninstall" && "$for_install" -eq 0 ]]; then
echo "Uninstalling XRLinuxDriver"
sudo "$XDG_BIN_HOME/xr_driver_uninstall"
fi
# this script is self-deleting, leave this as the last command

View File

@ -80,7 +80,7 @@ EOF
fi
# set up the XR driver using the local binary
echo "Installing xrDriver"
echo "Installing xrDriver (requires sudo)"
echo "BEGIN - xr_driver_setup"
if [ -z "$1" ]
then
@ -89,4 +89,6 @@ else
sudo bin/xr_driver_setup -v $1 $(pwd)/xrDriver.tar.gz
fi
echo "END - xr_driver_setup"
echo "END - xr_driver_setup"
printf "\n\033[1;33m!!! IMPORTANT !!!\033[0m You must log out and back in, then enable Breezy Desktop from the Desktop Effects in System Settings\n\n"

View File

@ -123,6 +123,8 @@ BreezyDesktopEffect::BreezyDesktopEffect()
connect(m_cursorUpdateTimer, &QTimer::timeout, this, &BreezyDesktopEffect::updateCursorPos);
m_cursorUpdateTimer->setInterval(16); // ~60Hz
m_cursorUpdateTimer->start();
enableDriver();
}
void BreezyDesktopEffect::setupGlobalShortcut(const BreezyShortcuts::Shortcut &shortcut, std::function<void()> triggeredFunc) {
@ -177,7 +179,6 @@ void BreezyDesktopEffect::activate()
// QuickSceneEffect grabs the keyboard and mouse input, which pulls focus away from the active window
// and doesn't allow for interaction with anything on the desktop. These two calls fix that.
// TODO - move away from QuickSceneEffect
effects->ungrabKeyboard();
effects->stopMouseInterception(this);
@ -205,6 +206,65 @@ void BreezyDesktopEffect::deactivate()
m_shutdownTimer->start(250);
}
void BreezyDesktopEffect::enableDriver()
{
qCCritical(KWIN_XR) << "\t\t\tBreezy - enableDriver";
QByteArray homeEnv = qgetenv("HOME");
QString program = QString::fromUtf8(homeEnv) + QStringLiteral("/.local/bin/xr_driver_cli");
// Helper lambda to start the second call
auto setBreezyDesktopMode = [this, program]() {
QProcess *proc2 = new QProcess(this);
proc2->setProgram(program);
proc2->setArguments({QStringLiteral("-bd")}); // change the mode to Breezy Desktop
proc2->setProcessChannelMode(QProcess::MergedChannels);
connect(proc2, &QProcess::readyReadStandardOutput, this, [proc2]() {
const QByteArray out = proc2->readAllStandardOutput();
if (!out.isEmpty()) {
qCInfo(KWIN_XR) << "xr_driver_cli -bd:" << out;
}
});
connect(proc2, &QProcess::errorOccurred, this, [proc2](QProcess::ProcessError err) {
qCCritical(KWIN_XR) << "xr_driver_cli -bd error" << err << proc2->errorString();
});
connect(proc2, QOverload<int,QProcess::ExitStatus>::of(&QProcess::finished),
this, [this, proc2](int code, QProcess::ExitStatus status) {
qCInfo(KWIN_XR) << "xr_driver_cli -bd exited" << code << "status" << status;
proc2->deleteLater();
});
proc2->start();
};
QProcess *proc1 = new QProcess(this);
proc1->setProgram(program);
proc1->setArguments({QStringLiteral("-e")}); // enable flag
proc1->setProcessChannelMode(QProcess::MergedChannels);
connect(proc1, &QProcess::readyReadStandardOutput, this, [proc1]() {
const QByteArray out = proc1->readAllStandardOutput();
if (!out.isEmpty()) {
qCInfo(KWIN_XR) << "xr_driver_cli -e:" << out;
}
});
connect(proc1, &QProcess::errorOccurred, this, [proc1](QProcess::ProcessError err) {
qCCritical(KWIN_XR) << "xr_driver_cli -e error" << err << proc1->errorString();
});
connect(proc1, QOverload<int,QProcess::ExitStatus>::of(&QProcess::finished),
this, [proc1, setBreezyDesktopMode](int code, QProcess::ExitStatus status) {
qCInfo(KWIN_XR) << "xr_driver_cli -e exited" << code << "status" << status;
proc1->deleteLater();
if (status == QProcess::NormalExit && code == 0) {
setBreezyDesktopMode();
} else {
qCCritical(KWIN_XR) << "First call failed; not starting second.";
}
});
proc1->start();
}
void BreezyDesktopEffect::realDeactivate()
{
qCCritical(KWIN_XR) << "\t\t\tBreezy - realDeactivate";

View File

@ -66,6 +66,7 @@ namespace KWin
public Q_SLOTS:
void activate();
void deactivate();
void enableDriver();
void toggle();
void recenter();
void toggleZoomOnFocus();