Add keybinding only if doesn't exist
This commit is contained in:
parent
613b2d725e
commit
e95168ccf4
1 changed files with 7 additions and 3 deletions
|
@ -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!"
|
||||||
|
|
||||||
|
if ! grep -q "$script_binding" "$mpv_home/input.conf"; then
|
||||||
echo -n "Adding keybinding entry to input.conf..."
|
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!"
|
echo "Done!"
|
||||||
|
fi
|
Loading…
Reference in a new issue