You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

12 lines
829 B

#!/bin/bash
expireTimeNotifyOSD=3000
currentId=2
tmpFile=/tmp/currentLollypopVolumnNotifyId$(whoami)
currentVolume=$(dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.Lollypop /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Volume' | grep -Eo '[+-]?[0-9]+([.][0-9]+)?' | tail -n 1)
operator=$1
newVolume=$(echo $currentVolume $operator 0.05 | bc)
newVolumeAsInt=$(echo $newVolume | cut -c 2-3)
dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.Lollypop /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Set string:'org.mpris.MediaPlayer2.Player' string:'Volume' variant:double:$newVolume
notify-send "Volume $newVolumeAsInt" "test" -p -t $expireTimeNotifyOSD -r $currentId -i org.gnome.Lollypop -h int:value:$newVolumeAsInt > $tmpFile