summaryrefslogtreecommitdiffstats
path: root/.local/bin
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2022-04-14 11:09:27 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2022-04-14 11:09:27 +0200
commitca59154e185d617ce9692e85484f423beddb2d20 (patch)
treecca97a6593d723f019654aa3f753e92db3097839 /.local/bin
parentAdded evil-quickscope (diff)
downloaddotfiles-bsd-ca59154e185d617ce9692e85484f423beddb2d20.tar.gz
dotfiles-bsd-ca59154e185d617ce9692e85484f423beddb2d20.tar.bz2
dotfiles-bsd-ca59154e185d617ce9692e85484f423beddb2d20.tar.xz
dotfiles-bsd-ca59154e185d617ce9692e85484f423beddb2d20.tar.zst
dotfiles-bsd-ca59154e185d617ce9692e85484f423beddb2d20.zip
new script to toggle mic in mixer
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/mic51
1 files changed, 51 insertions, 0 deletions
diff --git a/.local/bin/mic b/.local/bin/mic
new file mode 100755
index 0000000..41e6470
--- /dev/null
+++ b/.local/bin/mic
@@ -0,0 +1,51 @@
+#!/usr/local/bin/perl
+
+use strict;
+use warnings;
+use Capture::Tiny qw(capture);
+
+use constant {
+ MIXER_PATH => '/usr/sbin/mixer',
+ NOTIF_PATH => '/usr/local/bin/notify-send'
+};
+
+sub main
+{
+ my $rec_vol;
+
+ $rec_vol = `mixer rec | awk -F ':' '{print \$2}'`;
+ chomp $rec_vol;
+ if ($rec_vol == 0) {
+ capture {
+ system(MIXER_PATH, 'rec', '100');
+ system(
+ NOTIF_PATH,
+ '-u',
+ 'low',
+ '-t',
+ '1750',
+ 'mixer-set',
+ ' Microphone restored'
+ );
+ };
+ }
+ else {
+ capture {
+ system(MIXER_PATH, 'rec', '0');
+ system(
+ NOTIF_PATH,
+ '-u',
+ 'low',
+ '-t',
+ '1750',
+ 'mixer-set',
+ ' Microphone muted'
+ );
+ };
+ }
+ return;
+}
+
+main();
+
+__END__