[vlc-devel] [PATCH] Set application display name and desktop entry

Kai Uwe Broulik kde at privat.broulik.de
Tue Apr 2 23:02:00 CEST 2019


This ensures that the application can be properly identified.
For instance, a platform theme plugin may use those hints to identify the app
to the window manager, notification service, or system tray container.
Furthermore, on Wayland a desktop entry name is required in the the xdg-shell protocol.

Qt also automatically appends the application display name to the window title
on Windows and Linux removing the need for a custom window title function.
---
 modules/gui/qt/main_interface.cpp | 9 +--------
 modules/gui/qt/qt.cpp             | 4 ++++
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp
index 82ce6e81a8..4536d663b3 100644
--- a/modules/gui/qt/main_interface.cpp
+++ b/modules/gui/qt/main_interface.cpp
@@ -1287,14 +1287,7 @@ void MainInterface::setName( const QString& name )
  **/
 void MainInterface::setVLCWindowsTitle( const QString& aTitle )
 {
-    if( aTitle.isEmpty() )
-    {
-        setWindowTitle( qtr( "VLC media player" ) );
-    }
-    else
-    {
-        setWindowTitle( aTitle + " - " + qtr( "VLC media player" ) );
-    }
+    setWindowTitle( aTitle );
 }
 
 void MainInterface::showCryptedLabel( bool b_show )
diff --git a/modules/gui/qt/qt.cpp b/modules/gui/qt/qt.cpp
index a390d3b7ae..9d9440a3d8 100644
--- a/modules/gui/qt/qt.cpp
+++ b/modules/gui/qt/qt.cpp
@@ -533,11 +533,15 @@ static void *Thread( void *obj )
 #endif
             QSettings::UserScope, "vlc", "vlc-qt-interface" );
 
+    app.setApplicationDisplayName( qtr("VLC media player") );
+
     if( QDate::currentDate().dayOfYear() >= QT_XMAS_JOKE_DAY && var_InheritBool( p_intf, "qt-icon-change" ) )
         app.setWindowIcon( QIcon::fromTheme( "vlc-xmas", QIcon( ":/logo/vlc128-xmas.png" ) ) );
     else
         app.setWindowIcon( QIcon::fromTheme( "vlc", QIcon( ":/logo/vlc256.png" ) ) );
 
+    app.setDesktopFileName( PACKAGE );
+
     /* Initialize the Dialog Provider and the Main Input Manager */
     DialogsProvider::getInstance( p_intf );
     MainInputManager* mim = MainInputManager::getInstance( p_intf );
-- 
2.17.1



More information about the vlc-devel mailing list