summaryrefslogtreecommitdiffstats
path: root/bin/hornet/backlight
diff options
context:
space:
mode:
Diffstat (limited to 'bin/hornet/backlight')
-rwxr-xr-xbin/hornet/backlight27
1 files changed, 16 insertions, 11 deletions
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;