Whitespace

This commit is contained in:
John Mertz 2022-09-17 15:21:13 -04:00
parent d8ae0c1c48
commit b403d8987c
1 changed files with 53 additions and 53 deletions

View File

@ -11,7 +11,7 @@
#
# to output like:
# 1000/10000 = 10%
#
#
# Create a new array of hashes to classify the ARGV elements, eg:
# $0 + "+%c" -= 10 +=4 =1 =100 "+%p"
# [
@ -106,7 +106,7 @@ sub get_min
sub writable
{
if (! -w $cur_file) {
die "You don't have permission to write $cur_file\n";
die "You don't have permission to write $cur_file\n";
}
return 1;
}
@ -241,7 +241,7 @@ my (@output, $target, $silent, $notify);
my $operation_found = 0;
if (scalar @ARGV) {
while ($arg = shift) {
while ($arg = shift) {
if ($arg eq '%') {
push @output,int(get_current()/get_max()*100);
} elsif ($arg eq '^') {
@ -266,52 +266,52 @@ if (scalar @ARGV) {
} else {
$duration = 1000;
}
} elsif ($arg eq '+') {
unshift(@ARGV,1);
unshift(@ARGV,'+=');
} elsif ($arg eq '+') {
unshift(@ARGV,1);
unshift(@ARGV,'+=');
} elsif ($arg =~ /^\+=/) {
my $offset;
if ($arg =~ m/^\+=(.+)$/) {
$offset = $1;
} else {
$offset = shift || die "+= without accompanying offset value\n";
}
unless ($offset =~ /^\d+$/) {
die "+= <value> is not a number ($offset)\n";
}
my $offset;
if ($arg =~ m/^\+=(.+)$/) {
$offset = $1;
} else {
$offset = shift || die "+= without accompanying offset value\n";
}
unless ($offset =~ /^\d+$/) {
die "+= <value> is not a number ($offset)\n";
}
for (my $j=0;$j<$offset;$j++) {
$target = increment();
@output = to_percent($target);
@output = to_percent($target);
}
$operation_found = 1;
} elsif ($arg eq '-') {
unshift(@ARGV,1);
unshift(@ARGV,'-=');
} elsif ($arg eq '-') {
unshift(@ARGV,1);
unshift(@ARGV,'-=');
} elsif ($arg =~ /^-=/) {
my $offset;
if ($arg =~ m/^-=(.+)$/) {
$offset = $1;
} else {
$offset = shift || die "-= without accompanying offset value\n";
}
unless ($offset =~ /^\d+$/) {
die "-= <value> is not a number ($offset)\n";
}
my $offset;
if ($arg =~ m/^-=(.+)$/) {
$offset = $1;
} else {
$offset = shift || die "-= without accompanying offset value\n";
}
unless ($offset =~ /^\d+$/) {
die "-= <value> is not a number ($offset)\n";
}
for (my $j=0;$j<$offset;$j++) {
$target = decrement();
@output = to_percent($target);
@output = to_percent($target);
}
$operation_found = 1;
} elsif ($arg =~ m/^=/) {
my $value;
if ($arg =~ m/^=(.+)$/) {
$target = $1;
} else {
$target = shift || die "= without accompanying absolute value\n";
}
unless ($target =~ /^\d+$/) {
die "= <value> is not a number ($target)\n";
}
my $value;
if ($arg =~ m/^=(.+)$/) {
$target = $1;
} else {
$target = shift || die "= without accompanying absolute value\n";
}
unless ($target =~ /^\d+$/) {
die "= <value> is not a number ($target)\n";
}
if ($target < 1) {
$target = set(get_min());
} elsif ($target > get_max()) {
@ -326,7 +326,7 @@ if (scalar @ARGV) {
@output = to_percent($target);
$operation_found = 1;
} else {
push(@output,$arg);
push(@output,$arg);
}
}
} else {
@ -336,7 +336,7 @@ if (scalar @ARGV) {
. '","Current":"'
. get_current()
. '","Percentage","'
. int(get_current()/get_max()*100)
. int(get_current()/get_max()*100)
. '%"}}'
);
}
@ -354,26 +354,26 @@ if ($silent) {
$concat .= $_;
}
=pod
use Gtk2::Notify -init, "Backlight";
my $notification = Gtk2::Notify::new('Backlight', $concat, '', "notification-display-brightness");
use Gtk2::Notify -init, "Backlight";
my $notification = Gtk2::Notify::new('Backlight', $concat, '', "notification-display-brightness");
$notification->set_hint_string('x-canonical-private-synchronous','blc');
$notification->set_urgency('NOTIFY_URGENCY_LOW');
$notification->set_hint_int32('value',(split('%',$concat))[0]);
$notification->set_timeout($duration);
$notification->show();
exit;
$notification->set_hint_string('x-canonical-private-synchronous','blc');
$notification->set_urgency('NOTIFY_URGENCY_LOW');
$notification->set_hint_int32('value',(split('%',$concat))[0]);
$notification->set_timeout($duration);
$notification->show();
exit;
print "notify-send --urgency=normal"
. ' --icon="notification-display-brightness"'
. ' --hint=string:x-canonical-private-synchronous:blc'
. ' --hint=string:x-canonical-private-synchronous:blc'
. ' --expire-time=' . $duration
. ' "Backlight"'
. ' "Backlight"'
. ' "' . $concat . " '" . join("','", @output) . "'\"";
system "notify-send --urgency=normal"
. ' --icon="notification-display-brightness"'
. ' --hint=string:x-canonical-private-synchronous:blc'
. ' --hint=int:value:' . (split('%',$concat))[0]
. ' --expire-time=' . $duration
. ' --hint=string:x-canonical-private-synchronous:blc'
. ' --hint=int:value:' . (split('%',$concat))[0]
. ' --expire-time=' . $duration
. ' "' . $concat . "\"";
=cut