mirror of https://github.com/mpv-player/mpv
{console,ytdl_hook}: use the platform property
The console.lua check is still kind of dumb since we check an environment variable to distinguish between wayland and x11, but otherwise it should be better in theory.
This commit is contained in:
parent
80feac62f1
commit
c5d1230517
|
@ -32,12 +32,9 @@ local opts = {
|
|||
}
|
||||
|
||||
function detect_platform()
|
||||
local o = {}
|
||||
-- Kind of a dumb way of detecting the platform but whatever
|
||||
if mp.get_property_native('options/vo-mmcss-profile', o) ~= o then
|
||||
return 'windows'
|
||||
elseif mp.get_property_native('options/macos-force-dedicated-gpu', o) ~= o then
|
||||
return 'macos'
|
||||
local platform = mp.get_property_native('platform')
|
||||
if platform == 'darwin' or platform == 'windows' then
|
||||
return platform
|
||||
elseif os.getenv('WAYLAND_DISPLAY') then
|
||||
return 'wayland'
|
||||
end
|
||||
|
@ -48,7 +45,7 @@ end
|
|||
local platform = detect_platform()
|
||||
if platform == 'windows' then
|
||||
opts.font = 'Consolas'
|
||||
elseif platform == 'macos' then
|
||||
elseif platform == 'darwin' then
|
||||
opts.font = 'Menlo'
|
||||
else
|
||||
opts.font = 'monospace'
|
||||
|
@ -677,7 +674,7 @@ function get_clipboard(clip)
|
|||
if not res.error then
|
||||
return res.stdout
|
||||
end
|
||||
elseif platform == 'macos' then
|
||||
elseif platform == 'darwin' then
|
||||
local res = utils.subprocess({
|
||||
args = { 'pbpaste' },
|
||||
playback_only = false,
|
||||
|
|
|
@ -91,7 +91,7 @@ local function map_codec_to_mpv(codec)
|
|||
end
|
||||
|
||||
local function platform_is_windows()
|
||||
return package.config:sub(1,1) == "\\"
|
||||
return mp.get_property_native("platform") == "windows"
|
||||
end
|
||||
|
||||
local function exec(args)
|
||||
|
|
Loading…
Reference in New Issue