diff --git a/pym/desktop/desktop.py b/pym/desktop/desktop.py index 1e5669b..c66b5d7 100644 --- a/pym/desktop/desktop.py +++ b/pym/desktop/desktop.py @@ -271,7 +271,7 @@ class Desktop(MethodsInterface): elif session == 'kde': logoutCommand = "/usr/bin/kquitapp ksmserver" elif session == 'plasma': - logoutCommand = "/usr/bin/kquitapp5 ksmserver" + logoutCommand = "/usr/bin/pkill -f ksmserver" elif session == 'gnome': logoutCommand = "/usr/bin/qdbus org.gnome.SessionManager " \ "/org/gnome/SessionManager Logout 1" @@ -282,7 +282,7 @@ class Desktop(MethodsInterface): raise DesktopError(_("Unable to send the logout command")) return True - def waitLogout(self, urLogin, waitTime, postWaitTime=5): + def waitLogout(self, urLogin, waitTime, postWaitTime=20): """ Ожидать завершения пользовательского сеанса @@ -290,6 +290,17 @@ class Desktop(MethodsInterface): urLogin: логин пользователя waitTime: время ожидания завершения сеанса """ + session = self.clVars.Get('cl_desktop_xsession') + if session == "plasma": + uid = self.clVars.Get('ur_uid') + if uid: + uid = int(uid) + for i in range(0, postWaitTime): + if not filter(lambda x: "ksmserver" in x, + getRunCommands(uid=uid)): + break + time.sleep(1) + if filter(lambda x: "xdm/xdm\x00--logout" in x, getRunCommands()): for i in range(0, waitTime): @@ -300,7 +311,7 @@ class Desktop(MethodsInterface): else: raise DesktopError(_("Unable to wait for completion " "of the user logout")) - for wait in range(0, 5): + for wait in range(0, postWaitTime): self.clVars.Invalidate('cl_desktop_online_data') if urLogin not in self.clVars.Get('cl_desktop_online_user'): return True