mirror of https://github.com/mpv-player/mpv
console: use wl-paste on Wayland
This commit is contained in:
parent
bff5416dae
commit
7ca14d646c
|
@ -36,7 +36,7 @@ INSERT
|
||||||
Toggle insert mode.
|
Toggle insert mode.
|
||||||
|
|
||||||
Shift+INSERT
|
Shift+INSERT
|
||||||
Paste text (uses the primary selection on X11).
|
Paste text (uses the primary selection on X11 and Wayland).
|
||||||
|
|
||||||
TAB
|
TAB
|
||||||
Complete the command or property name at the cursor.
|
Complete the command or property name at the cursor.
|
||||||
|
@ -54,7 +54,7 @@ Ctrl+U
|
||||||
Delete text from the cursor to the beginning of the line.
|
Delete text from the cursor to the beginning of the line.
|
||||||
|
|
||||||
Ctrl+V
|
Ctrl+V
|
||||||
Paste text (uses the clipboard on X11).
|
Paste text (uses the clipboard on X11 and Wayland).
|
||||||
|
|
||||||
Ctrl+W
|
Ctrl+W
|
||||||
Delete text from the cursor to the beginning of the current word.
|
Delete text from the cursor to the beginning of the current word.
|
||||||
|
|
|
@ -36,6 +36,8 @@ function detect_platform()
|
||||||
return 'windows'
|
return 'windows'
|
||||||
elseif mp.get_property_native('options/macos-force-dedicated-gpu', o) ~= o then
|
elseif mp.get_property_native('options/macos-force-dedicated-gpu', o) ~= o then
|
||||||
return 'macos'
|
return 'macos'
|
||||||
|
elseif os.getenv('WAYLAND_DISPLAY') then
|
||||||
|
return 'wayland'
|
||||||
end
|
end
|
||||||
return 'x11'
|
return 'x11'
|
||||||
end
|
end
|
||||||
|
@ -609,6 +611,14 @@ function get_clipboard(clip)
|
||||||
if not res.error then
|
if not res.error then
|
||||||
return res.stdout
|
return res.stdout
|
||||||
end
|
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
|
elseif platform == 'windows' then
|
||||||
local res = utils.subprocess({
|
local res = utils.subprocess({
|
||||||
args = { 'powershell', '-NoProfile', '-Command', [[& {
|
args = { 'powershell', '-NoProfile', '-Command', [[& {
|
||||||
|
@ -647,7 +657,7 @@ function get_clipboard(clip)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Paste text from the window-system's clipboard. 'clip' determines whether the
|
-- 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)
|
function paste(clip)
|
||||||
local text = get_clipboard(clip)
|
local text = get_clipboard(clip)
|
||||||
local before_cur = line:sub(1, cursor - 1)
|
local before_cur = line:sub(1, cursor - 1)
|
||||||
|
|
Loading…
Reference in New Issue