之前見有人用NotifyOSD控制音量時顯示音量的大小,
折騰過,好像不是那麽遂人意。閑逛arch論壇,發現volnoti,試用之,果然很好很純淨。與pulseaudio_ctl配合,便完美地完成了這一目的。
截圖:
pulseaudio_ctl略修改了一下:
#!/bin/sh
# Credit to Roland Latour
# http://www.freak-search.com/en/thread/4707111/q_volume_control,_xfce
# from https://github.com/graysky2/pulseaudio_ctl
sink=$(pacmd info|grep "Default sink name"|awk '{print $4}')
let line=$(pacmd list-sinks|grep -n $sink|sed '{s/://}'|awk '{print $1}')
case $1 in
mute)
let line=($line + 12)
mute=$(pacmd list-sinks|awk 'NR==i"'"$line"'"{print $2}')
[[ "$mute" == "yes" ]] && pacmd set-sink-mute "$sink" 0 > /dev/null 2>&1
[[ "$mute" == "no" ]] && pacmd set-sink-mute "$sink" 1 > /dev/null 2>&1
volnoti-show -m
;;
up|down)
let line=($line + 6)
volume=$(pacmd list-sinks|awk 'NR=="'"$line"'"{print $3}'|sed '{s/%//}')
let volume=($volume * 65536);let volume=($volume / 100)
if [ "$1" = "up" ]; then
let volume=($volume + 3276)
[[ $volume -gt 65536 ]] && let volume=65536
else
let volume=($volume - 3276)
[[ $volume -lt 0 ]] && let volume=0
fi
pacmd set-sink-volume $sink $volume > /dev/null 2>&1
let volume=($volume / 655)
volnoti-show $volume
;;
get)
let line=($line + 6)
volume=$(pacmd list-sinks|awk 'NR=="'"$line"'"{print $3}'|sed '{s/%//}')
echo $volume
;;
esac
什麽?還在用xcompmgr,不妨試試compton吧。