import subprocess import re command = ['qdbus', 'org.kde.plasmashell', '/PlasmaShell', 'org.kde.PlasmaShell.evaluateScript'] command.append(""" var allDesktops = desktops(); for (i=0;i