dsnote icon indicating copy to clipboard operation
dsnote copied to clipboard

Text to active window does not work [flatpak, wayland]

Open nnbyte opened this issue 11 months ago • 8 comments

Hello,

First of all, awesome app, great job! I am still discovering/learning about it.

Everything I tested until now works, except for the "Text to active window" option. FYI, I am using your flatpak app on wayland (on openSUSE Tumbleweed with KDE Plasma).

Image

I installed the ydotool and setup the ydotoold deamon to run in the background. I set a socket under my own user so I can access it without sudo. It works for me, I can execute stuff directly. I also set an environment variable via .profile.

user@pc:~$ sudo -b ydotoold --socket-path="$HOME/.ydotool_socket" --socket-own="$(id -u):$(id -g)"
[sudo] password for root: 
user@pc:~$ Socket path: /home/user/.ydotool_socket
Socket permission: 0600
Socket ownership: UID=1000, GID=1000
READY

user@pc:~$ echo $YDOTOOL_SOCKET
/home/user/.ydotool_socket

user@pc:~$ ps auxf | grep ydotoold
user    39153  0.0  0.0   3608  1984 pts/1    S+   21:01   0:00  |   |   \_ grep --color=auto ydotoold
root       39115  0.0  0.0  17620  4252 pts/1    S    21:01   0:00  \_ sudo -b ydotoold --socket-path=/home/user/.ydotool_socket --socket-own=1000:1000
root       39116  0.0  0.0  17620  3328 pts/2    Ss+  21:01   0:00      \_ sudo -b ydotoold --socket-path=/home/user/.ydotool_socket --socket-own=1000:1000
root       39117  0.0  0.0   2684  1712 pts/2    S    21:01   0:00          \_ ydotoold --socket-path=/home/user/.ydotool_socket --socket-own=1000:1000

I allowed your flatpak to access the socket like this (i hope it is correct/enough?):

Image

What am I missing?

nnbyte avatar Jan 17 '25 20:01 nnbyte

Everything is fine with your configuration :)

The problem is that the integration with ydotool and "Insert text into active window" feature on Wayland is not yet included in the official version (and not in the beta version). It will be in the next release (v4.8.0).

mkiol avatar Jan 19 '25 11:01 mkiol

Looking forward to it! I might need a little crash course on ydotoold though... 😬

bitsByB avatar Jan 25 '25 04:01 bitsByB

Looking forward to it! I might need a little crash course on ydotoold though... 😬

nice installation tutorial https://gabrielstaples.com/ydotool-tutorial/#gsc.tab=0

nnbyte avatar Jan 25 '25 14:01 nnbyte

Great thanks a lot @nnbyte !

bitsByB avatar Jan 26 '25 00:01 bitsByB

Sorry to necro, but I got it working with ydotool on a Wayland system by just telling the Flatpak to NOT use Wayland.

I used FlatSeal and the only change I made other that what you did was this setting:

Image

Hope this helps!

axly avatar Feb 13 '25 16:02 axly

Sorry to necro, but I got it working with ydotool on a Wayland system by just telling the Flatpak to NOT use Wayland.

I used FlatSeal and the only change I made other that what you did was this setting:

Image

Hope this helps!

When I do this, the option appears in speech note , but it didn't actually output any text when it tried other apps (like Kate).

In any case, this could have been a temporary workaround until the wayland functionality is added in version 4.8..

nnbyte avatar Feb 20 '25 17:02 nnbyte

Hmm...for some reason, the built-in hotkeys don't work.

Try creating a Hotkey (if you can) that leverages 'External Applications'?

Set Speech Note as below:

Image

Then, setup a hotkey to invoke: flatpak run net.mkiol.SpeechNote --action start-listening-active-window

In my case, I use the 'Pause' button on my keyboard to invoke this. I turned off Speech Note hotkeys as you can see.

A quick web search should point you to a specific process to setup a hotkey for your particular OS / Window manager.

You mentioned Kate, so I can presume you are using KDE.

System Settings > Keyboard > Shortcuts > Add New > Command or Script

Image

Then, click on the new Command and in the right pane, click 'Add', then type the key combo you want, then Apply.

Interestingly enough, I have NOT had to setup a 'stop-listening' hotkey. Speech Note appears to stop listening automatically after a short period of silence.

You also need to make sure ydotoold is running (see above on how to set that up) and Speech Note is set to XDO for X11 (see below):

Image

axly avatar Feb 21 '25 15:02 axly

Hey! I've just pushed Speech Note 4.8.0 Beta 1 to flathub-beta channel. New version supports Insert into active window and Global keyboard shortcut natively under Wayland. So, no need to force the app into XWayland mode by disabling Wayland via FlatSeal.

A few observations:

  • ydotool deamon has to be installed and running. If something doesn't work well, in Advanced setting tab, you will see a warning message. App will try to connect to ydotool socket in the following locations: /run/user/<uid>/.ydotool_socket or /tmp/.ydotool_socket.

Image

  • Global keyboard shortcuts require a desktop environment that supports XDG Desktop Portal's Global Shortcuts API to work. This means that it will only work in KDE Plasma. GNOME has not yet implemented Global Shortcuts API.
  • Shortcuts configuration is done outside Speech Note. When you enable Global keyboard shortcuts in the settings, your DE will open window for hotkey configuration.

Image

Image

To enable flathub-beta follow these steps: https://docs.flathub.org/docs/for-users/installation#flathub-beta-repository.

mkiol avatar Feb 24 '25 19:02 mkiol

Closing. Wayland support (with ydotool daemon) is included in version 4.8.0.

mkiol avatar Jun 21 '25 11:06 mkiol