Skip to content

Commit

Permalink
Merge pull request #1336 from aryoda/issue/1244_wrong_icon_on_wayland
Browse files Browse the repository at this point in the history
Fixes 1244: KDE/Wayland: Wrong icon in taskbar (default Wayland instead of BiT icon)
  • Loading branch information
emtiu authored Oct 21, 2022
2 parents b4dd2d1 + ac86af3 commit d5032ed
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Upcoming Release
* Bugfix: AttributeError in "Diff Options" dialog (#898)
* Bugfix: Settings GUI: "Save password to Keyring" was disabled due to "no appropriate keyring found" (#1321)
* Bugfix: Avoid logging errors while waiting for a target drive to be mounted (#1142, #1143, #1328)
* Bugfix: Wrong systray icon showing in Wayland (#1244)
* Documentation update: correct description of profile<N>.schedule.time in backintime-config manpage (#1270)
* Translation update: Brazilian Portuguese (#1267)
* Translation update: Italian (#1110, #1123)
Expand Down
15 changes: 15 additions & 0 deletions qt/qttools.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import os
import sys
import gettext

from PyQt5.QtGui import (QFont, QColor, QKeySequence)
from PyQt5.QtCore import (QDir, Qt, pyqtSlot, pyqtSignal, QModelIndex,
QTranslator, QLocale, QLibraryInfo, QEvent,
Expand All @@ -30,6 +31,7 @@
from calendar import monthrange
from packaging.version import Version


_ = gettext.gettext

def backintimePath(*path):
Expand All @@ -45,6 +47,8 @@ def registerBackintimePath(*path):

registerBackintimePath('common')
import snapshots
import tools
import logger

def fontBold(font):
font.setWeight(QFont.Bold)
Expand Down Expand Up @@ -161,6 +165,17 @@ def createQApplication(app_name = 'Back In Time'):
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
qapp = QApplication(sys.argv)
qapp.setApplicationName(app_name)
try:
if tools.isRoot():
logger.debug("Trying to set App ID for root user")
qapp.setDesktopFileName("backintime-qt-root")
else:
logger.debug("Trying to set App ID for non-privileged user")
qapp.setDesktopFileName("backintime-qt")
except Exception as e:
logger.warning("Could not set App ID (required for Wayland App icon and more)")
logger.warning("Reason: " + repr(e))
qapp.setDesktopFileName("backintime-qt")
if os.geteuid() == 0 and \
qapp.style().objectName().lower() == 'windows' and \
'GTK+' in QStyleFactory.keys():
Expand Down

0 comments on commit d5032ed

Please sign in to comment.