Add lua mpv script

This commit is contained in:
rickyjon 2020-02-05 20:25:41 +11:00
parent af6f380c31
commit b77e94a722
3 changed files with 28 additions and 3 deletions

View File

@ -0,0 +1 @@
pause_toggle=\

View File

@ -0,0 +1,22 @@
-- Adds an additional keybinding to pause an unpaused mpv
local mp = require 'mp'
local utils = require 'mp.utils'
local msg = require 'mp.msg'
local opts = {
pause_toggle = "\\"
}
(require 'mp.options').read_options(opts, "pause_toggle")
-- main
-- keybind to toggle pause
mp.add_key_binding(opts.pause_toggle, "pause_toggle", function()
if (mp.get_property('pause') == "no") then
mp.commandv('cycle', 'pause')
end
end)

View File

@ -5,6 +5,8 @@
# every single one of them with one command! This is bound to super + shift + p
# (with other things) by default and is used in some other places.
for i in $(ls /tmp/mpvsoc*); do
echo '{ "command": ["set_property", "pause", true] }' | socat - $i;
done
# Sends a \ key to all mpv instances pausing with the pause_toggle.lua script
pstree -p | grep "$TERMINAL.*{mpv}" | sed "s/.*$TERMINAL(\([0-9]*\)).*/\1/" | xargs -I @ xdotool search --pid @ | xargs -I % xdotool key --window % backslash
pgrep mpv | xargs -I @ xdotool search --pid @ | xargs -I % xdotool key --window % backslash