Fix notification bug, switch to beta testing

ubuntu/noble ubuntu/1.0.0_beta1
Aaron Rainbolt 3 months ago
parent 9a2b5b6450
commit 953908831e

8
debian/changelog vendored

@ -1,3 +1,11 @@
lubuntu-update-notifier (1.0.0~beta1) noble; urgency=medium
* Change from alpha to beta testing phase, this has been tested for a while
and looks pretty stable so far.
* Wait to start until lxqt-notificationd is present. (LP: #2056379)
-- Aaron Rainbolt <arraybolt3@ubuntu.com> Thu, 07 Mar 2024 04:06:13 +0000
lubuntu-update-notifier (1.0.0~alpha4) noble; urgency=medium
* Fix infinite loop when no eligible new release is available.

@ -7,8 +7,28 @@
#include <QDialog>
#include <QLocale>
#include <QProcess>
#include <QThread>
#include <QTranslator>
/*
* Detects if at least `count` processes that match `procName` are running.
*/
bool detectProc(QString procName, int count)
{
QProcess procDetector;
procDetector.setProgram("/usr/bin/bash");
procDetector.setArguments(QStringList() << "-c" << "ps axo comm | grep " + procName);
procDetector.start();
procDetector.waitForFinished();
QString procDetectResult = procDetector.readAllStandardOutput();
procDetectResult = procDetectResult.trimmed();
QStringList procDetectResultList = procDetectResult.split('\n');
if (procDetectResultList.count() >= count) {
return true;
}
return false;
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
@ -28,22 +48,30 @@ int main(int argc, char *argv[])
* /dev/shm/lubuntu-update/lubuntu-update-show-win and exit. This will
* trigger the existing process to pop up a window.
*/
QProcess procDetector;
procDetector.setProgram("/usr/bin/bash");
procDetector.setArguments(QStringList() << "-c" << "ps axo comm | grep lubuntu-update");
procDetector.start();
procDetector.waitForFinished();
QString procDetectResult = procDetector.readAllStandardOutput();
procDetectResult = procDetectResult.trimmed();
QStringList procDetectResultList = procDetectResult.split('\n');
if (procDetectResultList.count() > 1) {
if (detectProc("lubuntu-update", 2)) {
QFile flagFile("/dev/shm/lubuntu-update/lubuntu-update-show-win");
flagFile.open(QFile::WriteOnly);
flagFile.close();
return 0;
}
/*
* Wait to run until lxqt-notificationd is running. This avoids a bug that
* causes notifications to show up in the entirely wrong spot. If it takes
* longer than about 30 seconds to show up, we continue on without it for
* the sake of getting security updates.
*/
for (int i = 0;i < 30;i++) {
// "lxqt-notificati" is intentionally truncated here since that's how it shows up in the output of `ps axo comm`.
if (detectProc("lxqt-notificati", 1)) {
// Wait for it to initialize fully - 3 seconds should be way more than enough
QThread::sleep(3);
break;
} else {
QThread::sleep(1);
}
}
// Don't want the updater to stop just because the user closed it :P
a.setQuitOnLastWindowClosed(false);

Loading…
Cancel
Save