Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

vlc-command (Source)

#!/bin/sh
# Startdate: 2024-01-01-2 14:36
# Purpose: to be a hotkey target for when CapsLock is on but I still press "Play/Pause" media button on the keyboard.
# Usage:
#    In ~/.fluxbox/keys:
#    # For capslock, media previous, pause, skip
#    171 :Exec bin/vlc-command skip
#    172 :Exec bin/vlc-command play-pause
#    173 :Exec bin/vlc-command previous
case "${1}" in
   "play-pause")
      dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
      ;;
   "previous"|"back"|"left")
      dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous
      ;;
   "next"|"skip"|"right")
      dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next
      ;;
esac