There is probably some DBus call to do it. Check the DBus interface for Plasma using e.g. qdbusviewer.