mirror of
https://github.com/Derisis13/dotfiles.git
synced 2025-12-06 19:32:50 +01:00
feat: mpv config from various scripts
This commit is contained in:
179
mpv/input.conf
Executable file
179
mpv/input.conf
Executable file
@@ -0,0 +1,179 @@
|
||||
# mpv keybindings
|
||||
#
|
||||
# Location of user-defined bindings: ~/.config/mpv/input.conf
|
||||
#
|
||||
# Lines starting with # are comments. Use SHARP to assign the # key.
|
||||
# Copy this file and uncomment and edit the bindings you want to change.
|
||||
#
|
||||
# List of commands and further details: DOCS/man/input.rst
|
||||
# List of special keys: --input-keylist
|
||||
# Keybindings testing mode: mpv --input-test --force-window --idle
|
||||
#
|
||||
# Use 'ignore' to unbind a key fully (e.g. 'ctrl+a ignore').
|
||||
#
|
||||
# Strings need to be quoted and escaped:
|
||||
# KEY show-text "This is a single backslash: \\ and a quote: \" !"
|
||||
#
|
||||
# You can use modifier-key combinations like Shift+Left or Ctrl+Alt+x with
|
||||
# the modifiers Shift, Ctrl, Alt and Meta (may not work on the terminal).
|
||||
#
|
||||
# The default keybindings are hardcoded into the mpv binary.
|
||||
# You can disable them completely with: --no-input-default-bindings
|
||||
|
||||
# Developer note:
|
||||
# On compilation, this file is baked into the mpv binary, and all lines are
|
||||
# uncommented (unless '#' is followed by a space) - thus this file defines the
|
||||
# default key bindings.
|
||||
|
||||
# If this is enabled, treat all the following bindings as default.
|
||||
#default-bindings start
|
||||
|
||||
#MBTN_LEFT ignore # don't do anything
|
||||
#MBTN_LEFT_DBL cycle fullscreen # toggle fullscreen
|
||||
#MBTN_RIGHT cycle pause # toggle pause/playback mode
|
||||
#MBTN_BACK playlist-prev # skip to the previous file
|
||||
#MBTN_FORWARD playlist-next # skip to the next file
|
||||
|
||||
# Mouse wheels, touchpad or other input devices that have axes
|
||||
# if the input devices supports precise scrolling it will also scale the
|
||||
# numeric value accordingly
|
||||
#WHEEL_UP seek 10 # seek 10 seconds forward
|
||||
#WHEEL_DOWN seek -10 # seek 10 seconds backward
|
||||
#WHEEL_LEFT add volume -2
|
||||
#WHEEL_RIGHT add volume 2
|
||||
|
||||
## Seek units are in seconds, but note that these are limited by keyframes
|
||||
#RIGHT seek 5 # seek 5 seconds forward
|
||||
#LEFT seek -5 # seek 5 seconds backward
|
||||
#UP seek 60 # seek 1 minute forward
|
||||
#DOWN seek -60 # seek 1 minute backward
|
||||
# Do smaller, always exact (non-keyframe-limited), seeks with shift.
|
||||
# Don't show them on the OSD (no-osd).
|
||||
#Shift+RIGHT no-osd seek 1 exact # seek exactly 1 second forward
|
||||
#Shift+LEFT no-osd seek -1 exact # seek exactly 1 second backward
|
||||
#Shift+UP no-osd seek 5 exact # seek exactly 5 seconds forward
|
||||
#Shift+DOWN no-osd seek -5 exact # seek exactly 5 seconds backward
|
||||
#Ctrl+LEFT no-osd sub-seek -1 # seek to the previous subtitle
|
||||
#Ctrl+RIGHT no-osd sub-seek 1 # seek to the next subtitle
|
||||
#Ctrl+Shift+LEFT sub-step -1 # change subtitle timing such that the previous subtitle is displayed
|
||||
#Ctrl+Shift+RIGHT sub-step 1 # change subtitle timing such that the next subtitle is displayed
|
||||
#Alt+left add video-pan-x 0.1 # move the video right
|
||||
#Alt+right add video-pan-x -0.1 # move the video left
|
||||
#Alt+up add video-pan-y 0.1 # move the video down
|
||||
#Alt+down add video-pan-y -0.1 # move the video up
|
||||
#Alt++ add video-zoom 0.1 # zoom in
|
||||
#Alt+- add video-zoom -0.1 # zoom out
|
||||
#Alt+BS set video-zoom 0 ; set video-pan-x 0 ; set video-pan-y 0 # reset zoom and pan settings
|
||||
#PGUP add chapter 1 # seek to the next chapter
|
||||
#PGDWN add chapter -1 # seek to the previous chapter
|
||||
#Shift+PGUP seek 600 # seek 10 minutes forward
|
||||
#Shift+PGDWN seek -600 # seek 10 minutes backward
|
||||
#[ multiply speed 1/1.1 # decrease the playback speed
|
||||
#] multiply speed 1.1 # increase the playback speed
|
||||
#{ multiply speed 0.5 # halve the playback speed
|
||||
#} multiply speed 2.0 # double the playback speed
|
||||
#BS set speed 1.0 # reset the speed to normal
|
||||
#Shift+BS revert-seek # undo the previous (or marked) seek
|
||||
#Shift+Ctrl+BS revert-seek mark # mark the position for revert-seek
|
||||
#q quit
|
||||
#Q quit-watch-later # exit and remember the playback position
|
||||
#q {encode} quit 4
|
||||
#ESC set fullscreen no # leave fullscreen
|
||||
#ESC {encode} quit 4
|
||||
#p cycle pause # toggle pause/playback mode
|
||||
#. frame-step # advance one frame and pause
|
||||
#, frame-back-step # go back by one frame and pause
|
||||
#SPACE cycle pause # toggle pause/playback mode
|
||||
#> playlist-next # skip to the next file
|
||||
#ENTER playlist-next # skip to the next file
|
||||
#< playlist-prev # skip to the previous file
|
||||
#O no-osd cycle-values osd-level 3 1 # toggle displaying the OSD on user interaction or always
|
||||
#o show-progress # show playback progress
|
||||
#P show-progress # show playback progress
|
||||
#i script-binding stats/display-stats # display information and statistics
|
||||
#I script-binding stats/display-stats-toggle # toggle displaying information and statistics
|
||||
#` script-binding console/enable # open the console
|
||||
#z add sub-delay -0.1 # shift subtitles 100 ms earlier
|
||||
#Z add sub-delay +0.1 # delay subtitles by 100 ms
|
||||
#x add sub-delay +0.1 # delay subtitles by 100 ms
|
||||
#ctrl++ add audio-delay 0.100 # change audio/video sync by delaying the audio
|
||||
#ctrl+- add audio-delay -0.100 # change audio/video sync by shifting the audio earlier
|
||||
#Shift+g add sub-scale +0.1 # increase the subtitle font size
|
||||
#Shift+f add sub-scale -0.1 # decrease the subtitle font size
|
||||
#9 add volume -2
|
||||
#/ add volume -2
|
||||
#0 add volume 2
|
||||
#* add volume 2
|
||||
#m cycle mute # toggle mute
|
||||
#1 add contrast -1
|
||||
#2 add contrast 1
|
||||
#3 add brightness -1
|
||||
#4 add brightness 1
|
||||
#5 add gamma -1
|
||||
#6 add gamma 1
|
||||
#7 add saturation -1
|
||||
#8 add saturation 1
|
||||
#Alt+0 set current-window-scale 0.5 # halve the window size
|
||||
#Alt+1 set current-window-scale 1.0 # reset the window size
|
||||
#Alt+2 set current-window-scale 2.0 # double the window size
|
||||
#d cycle deinterlace # toggle the deinterlacing filter
|
||||
#r add sub-pos -1 # move subtitles up
|
||||
#R add sub-pos +1 # move subtitles down
|
||||
#t add sub-pos +1 # move subtitles down
|
||||
#v cycle sub-visibility # hide or show the subtitles
|
||||
#Alt+v cycle secondary-sub-visibility # hide or show the secondary subtitles
|
||||
#V cycle sub-ass-vsfilter-aspect-compat # toggle stretching SSA/ASS subtitles with anamorphic videos to match the historical renderer
|
||||
#u cycle-values sub-ass-override "force" "no" # toggle overriding SSA/ASS subtitle styles with the normal styles
|
||||
#j cycle sub # switch subtitle track
|
||||
#J cycle sub down # switch subtitle track backwards
|
||||
#SHARP cycle audio # switch audio track
|
||||
#_ cycle video # switch video track
|
||||
#T cycle ontop # toggle placing the video on top of other windows
|
||||
#f cycle fullscreen # toggle fullscreen
|
||||
#s screenshot # take a screenshot of the video in its original resolution with subtitles
|
||||
#S screenshot video # take a screenshot of the video in its original resolution without subtitles
|
||||
#Ctrl+s screenshot window # take a screenshot of the window with OSD and subtitles
|
||||
#Alt+s screenshot each-frame # automatically screenshot every frame; issue this command again to stop taking screenshots
|
||||
#w add panscan -0.1 # decrease panscan
|
||||
#W add panscan +0.1 # shrink black bars by cropping the video
|
||||
#e add panscan +0.1 # shrink black bars by cropping the video
|
||||
#A cycle-values video-aspect-override "16:9" "4:3" "2.35:1" "-1" # cycle the video aspect ratio ("-1" is the container aspect)
|
||||
#POWER quit
|
||||
#PLAY cycle pause # toggle pause/playback mode
|
||||
#PAUSE cycle pause # toggle pause/playback mode
|
||||
#PLAYPAUSE cycle pause # toggle pause/playback mode
|
||||
#PLAYONLY set pause no # unpause
|
||||
#PAUSEONLY set pause yes # pause
|
||||
#STOP quit
|
||||
#FORWARD seek 60 # seek 1 minute forward
|
||||
#REWIND seek -60 # seek 1 minute backward
|
||||
#NEXT playlist-next # skip to the next file
|
||||
#PREV playlist-prev # skip to the previous file
|
||||
#VOLUME_UP add volume 2
|
||||
#VOLUME_DOWN add volume -2
|
||||
#MUTE cycle mute # toggle mute
|
||||
#CLOSE_WIN quit
|
||||
#CLOSE_WIN {encode} quit 4
|
||||
#ctrl+w quit
|
||||
#E cycle edition # switch edition
|
||||
#l ab-loop # set/clear A-B loop points
|
||||
#L cycle-values loop-file "inf" "no" # toggle infinite looping
|
||||
#ctrl+c quit 4
|
||||
#DEL script-binding osc/visibility # cycle OSC visibility between never, auto (mouse-move) and always
|
||||
#ctrl+h cycle-values hwdec "auto" "no" # toggle hardware decoding
|
||||
#F8 show-text ${playlist} # show the playlist
|
||||
#F9 show-text ${track-list} # show the list of video, audio and sub tracks
|
||||
|
||||
#
|
||||
# Legacy bindings (may or may not be removed in the future)
|
||||
#
|
||||
#! add chapter -1 # seek to the previous chapter
|
||||
#@ add chapter 1 # seek to the next chapter
|
||||
|
||||
#
|
||||
# Not assigned by default
|
||||
# (not an exhaustive list of unbound commands)
|
||||
#
|
||||
|
||||
# ? cycle sub-forced-only # toggle DVD forced subs
|
||||
# ? stop # stop playback (quit or enter idle mode)
|
||||
6
mpv/mpv.conf
Normal file
6
mpv/mpv.conf
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
background='#24273a'
|
||||
osd-back-color='#6e738d'
|
||||
osd-border-color='#181926'
|
||||
osd-color='#cad3f5'
|
||||
osd-shadow-color='#24273a'
|
||||
7
mpv/script-opts/stats.conf
Normal file
7
mpv/script-opts/stats.conf
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
# Colors are in #BBGGRR format
|
||||
border_color=30201e
|
||||
font_color=f5d3ca
|
||||
plot_bg_border_color=f4ad8a
|
||||
plot_bg_color=30201e
|
||||
plot_color=f4ad8a
|
||||
131
mpv/scripts/mpv-gnome-inhibit.lua
Executable file
131
mpv/scripts/mpv-gnome-inhibit.lua
Executable file
@@ -0,0 +1,131 @@
|
||||
--[[
|
||||
|
||||
Prevent the screen from blanking while a video is playing.
|
||||
|
||||
This script is a workaround for the GNOME+Wayland issue documented in the
|
||||
[Disabling Screensaver] section of the mpv manual, and depends on
|
||||
gnome-session-inhibit (usually provided by the gnome-session package) to set up
|
||||
the inhibitors.
|
||||
|
||||
|
||||
# CAVEATS
|
||||
|
||||
This is not (yet?) a foolproof solution.
|
||||
|
||||
At this time GNOME's implementation of the Inhibit protocol does not support the
|
||||
SimluateUserActivity method:
|
||||
|
||||
dbus-send --print-reply --session \
|
||||
--dest=org.gnome.ScreenSaver --type=method_call \
|
||||
/org/gnome/ScreenSaver org.gnome.ScreenSaver.SimulateUserActivity
|
||||
|
||||
So there seems to be no way to "poke" the system with a heartbeat to extend to
|
||||
idle timeout for a bit and prevent blanking.
|
||||
|
||||
This means that inhibitors have to be installed, then removed when mpv exits.
|
||||
|
||||
The current implementation handles this via another application, which should
|
||||
alwasy be available on GNOME+Wayland desktops (because provided by gnome-session
|
||||
itself): gnome-session-inhibit.
|
||||
|
||||
Executing gnome-session-inhibit to handle this is not ideal because if mpv does
|
||||
not exit cleanly, gnome-session-inhibit is not necessarily killed (it can get
|
||||
ophaned, and gets adopted by the init process), leaving the inhibitors intact
|
||||
with no easy way for the user to figure it out.
|
||||
|
||||
Ideally this script should open a DBus session directly to handle the
|
||||
inhibitors, as they would be removed if the DBus session gets disconnected (cf.
|
||||
[Inhibit's documentation][Inhibit]):
|
||||
|
||||
> Applications should invoke [Inhibit ()] when they begin an operation that
|
||||
> should not be interrupted [...] When the application completes the operation
|
||||
> it should call Uninhibit() or disconnect from the session bus.
|
||||
|
||||
This is how [other applications] do it.
|
||||
|
||||
But really, the only secure way to handle this would be with a heartbeat to
|
||||
regularly reset the idle timer, i.e. what SimulateUserActivity is supposed to
|
||||
provide. Especially for a core security feature such as screen locking (cf.
|
||||
xscreensaver's author [rant][jwz]).
|
||||
|
||||
|
||||
# TODO
|
||||
|
||||
- Do not inhibit for audio-only playback, only for video
|
||||
- Fix inhibitors not removed when mpv does not terminate gracefully, e.g. with
|
||||
`kill -9 <pid>`, either by having a wrapper around gnome-session-inhibit
|
||||
checking the parent PID (see https://stackoverflow.com/a/2035683), or by
|
||||
interfacing with dbus to open a session that gets disconnected if mpv
|
||||
terminates uncleanly (hopefully), or ...
|
||||
- Investigate whether the 'playback-abort' event should be handled
|
||||
- Only inhibit when the player is visible
|
||||
|
||||
|
||||
[Disabling Screensaver]: https://mpv.io/manual/master/#disabling-screensaver
|
||||
[Inhibit]: https://people.gnome.org/~mccann/gnome-session/docs/gnome-session.html#org.gnome.SessionManager.Inhibit
|
||||
[jwz]: https://www.jwz.org/blog/2021/01/i-told-you-so-2021-edition/
|
||||
[other applications]: https://unix.stackexchange.com/a/438335
|
||||
|
||||
]]
|
||||
|
||||
|
||||
local mp = require 'mp'
|
||||
local msg = require 'mp.msg'
|
||||
|
||||
local cookie
|
||||
|
||||
local function handle_inhibit(_, paused)
|
||||
if paused and cookie then
|
||||
mp.abort_async_command(cookie)
|
||||
cookie = nil
|
||||
msg.debug('inhibit off')
|
||||
elseif not paused and not cookie then
|
||||
cookie = mp.command_native_async(
|
||||
{
|
||||
name = 'subprocess',
|
||||
args = {
|
||||
'gnome-session-inhibit',
|
||||
'--inhibit-only',
|
||||
'--inhibit', 'idle',
|
||||
'--app-id', 'mpv',
|
||||
'--reason', 'video-playing',
|
||||
},
|
||||
|
||||
-- `playback_only = true` does not kill the command when
|
||||
-- playback is paused (i.e. "pause" is still "playback == true")
|
||||
-- but also kills it immediately the first time.
|
||||
-- So we need to handle the paused state ourselves.
|
||||
playback_only = false,
|
||||
|
||||
-- If not captured, mpv will just forward everything to stdout
|
||||
-- and stderr. Setting capture_stdXXX with capture_size = 0 will
|
||||
-- ensure that the command's output is discarded.
|
||||
capture_stdout = true,
|
||||
capture_stderr = true,
|
||||
capture_size = 0,
|
||||
},
|
||||
|
||||
-- Should be optional according to the doc, but I get an error if I
|
||||
-- don't provide a function: attempt to call local 'cb' (a nil value)
|
||||
function() end
|
||||
)
|
||||
|
||||
msg.debug('inhibit on')
|
||||
end
|
||||
end
|
||||
|
||||
mp.observe_property('stop-screensaver', 'bool', function(_, enable)
|
||||
if enable then
|
||||
mp.observe_property('pause', 'bool', handle_inhibit)
|
||||
msg.debug('inhibit handling on')
|
||||
else
|
||||
mp.unobserve_property('pause', 'bool', handle_inhibit)
|
||||
msg.debug('inhibit handling off')
|
||||
|
||||
if cookie then
|
||||
mp.abort_async_command(cookie)
|
||||
cookie = nil
|
||||
msg.debug('inhibit off')
|
||||
end
|
||||
end
|
||||
end)
|
||||
123
mpv/scripts/playlistmanager.conf
Executable file
123
mpv/scripts/playlistmanager.conf
Executable file
@@ -0,0 +1,123 @@
|
||||
#### ------- Mpv-Playlistmanager configuration ------- ####
|
||||
|
||||
#### ------- FUNCTIONAL ------- ####
|
||||
|
||||
#navigation keybindings force override only while playlist is visible
|
||||
#if "no" then you can display the playlist by any of the navigation keys
|
||||
dynamic_binds=yes
|
||||
|
||||
#dynamic keybind keys, they should not be re-bound in input.conf
|
||||
#to bind multiple keys separate them by a space
|
||||
key_moveup=UP
|
||||
key_movedown=DOWN
|
||||
key_movepageup=PGUP
|
||||
key_movepagedown=PGDWN
|
||||
key_movebegin=HOME
|
||||
key_moveend=END
|
||||
key_selectfile=RIGHT LEFT
|
||||
key_unselectfile=
|
||||
key_playfile=ENTER
|
||||
key_removefile=BS
|
||||
key_closeplaylist=ESC
|
||||
|
||||
#json format for replacing, check .lua for explanation
|
||||
#example json=[{"ext":{"all":true},"rules":[{"_":" "}]},{"ext":{"mp4":true,"mkv":true},"rules":[{"^(.+)%..+$":"%1"},{"%s*[%[%(].-[%]%)]%s*":""},{"(%w)%.(%w)":"%1 %2"}]},{"protocol":{"http":true,"https":true},"rules":[{"^%a+://w*%.?":""}]}]
|
||||
#empty for no replace
|
||||
filename_replace=
|
||||
|
||||
#filetypes to search from directory
|
||||
loadfiles_filetypes=["jpg","jpeg","png","tif","tiff","gif","webp","svg","bmp","mp3","wav","ogm","flac","m4a","wma","ogg","opus","mkv","avi","mp4","ogv","webm","rmvb","flv","wmv","mpeg","mpg","m4v","3gp"]
|
||||
|
||||
#loadfiles at startup if there is 0 or 1 items in playlist, if 0 uses worḱing dir for files
|
||||
#requires --idle=yes or --idle=once if 0 files in playlist
|
||||
loadfiles_on_start=no
|
||||
|
||||
#sort playlist on mpv start
|
||||
sortplaylist_on_start=no
|
||||
|
||||
#sort playlist when any files are added to playlist after initial load
|
||||
sortplaylist_on_file_add=no
|
||||
|
||||
#yes: use alphanumerical sort comparison(nonpadded numbers in order), no: use normal lua string comparison
|
||||
alphanumsort=yes
|
||||
|
||||
#linux | windows | auto
|
||||
system=auto
|
||||
|
||||
#Use ~ for home directory. Leave as empty to use mpv/playlists
|
||||
playlist_savepath=
|
||||
|
||||
#save playlist automatically after current file was unloaded
|
||||
save_playlist_on_file_end=no
|
||||
|
||||
#2 shows playlist, 1 shows current file(filename strip applied), 0 shows nothing
|
||||
show_playlist_on_fileload=0
|
||||
|
||||
#sync cursor when file is loaded from outside reasons(file-ending, playlist-next shortcut etc.)
|
||||
sync_cursor_on_load=yes
|
||||
|
||||
#playlist open key will toggle visibility instead of refresh
|
||||
open_toggles=yes
|
||||
|
||||
#allow the playlist cursor to loop from end to start and vice versa
|
||||
loop_cursor=yes
|
||||
|
||||
#### ------- VISUAL ------- ####
|
||||
|
||||
#prefer to display titles for following files: "all", "url", "none". Sorting still uses filename
|
||||
prefer_titles=url
|
||||
|
||||
#call youtube-dl to resolve the titles of urls in the playlist
|
||||
resolve_titles=no
|
||||
|
||||
#playlist timeout on inactivity, with high value on this open_toggles is good to be yes
|
||||
playlist_display_timeout=5
|
||||
|
||||
#amount of entries to show before slicing. Optimal value depends on font/video size etc.
|
||||
showamount=16
|
||||
|
||||
#font size scales by window, if no then needs larger font and padding sizes
|
||||
scale_playlist_by_window=yes
|
||||
#playlist ass style overrides
|
||||
#example {\fnUbuntu\fs10\b0\bord1} equals: font=Ubuntu, size=10, bold=no, border=1
|
||||
#read http://docs.aegisub.org/3.2/ASS_Tags/ for reference of tags
|
||||
#no values defaults to OSD settings in mpv.conf
|
||||
style_ass_tags=
|
||||
#paddings for top left corner
|
||||
text_padding_x=10
|
||||
text_padding_y=30
|
||||
|
||||
#set title of window with stripped name
|
||||
set_title_stripped=no
|
||||
title_prefix=
|
||||
title_suffix= - mpv
|
||||
|
||||
#slice long filenames, and how many chars to show
|
||||
slice_longfilenames=no
|
||||
slice_longfilenames_amount=70
|
||||
|
||||
#Playing header. One newline will be added after the string.
|
||||
#%mediatitle or %filename = title or name of playing file
|
||||
#%pos = position of playing file
|
||||
#%cursor = position of navigation
|
||||
#%plen = playlist lenght
|
||||
#%N = newline
|
||||
playlist_header=[%cursor/%plen]
|
||||
|
||||
#Playlist file templates
|
||||
#%pos = position of file with leading zeros
|
||||
#%name = title or name of file
|
||||
#%N = newline
|
||||
#you can also use the ass tags mentioned above. For example:
|
||||
# selected_file={\c&HFF00FF&}➔ %name | to add a color for selected file. However, if you
|
||||
# use ass tags you need to reset them for every line (see https://github.com/jonniek/mpv-playlistmanager/issues/20)
|
||||
normal_file=○ %name
|
||||
hovered_file=● %name
|
||||
selected_file=➔ %name
|
||||
playing_file=▷ %name
|
||||
playing_hovered_file=▶ %name
|
||||
playing_selected_file=➤ %name
|
||||
|
||||
#what to show when playlist is truncated
|
||||
playlist_sliced_prefix=...
|
||||
playlist_sliced_suffix=...
|
||||
1040
mpv/scripts/playlistmanager.lua
Executable file
1040
mpv/scripts/playlistmanager.lua
Executable file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user