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