From 8854fa0f8a831264ed815b3615038dec89c6f632 Mon Sep 17 00:00:00 2001 From: joe Date: Wed, 1 Oct 2025 22:33:48 +0200 Subject: up --- .local/bin/mixer-set | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to '.local/bin/mixer-set') diff --git a/.local/bin/mixer-set b/.local/bin/mixer-set index 24d6f21..3979ff2 100755 --- a/.local/bin/mixer-set +++ b/.local/bin/mixer-set @@ -6,6 +6,17 @@ use Term::ANSIColor; use Capture::Tiny qw(capture); use Sys::Hostname qw(hostname); +sub notify +{ + my ($str) = @_; + + my $pid = fork(); + if (not $pid) { + exec('/usr/local/bin/herbe', $str); + } + return; +}; + sub main { my $argc = $#ARGV + 1; if ($argc == 0) { @@ -28,10 +39,6 @@ sub main { if ($host eq "po-rbo.ln.ysosecure.com") { $curr_vol_cmd = "/usr/bin/pactl get-sink-volume \@DEFAULT_SINK\@ | /usr/bin/awk '{print \$5}'"; } - my $ns = '/usr/local/bin/herbe'; - if (hostname() eq "po-rbo.ln.ysosecure.com") { - $ns = '/usr/local/bin/herbe'; - } if ($ARGV[0] eq "lower" || $ARGV[0] eq "raise") { if ($ARGV[0] eq "lower") { if ($host eq "po-rbo.ln.ysosecure.com") { @@ -55,8 +62,7 @@ sub main { } $curr_vol = `$curr_vol_cmd`; chomp $curr_vol; - system($ns, ' ' . $curr_vol); - system('kill -68 $(pidof dwmblocks)'); + notify(' ' . $curr_vol); exit; } elsif ($ARGV[0] eq "toggle") { @@ -79,11 +85,7 @@ sub main { ); }; } - system( - $ns, - ' muted' - ); - system('kill -68 $(pidof dwmblocks)'); + notify(' muted'); } else { open(my $fh, '<:encoding(UTF-8)', $tmp_file); @@ -102,8 +104,7 @@ sub main { ); }; } - system($ns, ' ' . $curr_vol); - system('kill -68 $(pidof dwmblocks)'); + notify(' ' . $curr_vol); } exit; } -- cgit v1.2.3