2

Currently I'm developing KDE Plasma/Wallpaper plugin with D-Bus interface(small learning project). I have multi-monitor setup and would like to be able to address each D-Bus Plasma/Wallpaper instance independently(running on different monitors or even on separate KDE Activities) and my initial idea was simple: register separate D-Bus services with unique name(i.e. "com.example.prettydesktop.wlp-"+unique_screen_id) for each instance of plugin. However I couldn't find any way to get screen id from PyKDE Wallpaper because it's not QWidget subclass and thus I can't use QDesktopWidget.screenNumber method.

class DbusWlp(Wallpaper):
    def __init__(self, parent, args=None):
        Wallpaper.__init__(self, parent)

    # Plasmoid init code should go here
    def init(self, config):
        # also tried QX11Info but I think it's not relevant here
        print QtGui.QX11Info().appScreen() # always returns 0
        print QtGui.QApplication.desktop().screenNumber(self) # doesn't work because self is not QWidget subclass
        print QtGui.QApplication.desktop().isVirtualDesktop() # returns True just in case

The main question is: What is the proper way to identify what screen plasma plugin(wallpaper or plasmoid) is running on? And a small additional question: Is there any better way to implement cross-widget communication then D-Bus?
I'm fairly new both to PyQT and PyKDE so I could easily missed something obvious and ANY help would be much appreciated. Thanks in advance!

PS: Sorry for my poor English - it's not my mother tongue.

Machavity
  • 30,841
  • 27
  • 92
  • 100
zeronineseven
  • 129
  • 2
  • 6

0 Answers0