diff options
| -rw-r--r-- | .config/mpv/.luarc.json | 3 | ||||
| -rw-r--r-- | .config/mpv/scripts/audio_setter.lua | 14 | 
2 files changed, 17 insertions, 0 deletions
| diff --git a/.config/mpv/.luarc.json b/.config/mpv/.luarc.json new file mode 100644 index 0000000..82edb9f --- /dev/null +++ b/.config/mpv/.luarc.json @@ -0,0 +1,3 @@ +{ +  "diagnostics.globals": ["mp"] +} diff --git a/.config/mpv/scripts/audio_setter.lua b/.config/mpv/scripts/audio_setter.lua new file mode 100644 index 0000000..12981f1 --- /dev/null +++ b/.config/mpv/scripts/audio_setter.lua @@ -0,0 +1,14 @@ +local function change_audio() +    local r = mp.command_native({ +            name = "subprocess", +            capture_stdout = true, +            args = {'sh', '-c', "mpv --audio-device=help | tail -n+2 | fzf-tmux -p | awk '{printf $1}'"}, +            playback_only = false, +        }) + +    if r.status == 0 and r.stdout ~= "" then +        mp.set_property("audio-device", string.sub(r.stdout, 2, -2)) +    end +end + +mp.add_key_binding("alt+a", "SetAudioDevice", change_audio) | 
