Add keybinding only if doesn't exist

This commit is contained in:
Ryze 2023-02-12 15:00:06 +03:00
parent 613b2d725e
commit e95168ccf4
Signed by: ryze
GPG key ID: 9B296C5CEAEAAAC1

View file

@ -1,5 +1,7 @@
#!/bin/bash
key='D'
script_binding='script-binding "libmpv_rpc/toggle-rpc"'
mpv_home="${MPV_HOME:-${XDG_CONFIG_HOME:-${HOME}/.config}/mpv}"
scripts_dir="$mpv_home/scripts"
@ -15,6 +17,8 @@ echo -n "Copying default config..."
cp ./config/rpc.json "$mpv_home"
echo "Done!"
if ! grep -q "$script_binding" "$mpv_home/input.conf"; then
echo -n "Adding keybinding entry to input.conf..."
echo 'D script-binding "libmpv_rpc/toggle-rpc"' >> "$mpv_home/input.conf"
echo "$key $script_binding" >> "$mpv_home/input.conf"
echo "Done!"
fi