summaryrefslogtreecommitdiffstats
path: root/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/dunst_espeak.sh2
-rwxr-xr-x.local/bin/mixer-set103
2 files changed, 74 insertions, 31 deletions
diff --git a/.local/bin/dunst_espeak.sh b/.local/bin/dunst_espeak.sh
index 3d1aee1..fb866c6 100755
--- a/.local/bin/dunst_espeak.sh
+++ b/.local/bin/dunst_espeak.sh
@@ -3,5 +3,5 @@
[ "$5" = "LOW" ] && exit
echo $3 > $HOME/file
[ "$3" ] || exit
-words=$(printf "$3" | sed 's/<b>//g' | sed 's/<\/b>//g' | sed 's/[^a-zA-Z0-9?!., ]//g')
+words=$(printf "$3" | sed 's/<b>//g' | sed 's/<\/b>//g' | sed 's/[^a-zA-Z0-9?!.,% ]//g')
espeak "$words"
diff --git a/.local/bin/mixer-set b/.local/bin/mixer-set
index 24edbf3..4de3825 100755
--- a/.local/bin/mixer-set
+++ b/.local/bin/mixer-set
@@ -3,6 +3,7 @@
use strict;
use warnings;
use Term::ANSIColor;
+use Capture::Tiny qw(capture);
sub main {
my $argc = $#ARGV + 1;
@@ -22,26 +23,38 @@ sub main {
}
my $curr_vol = 0;
my $curr_vol_cmd = "/usr/sbin/mixer vol | /usr/bin/awk -F ':' '{print \$2}'";
- if ($ARGV[0] eq "lower") {
- system('/usr/local/bin/dash',
- '-c',
- '/usr/sbin/mixer vol -5 >/dev/null 2>&1');
- $curr_vol = `$curr_vol_cmd`;
- chomp $curr_vol;
- system('/usr/local/bin/dash',
- '-c',
- '/usr/local/bin/notify-send -u low -t 400 "Volume - ' . $curr_vol . '%"');
- exit;
- }
- elsif ($ARGV[0] eq "raise") {
- system('/usr/local/bin/dash',
- '-c',
- '/usr/sbin/mixer vol +5 >/dev/null 2>&1');
+ if ($ARGV[0] eq "lower" || $ARGV[0] eq "raise") {
+ if ($ARGV[0] eq "lower") {
+ capture {
+ system('/usr/sbin/mixer', 'vol', '-5');
+ };
+ }
+ else {
+ capture {
+ system('/usr/sbin/mixer', 'vol', '+5');
+ };
+ }
$curr_vol = `$curr_vol_cmd`;
chomp $curr_vol;
- system('/usr/local/bin/dash',
- '-c',
- '/usr/local/bin/notify-send -u low -t 400 "Volume - ' . $curr_vol . '%"');
+ my $icon;
+ if ($curr_vol <= 33) {
+ $icon = '奄';
+ }
+ elsif ($curr_vol <= 66) {
+ $icon = '奔';
+ }
+ else {
+ $icon = '墳';
+ }
+ system(
+ '/usr/local/bin/notify-send',
+ '-u',
+ 'low',
+ '-t',
+ '400',
+ 'mixer-set',
+ $icon . ' Volume - ' . $curr_vol . '%'
+ );
exit;
}
elsif ($ARGV[0] eq "toggle") {
@@ -52,23 +65,53 @@ sub main {
open(my $fh, '>:encoding(UTF-8)', $tmp_file);
print $fh $curr_vol;
close($fh);
- system('/usr/local/bin/dash',
- '-c',
- '/usr/sbin/mixer vol 0 >/dev/null 2>&1');
- system('/usr/local/bin/dash',
- '-c',
- '/usr/local/bin/notify-send -u low -t 1750 "Volume muted"');
+ capture {
+ system(
+ '/usr/sbin/mixer',
+ 'vol',
+ '0'
+ );
+ };
+ system(
+ '/usr/local/bin/notify-send',
+ '-u',
+ 'low',
+ '-t',
+ '1750',
+ 'mixer-set',
+ '婢 Volume muted'
+ );
}
else {
open(my $fh, '<:encoding(UTF-8)', $tmp_file);
$curr_vol = <$fh>;
close($fh);
- system('/usr/local/bin/dash',
- '-c',
- '/usr/sbin/mixer vol ' . $curr_vol . ' >/dev/null 2>&1');
- system('/usr/local/bin/dash',
- '-c',
- '/usr/local/bin/notify-send -u low -t 1750 "Volume restored - ' . $curr_vol . '%"');
+ capture {
+ system(
+ '/usr/sbin/mixer',
+ 'vol',
+ $curr_vol
+ );
+ };
+ my $icon;
+ if ($curr_vol <= 33) {
+ $icon = '奄';
+ }
+ elsif ($curr_vol <= 66) {
+ $icon = '奔';
+ }
+ else {
+ $icon = '墳';
+ }
+ system(
+ '/usr/local/bin/notify-send',
+ '-u',
+ 'low',
+ '-t',
+ '1750',
+ 'mixer-set',
+ $icon . ' Volume restored - ' . $curr_vol . '%'
+ );
}
exit;
}