- #!/usr/bin/env ruby
- # -*- coding: utf-8 -*-
- s = `amixer get Master`
- val = s.scan(/Mono:\\sPlayback\\s(\\d+)/)[0][0].to_i
- if val < 32
- `notify-send '<span color="yellow" size="80000">unmute </span>'`
- puts `amixer set Master 33`
- else
- puts `amixer set Master 1`
- `notify-send '<span color="yellow" size="80000">mute </span>'`
- end
- #if not File.exist? '/usr/local/sbin/m'
- #puts `ln -s #{Dir.pwd}/m.rb /usr/local/sbin/m`
- #end
- #该片段来自于http://www.codesnippet.cn/detail/081020136295.html
来源: http://www.codesnippet.cn/detail/081020136295.html