5

I'd like to change my webcam's exposure-time & gain... using something like v4l2-ctl -d /dev/video2 -c gain=15.

As far I searched, the keybindings for mpv is located/configured at ~/.config/mpv/input.conf. However, I couldn't find anywhere on internet "How to execute external shell scripts from mpv's keybindings". Is this possible?

Garid Z.
  • 500
  • 2
  • 12
  • Why is mpv relevant? Didn't you say all you want is to assign a command to a keyboard shortcut? โ€“ terdon May 05 '21 at 15:06
  • I intend this to use on different distros with different DEs. If I get it configure on mpv, then I don't have to configure it on each desktop environment (I suppose each one is different than the other). Instead, I just copy one mpv config file. โ€“ Garid Z. May 05 '21 at 16:56
  • 1
    But how is `mpv` relevant here? You are showing us a command called `v4l2-ctl`. What does this have to do with `mpv`? Are you maybe looking for something like `xkeybinds`? Have a look at my answer here: [Shortcut keys that are independent to keyboard layout](https://unix.stackexchange.com/a/91433). Does that do what you need? You can still copy the `~/.xbindkeysrc` file anywhere you want. โ€“ terdon May 05 '21 at 17:05

1 Answers1

7

Use the run command. Add for example this line to ~/.config/mpv/input.conf if you want to copy the current playback position to your Wayland clipboard when you press y:

y run "/bin/sh" "-c" "printf %s ${=time-pos} | wl-copy"

See also ยง Command interface in the manual.

However, I agree with terdon that you don't need mpv in this case.

Devon
  • 808
  • 8
  • 12