diff options
author | joe <rbo@gmx.us> | 2025-10-01 22:33:48 +0200 |
---|---|---|
committer | joe <rbo@gmx.us> | 2025-10-01 22:33:48 +0200 |
commit | 8854fa0f8a831264ed815b3615038dec89c6f632 (patch) | |
tree | cb0eda5ade37b16adb72ee084e20fe284b2c90a1 /.local/bin/mixer-set | |
parent | up (diff) | |
download | dotfiles-bsd-8854fa0f8a831264ed815b3615038dec89c6f632.tar.gz dotfiles-bsd-8854fa0f8a831264ed815b3615038dec89c6f632.tar.bz2 dotfiles-bsd-8854fa0f8a831264ed815b3615038dec89c6f632.tar.xz dotfiles-bsd-8854fa0f8a831264ed815b3615038dec89c6f632.tar.zst dotfiles-bsd-8854fa0f8a831264ed815b3615038dec89c6f632.zip |
up
Diffstat (limited to '')
-rwxr-xr-x | .local/bin/mixer-set | 27 |
1 files changed, 14 insertions, 13 deletions
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; } |