Compare commits
13 Commits
ubuntu/nob
...
ubuntu/plu
Author | SHA1 | Date |
---|---|---|
Simon Quigley | 8e83520d1a | 2 weeks ago |
Simon Quigley | ad24c0b1a5 | 2 weeks ago |
Simon Quigley | 81c743105d | 2 months ago |
Simon Quigley | 837a81b876 | 2 months ago |
Aaron Rainbolt | 0be468ee26 | 3 months ago |
Aaron Rainbolt | ea2e85a4c5 | 3 months ago |
Simon Quigley | a53b941bed | 6 months ago |
Simon Quigley | 92c6528f48 | 6 months ago |
Simon Quigley | cea2db4378 | 6 months ago |
Simon Quigley | 08440da4d7 | 6 months ago |
Simon Quigley | b23ea427eb | 6 months ago |
Simon Quigley | 20185ab419 | 6 months ago |
Simon Quigley | 367447284b | 6 months ago |
@ -0,0 +1,3 @@
|
|||||||
|
src/etc/xdg /etc/
|
||||||
|
src/usr/lib /usr
|
||||||
|
src/usr/share /usr/
|
@ -0,0 +1,3 @@
|
|||||||
|
# These desktop files are not meant to be user-visible; ignore these flags
|
||||||
|
lubuntu-default-settings: desktop-entry-lacks-icon-entry [usr/share/xsessions/Lubuntu.desktop]
|
||||||
|
lubuntu-default-settings: desktop-entry-lacks-keywords-entry [usr/share/xsessions/Lubuntu.desktop]
|
@ -1,3 +0,0 @@
|
|||||||
lubuntu-default-settings/etc/xdg etc/
|
|
||||||
lubuntu-default-settings/usr/lib usr/
|
|
||||||
lubuntu-default-settings/usr/share usr/
|
|
@ -1,2 +0,0 @@
|
|||||||
lubuntu-snap-installation-monitor/etc/xdg/autostart/snap-installation-monitor.desktop etc/xdg/autostart/
|
|
||||||
lubuntu-snap-installation-monitor/usr/libexec/snap-installation-monitor usr/libexec/
|
|
@ -1,9 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.5.0)
|
|
||||||
project(snap-installation-monitor)
|
|
||||||
|
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
||||||
set(CMAKE_AUTOMOC ON)
|
|
||||||
find_package(Qt5 COMPONENTS Widgets DBus REQUIRED)
|
|
||||||
|
|
||||||
add_executable(snap-installation-monitor main.cpp)
|
|
||||||
target_link_libraries(snap-installation-monitor Qt5::Widgets Qt5::DBus)
|
|
@ -1,84 +0,0 @@
|
|||||||
// Copyright (C) 2024 Simon Quigley <tsimonq2@ubuntu.com>
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 3
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QSystemTrayIcon>
|
|
||||||
#include <QtDBus/QtDBus>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QMessageBox>
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
|
||||||
QApplication app(argc, argv);
|
|
||||||
|
|
||||||
// Create and set application icon
|
|
||||||
QIcon appIcon = QIcon::fromTheme("dialog-information");
|
|
||||||
QApplication::setWindowIcon(appIcon);
|
|
||||||
|
|
||||||
// DBus interface to systemd
|
|
||||||
QDBusInterface systemd("org.freedesktop.systemd1",
|
|
||||||
"/org/freedesktop/systemd1",
|
|
||||||
"org.freedesktop.systemd1.Manager",
|
|
||||||
QDBusConnection::systemBus());
|
|
||||||
|
|
||||||
// Retrieve current status of snapd.seeded.service, which tracks the preseed process
|
|
||||||
QDBusMessage methodCall = systemd.call("GetUnit", "snapd.seeded.service");
|
|
||||||
QDBusObjectPath unitPath = methodCall.arguments().at(0).value<QDBusObjectPath>();
|
|
||||||
QDBusInterface unit("org.freedesktop.systemd1",
|
|
||||||
unitPath.path(),
|
|
||||||
"org.freedesktop.systemd1.Unit",
|
|
||||||
QDBusConnection::systemBus());
|
|
||||||
QVariant activeState = unit.property("ActiveState");
|
|
||||||
QVariant subState = unit.property("SubState");
|
|
||||||
|
|
||||||
// System tray icon setup
|
|
||||||
QSystemTrayIcon trayIcon(appIcon);
|
|
||||||
trayIcon.setToolTip("Snap Installation Monitor");
|
|
||||||
|
|
||||||
// Initial message displayed in the system tray
|
|
||||||
auto showMessage = [&trayIcon]() {
|
|
||||||
trayIcon.showMessage("Installation Notice", "Finalizing installation of snaps, please wait...",
|
|
||||||
QSystemTrayIcon::Information, 15000);
|
|
||||||
};
|
|
||||||
|
|
||||||
// If the user clicks the system tray icon, display the notification again
|
|
||||||
QObject::connect(&trayIcon, &QSystemTrayIcon::activated, [&](QSystemTrayIcon::ActivationReason reason) {
|
|
||||||
if (reason == QSystemTrayIcon::Trigger) {
|
|
||||||
showMessage();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Exit immediately if the service is "active (exited)", launch the GUI parts otherwise
|
|
||||||
if (activeState.toString() == "active" && subState.toString() == "exited") { return 0; }
|
|
||||||
trayIcon.show();
|
|
||||||
showMessage();
|
|
||||||
|
|
||||||
QTimer timer;
|
|
||||||
QObject::connect(&timer, &QTimer::timeout, [&unit, &trayIcon]() {
|
|
||||||
QVariant newState = unit.property("ActiveState");
|
|
||||||
QVariant newSubState = unit.property("SubState");
|
|
||||||
if (newState.toString() == "active" && newSubState.toString() == "exited") {
|
|
||||||
trayIcon.hide();
|
|
||||||
QMessageBox messageBox;
|
|
||||||
messageBox.setIcon(QMessageBox::Information);
|
|
||||||
messageBox.setText("Background snap installation is complete.");
|
|
||||||
messageBox.setWindowTitle("Installation Complete");
|
|
||||||
messageBox.setStandardButtons(QMessageBox::Ok);
|
|
||||||
messageBox.exec();
|
|
||||||
|
|
||||||
QApplication::quit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
timer.start(5000); // Check every 5 seconds
|
|
||||||
|
|
||||||
return app.exec();
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
[Desktop Entry]
|
|
||||||
Type=Application
|
|
||||||
Name=Snap Installation Monitor
|
|
||||||
Exec=/usr/libexec/snap-installation-monitor
|
|
||||||
Icon=dialog-information
|
|
||||||
Comment=Monitor snapd seeding at startup
|
|
||||||
X-LXQt-Need-Tray=true
|
|
||||||
NoDisplay=true
|
|
@ -0,0 +1,2 @@
|
|||||||
|
[General]
|
||||||
|
theme=Lubuntu
|
@ -1,2 +1,2 @@
|
|||||||
[Default Applications]
|
[Default Applications]
|
||||||
application/pdf=okularApplication_pdf.desktop
|
application/pdf=qpdfview.desktop
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
[Added Associations]
|
[Added Associations]
|
||||||
application/pdf=okularApplication_pdf.desktop
|
application/pdf=qpdfview.desktop
|
||||||
|
Loading…
Reference in new issue