From 0730a4af3b5f6167d441afbaeea415b206f9c8be Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 3 Mar 2021 20:37:02 -0500 Subject: add get operations for backlight and volume --- bin/hornet/backlight | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'bin/hornet/backlight') diff --git a/bin/hornet/backlight b/bin/hornet/backlight index b98d1bd..314e874 100755 --- a/bin/hornet/backlight +++ b/bin/hornet/backlight @@ -3,17 +3,6 @@ use strict; use warnings; use 5.014; -my $inc; -if ($ARGV[0] eq 'inc') { - $inc = 1; -} -elsif ($ARGV[0] eq 'dec') { - $inc = -1; -} -else { - die "unknown arg '$ARGV[0]'"; -} - my @levels = ( 1, 2, @@ -35,6 +24,22 @@ for my $i (0..$#levels) { $idx = $i; last if $level >= $current; } + +my $inc; +if ($ARGV[0] eq 'inc') { + $inc = 1; +} +elsif ($ARGV[0] eq 'dec') { + $inc = -1; +} +elsif ($ARGV[0] eq 'get') { + say $idx * 10; + exit; +} +else { + die "unknown arg '$ARGV[0]'"; +} + my $new_idx = $idx + $inc; if ($new_idx >= 0 && $new_idx <= $#levels) { my $new_level = $levels[$new_idx] * 0.1; -- cgit v1.2.3-54-g00ecf