Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global Shortcuts functionality crashes on wayland wlroots! #635

Open
RyanOrigens opened this issue Dec 3, 2023 · 14 comments
Open

Global Shortcuts functionality crashes on wayland wlroots! #635

RyanOrigens opened this issue Dec 3, 2023 · 14 comments
Labels
bug Something isn't working

Comments

@RyanOrigens
Copy link

RyanOrigens commented Dec 3, 2023

Whenever i try to utilize the OCR functionality through the global shortcuts it immediately crashes;

├── method void io.crow_translate.CrowTranslate.MainWindow.recognizeScreenArea();
├── method void io.crow_translate.CrowTranslate.MainWindow.translateScreenArea();
├── method void io.crow_translate.CrowTranslate.MainWindow.delayedRecognizeScreenArea();
├── method void io.crow_translate.CrowTranslate.MainWindow.delayedTranslateScreenArea();

If i try to launch the functionality through the gui clicking on the icons it works;

Also when i try to launch translate selection in popup mode, if it loses the focus a couple times it also crashes, the only way to utilize it by now is utilizing it with the "Translation Mode: Main Window"

├── method void io.crow_translate.CrowTranslate.MainWindow.translateSelection();

Tested on Sway/Hyprland!

@RyanOrigens RyanOrigens added the bug Something isn't working label Dec 3, 2023
@RyanOrigens RyanOrigens changed the title Global Shortcuts functionality crashed on wayland wlroots! Global Shortcuts functionality crashes on wayland wlroots! Dec 3, 2023
@Shatur
Copy link
Member

Shatur commented Dec 3, 2023

Can't reproduce on my machine. Probably something specific to Wayland. Maybe a bug in our OCR provider for Wayland.

@RyanOrigens
Copy link
Author

This is the error when i try to execute recognizeScreenArea from the terminal,

Error: org.freedesktop.DBus.Error.NoReply
Message recipient disconnected from message bus without replying

@Shatur
Copy link
Member

Shatur commented Dec 9, 2023

For some reason it can't access xdg desktop portal to request the screen area.
Another limitation of Wayland, I implemented different providers for different DE's: https://github.com/crow-translate/crow-translate/blob/master/src/ocr/screengrabbers/waylandgnomescreengrabber.cpp
You can try to execute the DBus command I execute from the code (to get the area) and see if it works.

@RyanOrigens
Copy link
Author

I didn't really understand what to do, i tried excuting dbus-send --type=method_call --dest=org.gnome.Shell /org/gnome/Shell/Screenshot org.gnome.Shell.Screenshot.Screenshot, but of course nothing happened.

@Shatur
Copy link
Member

Shatur commented Dec 9, 2023

Check if you even have this D-Bus interface. Something like this:

qdbus org.gnome.Shell /org/gnome/Shell/Screenshot

@RyanOrigens
Copy link
Author

Service 'org.gnome.Shell' does not exist.

@RyanOrigens
Copy link
Author

Dbus is here i can exec other keybindings. "dbus-send --type=method_call --dest=io.crow_translate.CrowTranslate /io/crow_translate/CrowTranslate/MainWindow io.crow_translate.CrowTranslate.MainWindow.translateSelection"

@Shatur
Copy link
Member

Shatur commented Dec 9, 2023

Expected, it's because you have Sway. Try this:

qdbus org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop

@RyanOrigens
Copy link
Author

signal void org.freedesktop.DBus.Properties.PropertiesChanged(QString interface_name, QVariantMap changed_properties, QStringList invalidated_properties)
method QDBusVariant org.freedesktop.DBus.Properties.Get(QString interface_name, QString property_name)
method QVariantMap org.freedesktop.DBus.Properties.GetAll(QString interface_name)
method void org.freedesktop.DBus.Properties.Set(QString interface_name, QString property_name, QDBusVariant value)
method QString org.freedesktop.DBus.Introspectable.Introspect()
method QString org.freedesktop.DBus.Peer.GetMachineId()
method void org.freedesktop.DBus.Peer.Ping()
property read uint org.freedesktop.portal.Inhibit.version
signal void org.freedesktop.portal.Inhibit.StateChanged(QDBusObjectPath session_handle, QVariantMap state)
method QDBusObjectPath org.freedesktop.portal.Inhibit.CreateMonitor(QString window, QVariantMap options)
method QDBusObjectPath org.freedesktop.portal.Inhibit.Inhibit(QString window, uint flags, QVariantMap options)
method void org.freedesktop.portal.Inhibit.QueryEndResponse(QDBusObjectPath session_handle)
property read uint org.freedesktop.portal.Location.version
signal void org.freedesktop.portal.Location.LocationUpdated(QDBusObjectPath session_handle, QVariantMap location)
method QDBusObjectPath org.freedesktop.portal.Location.CreateSession(QVariantMap options)
method QDBusObjectPath org.freedesktop.portal.Location.Start(QDBusObjectPath session_handle, QString parent_window, QVariantMap options)
property read uint org.freedesktop.portal.Notification.version
signal void org.freedesktop.portal.Notification.ActionInvoked(QString id, QString action, QVariantList parameter)
method void org.freedesktop.portal.Notification.AddNotification(QString id, QVariantMap notification)
method void org.freedesktop.portal.Notification.RemoveNotification(QString id)
property read uint org.freedesktop.portal.Screenshot.version
method QDBusObjectPath org.freedesktop.portal.Screenshot.PickColor(QString parent_window, QVariantMap options)
method QDBusObjectPath org.freedesktop.portal.Screenshot.Screenshot(QString parent_window, QVariantMap options)
property read uint org.freedesktop.portal.Account.version
method QDBusObjectPath org.freedesktop.portal.Account.GetUserInformation(QString window, QVariantMap options)
property read uint org.freedesktop.portal.NetworkMonitor.version
signal void org.freedesktop.portal.NetworkMonitor.changed()
method bool org.freedesktop.portal.NetworkMonitor.CanReach(QString hostname, uint port)
method bool org.freedesktop.portal.NetworkMonitor.GetAvailable()
method uint org.freedesktop.portal.NetworkMonitor.GetConnectivity()
method bool org.freedesktop.portal.NetworkMonitor.GetMetered()
method QVariantMap org.freedesktop.portal.NetworkMonitor.GetStatus()
property read uint org.freedesktop.portal.Print.version
method QDBusObjectPath org.freedesktop.portal.Print.PreparePrint(QString parent_window, QString title, QVariantMap settings, QVariantMap page_setup, QVariantMap options)
method QDBusObjectPath org.freedesktop.portal.Print.Print(QString parent_window, QString title, QDBusUnixFileDescriptor fd, QVariantMap options)
property read uint org.freedesktop.portal.Settings.version
signal void org.freedesktop.portal.Settings.SettingChanged(QString namespace, QString key, QDBusVariant value)
method QDBusVariant org.freedesktop.portal.Settings.Read(QString namespace, QString key)
method {D-Bus type "a{sa{sv}}"} org.freedesktop.portal.Settings.ReadAll(QStringList namespaces)
method QDBusVariant org.freedesktop.portal.Settings.ReadOne(QString namespace, QString key)
property read bool org.freedesktop.portal.GameMode.Active
property read uint org.freedesktop.portal.GameMode.version
method int org.freedesktop.portal.GameMode.QueryStatus(int pid)
method int org.freedesktop.portal.GameMode.QueryStatusByPIDFd(QDBusUnixFileDescriptor target, QDBusUnixFileDescriptor requester)
method int org.freedesktop.portal.GameMode.QueryStatusByPid(int target, int requester)
method int org.freedesktop.portal.GameMode.RegisterGame(int pid)
method int org.freedesktop.portal.GameMode.RegisterGameByPIDFd(QDBusUnixFileDescriptor target, QDBusUnixFileDescriptor requester)
method int org.freedesktop.portal.GameMode.RegisterGameByPid(int target, int requester)
method int org.freedesktop.portal.GameMode.UnregisterGame(int pid)
method int org.freedesktop.portal.GameMode.UnregisterGameByPIDFd(QDBusUnixFileDescriptor target, QDBusUnixFileDescriptor requester)
method int org.freedesktop.portal.GameMode.UnregisterGameByPid(int target, int requester)
property read uint org.freedesktop.portal.MemoryMonitor.version
signal void org.freedesktop.portal.MemoryMonitor.LowMemoryWarning(uchar level)
property read uint org.freedesktop.portal.OpenURI.version
method QDBusObjectPath org.freedesktop.portal.OpenURI.OpenDirectory(QString parent_window, QDBusUnixFileDescriptor fd, QVariantMap options)
method QDBusObjectPath org.freedesktop.portal.OpenURI.OpenFile(QString parent_window, QDBusUnixFileDescriptor fd, QVariantMap options)
method QDBusObjectPath org.freedesktop.portal.OpenURI.OpenURI(QString parent_window, QString uri, QVariantMap options)
property read int org.freedesktop.portal.Realtime.MaxRealtimePriority
property read int org.freedesktop.portal.Realtime.MinNiceLevel
property read qlonglong org.freedesktop.portal.Realtime.RTTimeUSecMax
property read uint org.freedesktop.portal.Realtime.version
method void org.freedesktop.portal.Realtime.MakeThreadHighPriorityWithPID(qulonglong process, qulonglong thread, int priority)
method void org.freedesktop.portal.Realtime.MakeThreadRealtimeWithPID(qulonglong process, qulonglong thread, uint priority)
property read uint org.freedesktop.portal.DynamicLauncher.SupportedLauncherTypes
property read uint org.freedesktop.portal.DynamicLauncher.version
method QString org.freedesktop.portal.DynamicLauncher.GetDesktopEntry(QString desktop_file_id)
method QDBusVariant org.freedesktop.portal.DynamicLauncher.GetIcon(QString desktop_file_id, QString& icon_format, uint& icon_size)
method void org.freedesktop.portal.DynamicLauncher.Install(QString token, QString desktop_file_id, QString desktop_entry, QVariantMap options)
method void org.freedesktop.portal.DynamicLauncher.Launch(QString desktop_file_id, QVariantMap options)
method QDBusObjectPath org.freedesktop.portal.DynamicLauncher.PrepareInstall(QString parent_window, QString name, QDBusVariant icon_v, QVariantMap options)
method QString org.freedesktop.portal.DynamicLauncher.RequestInstallToken(QString name, QDBusVariant icon_v, QVariantMap options)
method void org.freedesktop.portal.DynamicLauncher.Uninstall(QString desktop_file_id, QVariantMap options)
property read bool org.freedesktop.portal.Camera.IsCameraPresent
property read uint org.freedesktop.portal.Camera.version
method QDBusObjectPath org.freedesktop.portal.Camera.AccessCamera(QVariantMap options)
method QDBusUnixFileDescriptor org.freedesktop.portal.Camera.OpenPipeWireRemote(QVariantMap options)
property read uint org.freedesktop.portal.Device.version
method QDBusObjectPath org.freedesktop.portal.Device.AccessDevice(uint pid, QStringList devices, QVariantMap options)
property read uint org.freedesktop.portal.PowerProfileMonitor.version
property read uint org.freedesktop.portal.GlobalShortcuts.version
signal void org.freedesktop.portal.GlobalShortcuts.Activated(QDBusObjectPath session_handle, QString shortcut_id, qulonglong timestamp, QVariantMap options)
signal void org.freedesktop.portal.GlobalShortcuts.Deactivated(QDBusObjectPath session_handle, QString shortcut_id, qulonglong timestamp, QVariantMap options)
signal void org.freedesktop.portal.GlobalShortcuts.ShortcutsChanged(QDBusObjectPath session_handle, {D-Bus type "a(sa{sv})"} shortcuts)
method QDBusObjectPath org.freedesktop.portal.GlobalShortcuts.BindShortcuts(QDBusObjectPath session_handle, {D-Bus type "a(sa{sv})"} shortcuts, QString parent_window, QVariantMap options)
method QDBusObjectPath org.freedesktop.portal.GlobalShortcuts.CreateSession(QVariantMap options)
method QDBusObjectPath org.freedesktop.portal.GlobalShortcuts.ListShortcuts(QDBusObjectPath session_handle, QVariantMap options)
property read uint org.freedesktop.portal.ScreenCast.AvailableCursorModes
property read uint org.freedesktop.portal.ScreenCast.AvailableSourceTypes
property read uint org.freedesktop.portal.ScreenCast.version
method QDBusObjectPath org.freedesktop.portal.ScreenCast.CreateSession(QVariantMap options)
method QDBusUnixFileDescriptor org.freedesktop.portal.ScreenCast.OpenPipeWireRemote(QDBusObjectPath session_handle, QVariantMap options)
method QDBusObjectPath org.freedesktop.portal.ScreenCast.SelectSources(QDBusObjectPath session_handle, QVariantMap options)
method QDBusObjectPath org.freedesktop.portal.ScreenCast.Start(QDBusObjectPath session_handle, QString parent_window, QVariantMap options)
property read uint org.freedesktop.portal.Email.version
method QDBusObjectPath org.freedesktop.portal.Email.ComposeEmail(QString parent_window, QVariantMap options)
property read uint org.freedesktop.portal.Trash.version
method uint org.freedesktop.portal.Trash.TrashFile(QDBusUnixFileDescriptor fd)
property read uint org.freedesktop.portal.ProxyResolver.version
method QStringList org.freedesktop.portal.ProxyResolver.Lookup(QString uri)
property read uint org.freedesktop.portal.FileChooser.version
method QDBusObjectPath org.freedesktop.portal.FileChooser.OpenFile(QString parent_window, QString title, QVariantMap options)
method QDBusObjectPath org.freedesktop.portal.FileChooser.SaveFile(QString parent_window, QString title, QVariantMap options)
method QDBusObjectPath org.freedesktop.portal.FileChooser.SaveFiles(QString parent_window, QString title, QVariantMap options)

@Shatur
Copy link
Member

Shatur commented Dec 9, 2023

Now check if you have the following method:

qdbus org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.Screenshot

@RyanOrigens
Copy link
Author

Error: org.freedesktop.DBus.Error.UnknownMethod
No such interface “org.freedesktop.portal” on object at path /org/freedesktop/portal/desktop

@Shatur
Copy link
Member

Shatur commented Dec 9, 2023

Not sure what happens here, it's either something changed on Sway or something wrong with your configuration.
Can't help much here, sorry.

@RyanOrigens
Copy link
Author

i'm on hyprland

@Shatur
Copy link
Member

Shatur commented Dec 9, 2023

Then maybe it doesn't have this interface and in order to retrieve a screenshot you need other D-Bus command.
Wayland is quite painful for developers because things like this aren't standardized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants