diff options
author | A Farzat <a@farzat.xyz> | 2024-10-13 11:46:44 +0900 |
---|---|---|
committer | A Farzat <a@farzat.xyz> | 2024-10-20 11:46:44 +0900 |
commit | 726bc6f623b4e765f923bf10267fa4a1d66b0097 (patch) | |
tree | 50b7cd071546b519710a5062b4987b663b4860ab /.config/mpv/scripts/audio_setter.lua | |
parent | 002727a501aaa74d2eb60cc0475d746a668a9cd0 (diff) | |
download | dotfiles-726bc6f623b4e765f923bf10267fa4a1d66b0097.tar.gz dotfiles-726bc6f623b4e765f923bf10267fa4a1d66b0097.zip |
Add mpv audio_setter script
Diffstat (limited to '.config/mpv/scripts/audio_setter.lua')
-rw-r--r-- | .config/mpv/scripts/audio_setter.lua | 14 |
1 files changed, 14 insertions, 0 deletions
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) |