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

added screenshot button #40

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions modernx.lua
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ local user_opts = {
showontop = true, -- show window on top button
showinfo = false, -- show the info button
downloadbutton = true, -- show download button for web videos
screenshotbutton = false -- show screenshot button
downloadpath = "~~desktop/mpv/downloads", -- the download path for videos
showyoutubecomments = false, -- EXPERIMENTAL - not ready
commentsdownloadpath = "~~desktop/mpv/downloads/comments", -- the download path for the comment JSON file
Expand Down Expand Up @@ -2269,6 +2270,7 @@ layouts = function ()
local showloop = user_opts.showloop
local showinfo = user_opts.showinfo
local showontop = user_opts.showontop
local showscreenshot = user_opts.screenshotbutton

if user_opts.compactmode then
user_opts.showjump = false
Expand Down Expand Up @@ -2417,6 +2419,13 @@ layouts = function ()
lo.style = osc_styles.Ctrl3
lo.visible = (osc_param.playresx >= 400 - outeroffset)
end

if showscreenshot then
lo = add_layout('screenshot')
lo.geometry = {x = osc_geo.w - 262 + (showloop and 0 or 50) + (showontop and 0 or 50) + (showinfo and 0 or 50) + (user_opts.downloadbutton and 0 or 50), y = refY - 40, an = 5, w = 24, h = 24}
lo.style = osc_styles.Ctrl3
lo.visible = (osc_param.playresx >= 300 - outeroffset)
end
end

-- Validate string type user options
Expand Down Expand Up @@ -2949,6 +2958,15 @@ function osc_init()
end
end

--screenshot
ne = new_element('screenshot', 'button')
ne.content = icons.screenshot
ne.visible = (osc_param.playresx >= 1000)
ne.eventresponder['mbtn_left_up'] =
function ()
mp.command('screenshot') -- this takes screenshots with subs, remove video to take screenshots without subs
end

--tog_info
ne = new_element('tog_info', 'button')
ne.content = icons.info
Expand Down