hyprwm / xdg-desktop-portal-hyprland

xdg-desktop-portal backend for Hyprland
BSD 3-Clause "New" or "Revised" License
273 stars 47 forks source link

Screenshot functionality removed? #124

Closed eneoli closed 10 months ago

eneoli commented 11 months ago

I was experimenting with D-Bus and wrote the following small script:

Script ```python import sys import json from PyQt5.QtCore import QObject, pyqtSlot from PyQt5.QtWidgets import QApplication from PyQt5.QtDBus import QDBusConnection, QDBusInterface, QDBusMessage class DbusTest(QObject): def __init__(self): super(DbusTest, self).__init__() bus = QDBusConnection.sessionBus() bus.registerObject('/', self) interface = QDBusInterface( "org.freedesktop.portal.Desktop", "/org/freedesktop/portal/desktop", "org.freedesktop.portal.Screenshot", ) reply = interface.call("Screenshot", "", {"interactive": False, "handle_token": "demo_app"}) path = (reply.arguments()[0]) print(path) bus.connect( 'org.freedesktop.portal.Desktop', path, 'org.freedesktop.portal.Request', 'Response', self.testMessage ) print('Connected') @pyqtSlot(QDBusMessage) def testMessage(self, msg): print(json.dumps(msg.arguments()[1])) print(msg.arguments()[1]['uri']) if __name__ == '__main__': app = QApplication(sys.argv) discoverer = DbusTest() sys.exit(app.exec_()) ```

This script works perfectly with xdg-desktop-portal-wlr when using xdg-desktop-portal 1.14.6. However, when I use xdg-desktop-portal-hyprland with xdg-desktop-portal (1.14.6 or later), I encounter the following error:

No such interface "org.freedesktop.portal.Screenshot" on object at path /org/freedesktop/portal/desktop

After investigating the code of the Hyprland portal, I realized that it does not register a method 'Screenshot' for the org.freedesktop.portal.Screenshot interface! In fact it doesn't register the interface itself (or I didn't found the right line in code).

I don't believe this is intentional and it might be a regression of 022469529c8bc95acf222dc5a62389b04c8b1205. The hyprland.portal still lists "org.freedesktop.portal.Screenshot" as a supported interface.

This issue leads to problems in screenshot applications like Flameshot or Ksnip, as their D-Bus screenshot requests are being redirected to the Hyprland portal.

vaxerski commented 11 months ago

Screenshot was removed with 1.0 and I haven't gotten around to fixing it, yet. The only "bug" here is xdph listing screenshot as a capability

eneoli commented 11 months ago

Ah got it!

Would you mind then removing the capability until xdph is again capable of taking screenshots?

vaxerski commented 11 months ago

done: 12441a3e0f90351e594e1479f37573be5cedf388

eneoli commented 11 months ago

Thanks for the quick action!

Could you release a new version including this change as the screenshot functionality via dbus is broken when installing xdph (unless there is an alphabetical smaller portal installed that supports screenshots)?

vaxerski commented 10 months ago

https://github.com/hyprwm/xdg-desktop-portal-hyprland/releases/tag/v1.2.4