summaryrefslogtreecommitdiffstats
path: root/.local/bin/mic
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/mic')
-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__