Commit: 03e43784c61ed926f223043d9d323f3bac6d3088
Parent: 1bd591aac6671313811bc1e18c2ce74d4780fd5d
Author: Ren Tatsumoto
Date: Tue, 3 Nov 2020 17:24:13 +0300
make clipboard work on macOS
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/subs2srs.lua b/subs2srs.lua
@@ -107,6 +107,10 @@ local function is_running_windows()
return mp.get_property('options/vo-mmcss-profile') ~= nil
end
+local function is_running_macOS()
+ return mp.get_property('options/cocoa-force-dedicated-gpu') ~= nil
+end
+
local function is_dir(path)
if is_empty(path) then
return false
@@ -518,10 +522,11 @@ end
local function init_platform_nix()
local self = {}
+ local clip = is_running_macOS() and 'LANG=en_US.UTF-8 pbcopy' or 'xclip -i -selection clipboard'
self.copy_to_clipboard = function(_, text)
if not is_empty(text) then
- local handle = io.popen('xclip -i -selection clipboard', 'w')
+ local handle = io.popen(clip, 'w')
handle:write(text)
handle:close()
end