Open Milaleda opened 2 years ago
I successfully added a system tray icon as a patch in OBS Build Service a while ago.
@julonexus Maybe you can reuse it?
It would be nice if the program icon and the system tray icon in Linux would not be embedded as what I assume are PNG bitmaps, but rather taken from the raw SVG file for better scaling capabilities. If the icons reside outside the binary code, it is much easier to adapt them for the different themes the user can select.
If possible, it would be nice to have a less intrusive coloring (currently bright orange) for the program icon and system tray (should be gray). At night time the bright orange color draws a lot of attention for the eyes. Many themes have separate icon for linphone already.
For modern linux window managers, SVG files
/usr/share/icons/hicolor/scalable/apps/linphone.svg
/usr/share/icons/hicolor/symbolic/apps/linphonesystemtray.svg
would probably fit all size needs.
Patch worked in linphone-desktop v5.0.10.
Copied from the full patch 0001-remove-dot-git-folder-dependency-and-encountered-bugs.patch
systemtray.svg
icon was put in /usr/share/icons/hicolor/scalable/web/systemtray.svg
in the patch.
You may want to put it in another place
--- a/linphone-app/assets/images/systemtray.svg
+++ b/linphone-app/assets/images/systemtray.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
+ <path fill="#bebebe" d="M10.5 1.7c-.6 0-1 .4-1 1v3c0 .5.4.9 1 .9h.6c-.6 2.2-2.4 4-4.5 4.5v-.6c0-.5-.4-1-1-1H2.7a1 1 0 0 0-1 1V12a2.3 2.3 0 0 0 2.4 2.4h.6c5.3 0 9.5-4.3 9.5-9.6v-.6A2.3 2.3 0 0 0 12 1.7Zm0 0"/>
+</svg>
--- a/linphone-app/cmake_builder/linphone_package/CMakeLists.txt
+++ b/linphone-app/cmake_builder/linphone_package/CMakeLists.txt
@@ -293,7 +313,8 @@
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../../assets/qt.conf.in" "${CMAKE_CURRENT_BINARY_DIR}/../../qt.conf" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/../../qt.conf" DESTINATION "${CMAKE_INSTALL_BINDIR}")
- install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../../assets/images/linphone_logo.svg" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps/" RENAME "${EXECUTABLE_NAME}.svg")
+ install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../../assets/images/linphone_logo.svg" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps/" RENAME "${EXECUTABLE_NAME}.svg")
+ install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../../assets/images/systemtray.svg" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/web/" RENAME "${EXECUTABLE_NAME}systemtray.svg")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../../assets/linphonerc-factory" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${EXECUTABLE_NAME}")
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../../assets/assistant" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${EXECUTABLE_NAME}" USE_SOURCE_PERMISSIONS)
--- a/linphone-app/resources.qrc
+++ b/linphone-app/resources.qrc
@@ -540,6 +540,7 @@
<file>ui/views/App/Styles/Settings/SettingsUiStyle.qml</file>
<file>ui/views/App/Styles/Settings/SettingsWindowStyle.qml</file>
<file>assets/images/linphone_logo.svg</file>
+ <file>assets/images/systemtray.svg</file>
<file>ui/dev-modules/Units/Units.qml</file>
<file>assets/icon.ico</file>
</qresource>
--- a/linphone-app/src/app/App.cpp
+++ b/linphone-app/src/app/App.cpp
@@ -824,7 +824,10 @@
menu->addAction(quitAction);
if(!mSystemTrayIcon)
systemTrayIcon->setContextMenu(menu);// This is a Qt bug. We cannot call setContextMenu more than once. So we have to keep an instance of the menu.
- systemTrayIcon->setIcon(QIcon(Constants::WindowIconPath));
+ /*
+ * Use easier to see icon
+ */
+ systemTrayIcon->setIcon(QIcon(Constants::SystemTrayIconPath));
systemTrayIcon->setToolTip(APPLICATION_NAME);
systemTrayIcon->show();
if(!mSystemTrayIcon)
--- a/linphone-app/src/components/core/event-count-notifier/EventCountNotifierSystemTrayIcon.cpp
+++ b/linphone-app/src/components/core/event-count-notifier/EventCountNotifierSystemTrayIcon.cpp
@@ -44,7 +44,7 @@
}
EventCountNotifier::EventCountNotifier (QObject *parent) : AbstractEventCountNotifier(parent) {
- QSvgRenderer renderer((QString(Constants::WindowIconPath)));
+ QSvgRenderer renderer((QString(Constants::SystemTrayIconPath)));
if (!renderer.isValid())
qFatal("Invalid SVG Image.");
@@ -91,7 +91,7 @@
// Draw background.
{
- p.setBrush(App::getInstance()->getColorListModel()->addImageColor("Logo_tray_blink_bg", Constants::WindowIconPath,"b")->getColor());
+ p.setBrush(App::getInstance()->getColorListModel()->addImageColor("Logo_tray_blink_bg", Constants::SystemTrayIconPath,"b")->getColor());
p.drawEllipse(QPointF(width / 2, height / 2), IconCounterBackgroundRadius, IconCounterBackgroundRadius);
}
@@ -101,7 +101,7 @@
font.setPixelSize(IconCounterTextPixelSize);
p.setFont(font);
- p.setPen(QPen(App::getInstance()->getColorListModel()->addImageColor("Logo_tray_blink_fg", Constants::WindowIconPath,"ai")->getColor(), 1));
+ p.setPen(QPen(App::getInstance()->getColorListModel()->addImageColor("Logo_tray_blink_fg", Constants::SystemTrayIconPath,"ai")->getColor(), 1));
p.drawText(QRect(0, 0, width, height), Qt::AlignCenter, QString::number(n));
}
--- a/linphone-app/src/utils/Constants.cpp
+++ b/linphone-app/src/utils/Constants.cpp
@@ -1,6 +1,7 @@
#include "Constants.hpp"
constexpr char Constants::WindowIconPath[];
+constexpr char Constants::SystemTrayIconPath[];
constexpr char Constants::DefaultLocale[];
constexpr char Constants::LanguagePath[];
--- a/linphone-app/src/utils/Constants.hpp
+++ b/linphone-app/src/utils/Constants.hpp
@@ -94,6 +94,7 @@
static constexpr char LinphoneDomain[] = "sip.linphone.org"; // Use for checking if config are a Linphone
static constexpr char WindowIconPath[] = ":/assets/images/linphone_logo.svg";
+ static constexpr char SystemTrayIconPath[] = ":/assets/images/systemtray.svg";
static constexpr char ApplicationMinimalQtVersion[] = "5.10.0";
static constexpr char DefaultConferenceURI[] = "sip:conference-factory@sip.linphone.org"; // Default for a Linphone account
static constexpr char DefaultVideoConferenceURI[] = "sip:videoconference-factory@sip.linphone.org"; // Default for a Linphone account
@julonexus Any plan to implement this enhancement?
Having a PNG for system tray lead to a fatal in Linphone. So I don't understand "It would be nice if the program icon and the system tray icon in Linux would not be embedded as what I assume are PNG bitmaps"
It required to maintain 2 same files for a specific use case. I don't think it will be implemented for 5 as we are limiting further developments on it.
I guess it will be implemented for 6.0 where all the application will change (multi-threading, Qt6 etc.)
Hi, it would be nice to change/ or have the choice to change the icon in the tray to a symbolic one, to fit to the "tray-style" of Linux. I start Linphone as a start program and send it to tray with a second one ("wmctrl -c LINPHONE").
Thanks a lot