diff --git a/Cargo.lock b/Cargo.lock
index e84398600..9bddf9aac 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -521,16 +521,6 @@ version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba"
-[[package]]
-name = "calloop"
-version = "0.7.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9d0a1340115d6bd81e1066469091596a339f68878a2ce3c2f39e546607d22131"
-dependencies = [
- "log",
- "nix 0.19.1",
-]
-
[[package]]
name = "cassowary"
version = "0.3.0"
@@ -3878,7 +3868,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec783683499a2cfc85b6df3d04f83b1907b5cbd98a1aed44667dbdf1eac4e64c"
dependencies = [
"bitflags",
- "calloop",
"dlib",
"lazy_static",
"log",
@@ -4687,7 +4676,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2907bd297eef464a95ba9349ea771611771aa285b932526c633dc94d5400a8e2"
dependencies = [
"dlib",
- "lazy_static",
"pkg-config",
]
@@ -5139,6 +5127,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"async-channel",
+ "async-io",
"async-task",
"async-trait",
"bitflags",
diff --git a/docs/changelog.md b/docs/changelog.md
index a223e23b6..5a3c45a5b 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -48,6 +48,7 @@ As features stabilize some brief notes about them will accumulate here.
* Improved: DEC Special Graphics mode conformance and complete coverage of the graphics character set. Thanks to [Autumn Lamonte](https://gitlab.com/klamonte)! [#891](https://github.com/wez/wezterm/pull/891)
* Fixed: click to focus now focuses the pane under the mouse cursor [#881](https://github.com/wez/wezterm/issues/881)
* Removed: `Parasio Dark` color scheme; it was a duplicate of the correctly named `Paraiso Dark` scheme. Thanks to [@adrian5](https://github.com/adrian5)! [#906](https://github.com/wez/wezterm/pull/906)
+* Fixed: key repeat on Wayland now respects the system specified key repeat rate, and doesn't "stick". [#669](https://github.com/wez/wezterm/issues/669)
### 20210502-154244-3f7122cb
diff --git a/window/Cargo.toml b/window/Cargo.toml
index f5e2c5814..743912cf3 100644
--- a/window/Cargo.toml
+++ b/window/Cargo.toml
@@ -20,6 +20,7 @@ wayland = ["wayland-client", "smithay-client-toolkit", "wayland-egl", "wayland-p
[dependencies]
async-channel = "1.6"
+async-io = "1.1"
async-task = "4.0"
async-trait = "0.1"
anyhow = "1.0"
@@ -66,7 +67,7 @@ xcb-util = { features = [ "cursor", "image", "icccm", "ewmh", "keysyms"], versio
xkbcommon = { version = "0.5", features = ["x11", "wayland"], git="https://github.com/wez/xkbcommon-rs.git", rev="01a0a0cd5663405e6e4abb1ad3add9add1496f58"}
mio = "0.6"
libc = "0.2"
-smithay-client-toolkit = {version = "0.14", features=["calloop"], optional=true}
+smithay-client-toolkit = {version = "0.14", default-features=false, optional=true}
wayland-protocols = {version="0.28", optional=true}
wayland-client = {version="0.28", optional=true}
wayland-egl = {version="0.28", optional=true}
diff --git a/window/src/os/wayland/connection.rs b/window/src/os/wayland/connection.rs
index 74f2fe6f3..93176fe81 100644
--- a/window/src/os/wayland/connection.rs
+++ b/window/src/os/wayland/connection.rs
@@ -1,22 +1,25 @@
#![allow(dead_code)]
-use super::keyboard::KeyboardDispatcher;
use super::pointer::*;
use super::window::*;
use crate::connection::ConnectionOps;
+use crate::os::x11::keyboard::Keyboard;
use crate::spawn::*;
use crate::Connection;
-use anyhow::{anyhow, bail, Context};
+use anyhow::{bail, Context};
+use mio::unix::EventedFd;
+use mio::{Evented, Events, Poll, PollOpt, Ready, Token};
use smithay_client_toolkit as toolkit;
use std::cell::RefCell;
use std::collections::HashMap;
+use std::io::Read;
+use std::os::unix::io::FromRawFd;
use std::rc::Rc;
use std::sync::atomic::AtomicUsize;
-use std::time::Duration;
use toolkit::environment::Environment;
-use toolkit::reexports::calloop::{EventLoop, EventSource, Interest, Mode, Poll, Readiness, Token};
use toolkit::reexports::client::Display;
use toolkit::seat::SeatListener;
-use toolkit::WaylandSource;
+use wayland_client::protocol::wl_keyboard::{Event as WlKeyboardEvent, KeymapFormat, WlKeyboard};
+use wayland_client::{EventQueue, Main};
toolkit::default_environment!(MyEnvironment, desktop);
@@ -35,10 +38,19 @@ pub struct WaylandConnection {
// must be ahead of the rest.
pub(crate) gl_connection: RefCell