diff options
author | Guido Cella <guido@guidocella.xyz> | 2020-12-14 20:18:55 +0100 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2020-12-14 22:43:34 +0000 |
commit | 7ca14d646c7e405f3fb1e44600e2a67fc4607238 (patch) | |
tree | a2573588b6a5de87877c8bbf6a7162f0329023a8 /player | |
parent | bff5416daebcede8ba704f87c3b569f24fefcf3e (diff) | |
download | mpv-7ca14d646c7e405f3fb1e44600e2a67fc4607238.tar.bz2 mpv-7ca14d646c7e405f3fb1e44600e2a67fc4607238.tar.xz |
console: use wl-paste on Wayland
Diffstat (limited to 'player')
-rw-r--r-- | player/lua/console.lua | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/player/lua/console.lua b/player/lua/console.lua index a483bbe1f4..2020952840 100644 --- a/player/lua/console.lua +++ b/player/lua/console.lua @@ -36,6 +36,8 @@ function detect_platform() return 'windows' elseif mp.get_property_native('options/macos-force-dedicated-gpu', o) ~= o then return 'macos' + elseif os.getenv('WAYLAND_DISPLAY') then + return 'wayland' end return 'x11' end @@ -609,6 +611,14 @@ function get_clipboard(clip) if not res.error then return res.stdout end + elseif platform == 'wayland' then + local res = utils.subprocess({ + args = { 'wl-paste', clip and '-n' or '-np' }, + playback_only = false, + }) + if not res.error then + return res.stdout + end elseif platform == 'windows' then local res = utils.subprocess({ args = { 'powershell', '-NoProfile', '-Command', [[& { @@ -647,7 +657,7 @@ function get_clipboard(clip) end -- Paste text from the window-system's clipboard. 'clip' determines whether the --- clipboard or the primary selection buffer is used (on X11 only.) +-- clipboard or the primary selection buffer is used (on X11 and Wayland only.) function paste(clip) local text = get_clipboard(clip) local before_cur = line:sub(1, cursor - 1) |