#!/bin/sh
# Media keys: change volume / brightness, then show the shell's OSD.
case "$1 $2" in
  "volume up")       wpctl set-mute @DEFAULT_AUDIO_SINK@ 0; wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+; k=volume ;;
  "volume down")     wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-; k=volume ;;
  "mute "*)          wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle; k=volume ;;
  "micmute "*)       wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle; k=mic ;;
  "brightness up")   mood-backlight set 5%+; k=brightness ;;
  "brightness down") mood-backlight set 5%-; k=brightness ;;
  *) echo "usage: mood-osd volume up|down | mute | micmute | brightness up|down" >&2; exit 2 ;;
esac
exec mood-shell --osd "$k"
