summaryrefslogtreecommitdiffstats
path: root/.local/bin/mic
diff options
context:
space:
mode:
authorjoe <rbo@gmx.us>2025-10-01 21:15:09 +0200
committerjoe <rbo@gmx.us>2025-10-01 21:15:09 +0200
commit7c7fd8baf3c3525d413cc8862856c369efe51145 (patch)
treea06acc1035b94b8b6c7f9e480a362d3d1f0c9b5b /.local/bin/mic
parentup (diff)
downloaddotfiles-bsd-7c7fd8baf3c3525d413cc8862856c369efe51145.tar.gz
dotfiles-bsd-7c7fd8baf3c3525d413cc8862856c369efe51145.tar.bz2
dotfiles-bsd-7c7fd8baf3c3525d413cc8862856c369efe51145.tar.xz
dotfiles-bsd-7c7fd8baf3c3525d413cc8862856c369efe51145.tar.zst
dotfiles-bsd-7c7fd8baf3c3525d413cc8862856c369efe51145.zip
up
Diffstat (limited to '')
-rwxr-xr-x.local/bin/mic35
1 files changed, 17 insertions, 18 deletions
diff --git a/.local/bin/mic b/.local/bin/mic
index 31c9f43..19a0fd6 100755
--- a/.local/bin/mic
+++ b/.local/bin/mic
@@ -10,7 +10,18 @@ use constant {
NOTIF_PATH => '/usr/local/bin/herbe'
};
-sub main
+sub notify
+{
+ my ($str) = @_;
+
+ my $pid = fork();
+ if (not $pid) {
+ exec(NOTIF_PATH, $str);
+ }
+ return;
+};
+
+sub mic
{
my $rec_vol;
my $host;
@@ -21,16 +32,10 @@ sub main
my $muted = `/usr/bin/pactl get-source-mute \@DEFAULT_SOURCE\@ | awk '{print \$2}'`;
chomp $muted;
if ($muted eq "yes") {
- system(
- '/usr/local/bin/herbe',
- ' muted'
- );
+ notify(' muted');
}
else {
- system(
- '/usr/local/bin/herbe',
- ' restored'
- );
+ notify(' restored');
}
exit;
}
@@ -40,24 +45,18 @@ sub main
capture {
system(MIXER_PATH, 'rec', '100');
};
- system(
- NOTIF_PATH,
- ' microphone restored'
- );
+ notify(' microphone restored');
}
else {
capture {
system(MIXER_PATH, 'rec', '0');
- system(
- NOTIF_PATH,
- ' microphone muted'
- );
+ notify(' microphone muted');
};
}
system('kill -68 $(pidof dwmblocks)');
return;
}
-main();
+mic();
__END__