From 7afc15dcf08fabcaecc0315a0e6a80c3e48effdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 16 Apr 2014 16:59:47 +0200 Subject: [PATCH] appmenus: workarounds for non-refreshing icon caches (#751) --- appmenus-scripts/qubes-core-appmenus.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/appmenus-scripts/qubes-core-appmenus.py b/appmenus-scripts/qubes-core-appmenus.py index 4e49f1c..daf1a8c 100644 --- a/appmenus-scripts/qubes-core-appmenus.py +++ b/appmenus-scripts/qubes-core-appmenus.py @@ -26,6 +26,7 @@ import sys import os import os.path import shutil +import dbus from qubes.qubes import QubesVm,QubesHVm from qubes.qubes import QubesException,QubesHost,QubesVmLabels @@ -207,6 +208,26 @@ def QubesVm_remove_from_disk(self): def QubesVm_label_setter(self, _): self.appicons_create() + # Apparently desktop environments heavily caches the icons, + # see #751 for details + if os.environ.get("DESKTOP_SESSION", "") == "kde-plasma": + try: + os.unlink(os.path.expandvars("$HOME/.kde/cache-$HOSTNAME/icon-cache.kcache")) + except: + pass + try: + notify_object = dbus.SessionBus().get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications") + notify_object.Notify( + "Qubes", 0, self.label.icon, "Qubes", + "You will need to log off and log in again for the VM icons to update in the KDE launcher menu", + [], [], 10000, + dbus_interface="org.freedesktop.Notifications") + except: + pass + elif os.environ.get("DESKTOP_SESSION", "") == "xfce": + self.appmenus_remove() + self.appmenus_create() + def QubesVm_appmenus_recreate(self): self.appmenus_remove() self.appicons_remove()