kde: use embedded octopus icon directly, not fromTheme

QIcon::fromTheme("ollie") was finding a stale brain SVG at
/usr/share/icons/ instead of the octopus. Now the app uses the
embedded resource for both window icon and systray, and sets
app.setWindowIcon() explicitly.

Also fixed the .desktop file to use the theme name 'ollie' instead
of a hardcoded absolute path.
This commit is contained in:
Levi Neely 2026-08-20 08:56:06 +02:00
parent 19971be343
commit 24621294b0
2 changed files with 14 additions and 7 deletions

View File

@ -9,6 +9,7 @@
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QQuickStyle>
#include <QStandardPaths>
#include "ollie9pclient.h"
#include "sessionmodel.h"
@ -26,6 +27,17 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
app.setApplicationName("ollie-gui");
// Locate the installed octopus SVG (user-local takes priority over system).
// Falls back to the Qt resource if not found on disk.
QIcon appIcon;
QString iconPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
QStringLiteral("icons/hicolor/scalable/apps/ollie.svg"));
if (!iconPath.isEmpty())
appIcon = QIcon(iconPath);
else
appIcon = QIcon(QStringLiteral(":/ollie.svg"));
app.setWindowIcon(appIcon);
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE"))
QQuickStyle::setStyle("Basic");
@ -54,12 +66,7 @@ const QUrl url(QStringLiteral("qrc:/main.qml"));
return -1;
auto *window = qobject_cast<QQuickWindow *>(engine.rootObjects().constFirst());
QIcon trayIconImage = QIcon::fromTheme("ollie");
if (trayIconImage.isNull()) {
trayIconImage.addFile(":/ollie.svg");
trayIconImage.addFile(":/gui/ollie.svg");
}
auto *trayIcon = new QSystemTrayIcon(trayIconImage, &app);
auto *trayIcon = new QSystemTrayIcon(appIcon, &app);
auto *trayMenu = new QMenu;
auto *showAction = trayMenu->addAction("Show Ollie");
trayMenu->addSeparator();

View File

@ -3,7 +3,7 @@ Type=Application
Name=Ollie
Comment=AI assistant
Exec=ollie-gui
Icon=/home/lkn/.local/share/icons/hicolor/scalable/apps/ollie.svg
Icon=ollie
Categories=Utility;Development;
Terminal=false
StartupWMClass=ollie-gui