Use smithay-clipboard crate for clipboard support on Wayland

Fixes #8
This commit is contained in:
meehl committed 2025-11-07 00:59:37 +01:00
1 parent 50d4b4b09c
commit f27e83b467
9 files changed
+220 -128

No files matched your search

+3 -10
View File
@@ -3,18 +3,11 @@ use mlua::{Lua, Result as LuaResult};
pub fn copy(l: &Lua, text: String) -> LuaResult<()> {
let ctx = l.app_data_ref::<&'static Context>().unwrap();
ctx
.clipboard()
.set_text(text)
.map_err(|e| anyhow::anyhow!("{}", e))?;
ctx.window().set_clipboard_text(text);
Ok(())
}
pub fn paste(l: &Lua, _: ()) -> LuaResult<String> {
pub fn paste(l: &Lua, _: ()) -> LuaResult<Option<String>> {
let ctx = l.app_data_ref::<&'static Context>().unwrap();
let text = ctx
.clipboard()
.get_text()
.map_err(|e| anyhow::anyhow!("{}", e))?;
Ok(text)
Ok(ctx.window().get_clipboard_text())
}