# Using Espanso on Wayland NixOS

**URL:** https://discourse.nixos.org/t/using-espanso-on-wayland-nixos/55268
**Category:** Help
**Created:** [October 31, 2024, 1:55am UTC](https://discourse.nixos.org/t/using-espanso-on-wayland-nixos/55268 "2024-10-31T01:55:27Z")
**Posts on this page:** 8
**Page:** 2

<div class="post-metadata">

### Author: ![Pierre-Thibault](https://discourse.nixos.org/user_avatar/discourse.nixos.org/pierre-thibault/32/17512_2.png) [@Pierre-Thibault](https://discourse.nixos.org/u/Pierre-Thibault)
#### Post date: [December 15, 2025, 7:50am UTC](https://discourse.nixos.org/t/using-espanso-on-wayland-nixos/55268/21 "2025-12-15T07:50:55Z")

</div>

OK. I had to restart for things to work.

---

<div class="post-metadata">

### Author: ![Pierre-Thibault](https://discourse.nixos.org/user_avatar/discourse.nixos.org/pierre-thibault/32/17512_2.png) [@Pierre-Thibault](https://discourse.nixos.org/u/Pierre-Thibault)
#### Post date: [December 17, 2025, 6:51pm UTC](https://discourse.nixos.org/t/using-espanso-on-wayland-nixos/55268/22 "2025-12-17T18:51:41Z")

</div>

The port to NixOS 25.11 is working. But Espanso is not always working after computer sleep on my machine. I had to restart it to make it work again.

Are you also experiencing this problem?

---

<div class="post-metadata">

### Author: ![Pierre-Thibault](https://discourse.nixos.org/user_avatar/discourse.nixos.org/pierre-thibault/32/17512_2.png) [@Pierre-Thibault](https://discourse.nixos.org/u/Pierre-Thibault)
#### Post date: [January 5, 2026, 12:19am UTC](https://discourse.nixos.org/t/using-espanso-on-wayland-nixos/55268/23 "2026-01-05T00:19:33Z")

</div>

I created a service to restart Espanso after sleep. It works with dbus so it depends on Gnome.

> <https://github.com/Pierre-Thibault/nixos-config/blob/fe8c3d4bef86af419c346b5454742757f0a84129/modules/services/restart_espanso_after_sleep.nix>

---

<div class="post-metadata">

### Author: ![Geobomatic](https://discourse.nixos.org/user_avatar/discourse.nixos.org/geobomatic/32/35770_2.png) [@Geobomatic](https://discourse.nixos.org/u/Geobomatic)
#### Post date: [January 10, 2026, 8:04pm UTC](https://discourse.nixos.org/t/using-espanso-on-wayland-nixos/55268/24 "2026-01-10T20:04:18Z")

</div>

```auto

services.espanso = {
      enable = true;
      package = pkgs-unstable.espanso-wayland;
    };

```

on Niri, but nothing triggers :-/

EDIT: just found out that on wayland, need to set the layout if non-US and I’m not US ^^ it works now

---

<div class="post-metadata">

### Author: ![Pierre-Thibault](https://discourse.nixos.org/user_avatar/discourse.nixos.org/pierre-thibault/32/17512_2.png) [@Pierre-Thibault](https://discourse.nixos.org/u/Pierre-Thibault)
#### Post date: [January 21, 2026, 4:13am UTC](https://discourse.nixos.org/t/using-espanso-on-wayland-nixos/55268/25 "2026-01-21T04:13:47Z")

</div>

Even with the service, Espanso is not always working even when its status is saying that it is running. So, I am removing it. ☹

---

<div class="post-metadata">

### Author: ![Geobomatic](https://discourse.nixos.org/user_avatar/discourse.nixos.org/geobomatic/32/35770_2.png) [@Geobomatic](https://discourse.nixos.org/u/Geobomatic)
#### Post date: [January 21, 2026, 10:11am UTC](https://discourse.nixos.org/t/using-espanso-on-wayland-nixos/55268/26 "2026-01-21T10:11:28Z")

</div>

Have you tried to change the backend setting? For Zen I had to add a per-app config to force clipboard, and set `inject` as the default one (instead of auto)

---

<div class="post-metadata">

### Author: ![Pierre-Thibault](https://discourse.nixos.org/user_avatar/discourse.nixos.org/pierre-thibault/32/17512_2.png) [@Pierre-Thibault](https://discourse.nixos.org/u/Pierre-Thibault)
#### Post date: [January 21, 2026, 4:59pm UTC](https://discourse.nixos.org/t/using-espanso-on-wayland-nixos/55268/27 "2026-01-21T16:59:12Z")

</div>

No. I just moved to Niri from Gnome. Maybe, I’ll try back.

---

<div class="post-metadata">

### Author: ![bew](https://discourse.nixos.org/user_avatar/discourse.nixos.org/bew/32/2091_2.png) [@bew](https://discourse.nixos.org/u/bew)
#### Post date: [January 23, 2026, 8:42am UTC](https://discourse.nixos.org/t/using-espanso-on-wayland-nixos/55268/28 "2026-01-23T08:42:52Z")

</div>

You might be interested in this PR, it solved ~all my issues with auto-pasting in apps on Wayland (KDE)

> <https://github.com/espanso/espanso/pull/2612>
>
> Hello!
> 
> (note: this was fully Human-made, zero AI involved)
> 
> \> \[!NOTE\]
> \> Ed…it: Skimming GH issues mentioning \`Wayland\`, I think this PR could fix the following issues:
> \> #2428 #2162 #2270 #2497 #2582 #1670 #2340 #901 #1367
> \> (maybe more, to be confirmed)
> 
> 
> 
> \### Context
> 
> Since I had to switch to Wayland a few months ago, I've always had trouble with Espanso and attributed it to some weirdness around Wayland, protocol instabilities, KDE Plasma6.. (and the missing capability on NixOS)
> 
> For example some expansions would work in Firefox but not all, and almost no expansions would work in Wezterm (the trigger is removed but the replacement is not pasted).
> Other times it would simply paste the wrong clipboard data, as if Espanso didn't set the clipboard at all.
> And when I had something like \`foo\` in my clipboard, tried an expansion that failed, I couldn't paste the original \`foo\` that was supposed to be restored by Espanso after the expansion.
> 
> Since latest NixOS 25.11 release, the capability issue was fully resolved and I was still having these weird issues..
> The first day of 2026 motivated me to dive in and actually fix this! 😀
> 
> 
> \### Findings
> 
> With \`WAYLAND\_DEBUG=1\` and some additional debug logs I've found that the MIME type of the copied text is set correctly then immediately overwritten to a bad type:
> \`\`\`
> ...
> \[442709.543\] {Default Queue} -\> wl\_data\_device\_manager#7.get\_data\_device(new id wl\_data\_device#3, wl\_seat#6)
> \[442741.732\] {Default Queue} -\> wl\_data\_device\_manager#7.create\_data\_source(new id wl\_data\_source#11)
> ...
> 
> !! NOTE: The clipboard is set here
> \[442747.844\] {Default Queue} -\> wl\_data\_device#3.set\_selection(wl\_data\_source#11, 35716)
> 
> !! NOTE: The data type is set correctly here (\`offer\` line)
> \[442747.880\] {Default Queue} wl\_data\_device#3.data\_offer(new id wl\_data\_offer#4278190080)
> \[442747.891\] {Default Queue} wl\_data\_offer#4278190080.offer("text/plain;charset=utf-8") // \<- here
> \[442747.900\] {Default Queue} wl\_data\_device#3.selection(wl\_data\_offer#4278190080)
> ...
> 
> !! BAD: The data type is ~immediately overwritten to a bad type
> \[442748.373\] {Default Queue} wl\_data\_device#3.data\_offer(new id wl\_data\_offer#4278190081)
> \[442748.383\] {Default Queue} wl\_data\_offer#4278190081.offer("l�4��U") // \<- here
> \[442748.390\] {Default Queue} wl\_data\_device#3.selection(wl\_data\_offer#4278190081)
> ...
> \`\`\`
> And this weird MIME type was also used when restoring the original clipboard content, easy to validate with \`wl-paste --list-types\`.
> 
> In Wezterm, I've found that only selection with MIME type \`text/plain;charset=utf-8\` can be pasted, so the weird \`l�4��U\` type doesn't cut it and nothing can be pasted after Espanso changed the clipboard.
> 
> It probably worked better in Firefox because the browser have a lot more flexibility on the kind of data that can be pasted, potentially doing its own detection.
> 
> 
> \### The fix
> 
> I'm not exactly sure why the MIME type was immediately overwritten after being correct for less than a second.
> I tried to disable Klipper (KDE's clipboard manager) which might have caused this but I still had the same issue.
> 👉 Anyway, manually setting the MIME type fixes everything for me, and all my expansions work everywhere.
> 
> \### Thoughts
> 
> The clipboard restoration might need a better impl, to actually restore the original MIME type instead of forcing plain text. I'd prefer to do this in a separate PR though.
> 
> Also is there a reason the \`wl-clipboard\` crate isn't used, instead of calling \`wl-copy\` & \`wl-paste\` cli?
> (using the cli is probably easier to do / think about 👀)

[Previous page](https://discourse.nixos.org/t/using-espanso-on-wayland-nixos/55268.md?page=1)
