summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/hornet/volume20
1 files changed, 2 insertions, 18 deletions
diff --git a/bin/hornet/volume b/bin/hornet/volume
index e39c4b0..4a89d9b 100755
--- a/bin/hornet/volume
+++ b/bin/hornet/volume
@@ -3,26 +3,10 @@ use strict;
use warnings;
use 5.014;
-chomp(my $sink=`pacmd stat | grep 'Default sink name' | sed 's/^Default sink name: //'`);
+chomp(my $sink=`pactl get-default-sink`);
sub get {
- my $volume;
-
- for (split "\n", `pacmd list-sinks`) {
- chomp;
- next unless /name: <\Q$sink\E>/../^$/;
- if (/^\s+volume: .* ([0-9]+)% /) {
- if (!defined($volume)) {
- $volume = $1;
- }
- }
- elsif (/^\s+muted: yes/) {
- $volume = 'mute';
- last;
- }
- }
-
- $volume
+ (`pactl get-sink-volume $sink` =~ /(\d+)%/)[0]
}
if ($ARGV[0] eq 'get') {