Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not detecting Mac OS #12

Closed
1 of 3 tasks
mrfragger opened this issue Sep 28, 2023 · 2 comments
Closed
1 of 3 tasks

Not detecting Mac OS #12

mrfragger opened this issue Sep 28, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@mrfragger
Copy link

mrfragger commented Sep 28, 2023

Script(s)

clipshot.lua

Description

Most likely will work if it detects Mac OS but it's returning xclip which is Linux. This is on a Mac OS Monterey 12.6.8

 2.890][v][cplayer] Starting screenshot: '/tmp/mpv-screenshot.jpeg'
[   2.891][d][cplayer] Run command: script-binding, flags=73, args=[name="clipshot/clipshot-subs"]
[   2.892][v][screenshot] using 2 threads for scaling
[   2.915][v][screenshot] Using zimg.
[   2.924][d][screenshot] mapped color params:
[   2.924][d][screenshot]   trc = iec61966-2-1
[   2.924][d][screenshot]   primaries = bt709
[   2.924][d][screenshot]   range = pc
[   2.924][d][screenshot]   colorspace = bt470bg
[   2.924][d][screenshot]   chroma_location = center
[   2.945][i][cplayer] Screenshot: '/tmp/mpv-screenshot.jpeg'
[   2.946][d][cplayer] Run command: run, flags=64, args=[command="xclip", args="-sel", args="c", args="-t", args="image/jpeg", args="-i", args="/tmp/mpv-screenshot.jpeg"]

If I manually do it it works just fine
osascript -e 'set the clipboard to (read (POSIX file "/Users/username/Desktop/mpv-shot0001.jpg") as JPEG picture)'

osascript -e 'clipboard info'
JPEG picture, 32754, «class 8BPS», 884810, GIF picture, 124456, «class jp2 », 100608, TIFF picture, 2081938, «class PNGf», 220769, «class BMP », 2080134, «class TPIC», 712791

I use this clipshot on Linux Mint and it works great.

Possible Fix

Not sure how to use SmartCopyPaste code to change it to get Wayland and not just Linux.

if not o.device or o.device == 'auto' then
	if os.getenv('windir') ~= nil then
		o.device = 'windows'
	elseif os.execute '[ -d "/Applications" ]' == 0 and os.execute '[ -d "/Library" ]' == 0 or os.execute '[ -d "/Applications" ]' == true and os.execute '[ -d "/Library" ]' == true then
		o.device = 'mac'
	else
		o.device = 'linux'
  end

Some more detect OS code

-- this code was taken from mpv's console.lua:
-- https://github.com/mpv-player/mpv/blob/master/player/lua/console.lua
local 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'
    elseif os.getenv('WAYLAND_DISPLAY') then
        return 'wayland'
    end
    return 'x11'
end

No response

Operating System(s)

  • Windows
  • Linux
  • macOS

MPV version

0.36

Lua version

No response

@mrfragger mrfragger added the bug Something isn't working label Sep 28, 2023
@ObserverOfTime
Copy link
Owner

Fixed in ffb516b

@mrfragger
Copy link
Author

it works great now on Mac OS...thanks a bunch

@ObserverOfTime ObserverOfTime moved this from Todo to Done in MPV Scripts Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

2 participants