mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-03-20 01:37:45 +01:00
Add lua mpv script
This commit is contained in:
parent
af6f380c31
commit
b77e94a722
1
.config/mpv/script-opt/pause_toggle.conf
Normal file
1
.config/mpv/script-opt/pause_toggle.conf
Normal file
@ -0,0 +1 @@
|
||||
pause_toggle=\
|
||||
22
.config/mpv/scripts/pause_toggle.lua
Normal file
22
.config/mpv/scripts/pause_toggle.lua
Normal 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)
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user