Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pyra-scripts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
packages
pyra-scripts
Commits
39fcf886
Commit
39fcf886
authored
Sep 27, 2017
by
askarus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added pyra-brightkey.sh made by Askarus, improved by sebt3
parent
dde62517
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
0 deletions
+63
-0
scripts/pyra-brightkey.sh
scripts/pyra-brightkey.sh
+63
-0
No files found.
scripts/pyra-brightkey.sh
0 → 100755
View file @
39fcf886
#!/bin/sh
help
()
{
cat
<<
ENDHELP
$0
{screen|keyboard} {up|down|set|toggle} [value]
ENDHELP
}
case
"
$1
"
in
screen|[sS][Cc][rR]
*
)
FTOG
=
"/var/lib/pyra/screen-toggle-value"
FPAT
=
"/sys/class/backlight/backlight"
minbright
=
0
;;
keyboard|[kK][eE][yY]
*
)
FTOG
=
"/var/lib/pyra/keyboard-toggle-value"
FPAT
=
"/sys/class/backlight/keyboard-backlight"
minbright
=
0
;;
*
)
help
"
$0
"
exit
1
;;
esac
FCUR
=
"
$FPAT
/actual_brightness"
FMAX
=
"
$FPAT
/max_brightness"
FSET
=
"
$FPAT
/brightness"
curbright
=
"
$(
cat
"
$FCUR
"
)
"
maxbright
=
"
$(
cat
"
$FMAX
"
)
"
newbright
=
$curbright
case
"
$2
"
in
set
|
[
sS][eE][tT]
)
if
[
!
$3
]
;
then
newbright
=
$(
zenity
--scale
--text
"pick a number"
"--min-value=
$minbright
"
"--max-value=
$maxbright
"
"--value=
$curbright
"
--step
1
)
;
else
newbright
=
$3
fi
if
[
!
$newbright
]
;
then
exit
0
fi
;;
up|[uU][pP]
)
if
[
!
$3
]
;
then
newbright
=
$((
$curbright
+
1
))
else
newbright
=
$((
$curbright
+
$3
))
fi
;;
down|[dD][oO][wW][nN]
)
if
[
!
$3
]
;
then
newbright
=
$((
$curbright
-
1
))
else
newbright
=
$((
$curbright
-
$3
))
fi
;;
toggle|[tT][oO][gG]
*
)
if
[
$curbright
=
0
]
;
then
newbright
=
"
$(
cat
$FTOG
)
"
else
echo
$curbright
>
$FTOG
minbright
=
0
newbright
=
0
fi
;;
*
)
help
"
$0
"
exit
1
;;
esac
[
$newbright
-le
$minbright
]
&&
newbright
=
$minbright
[
$newbright
-ge
$maxbright
]
&&
newbright
=
$maxbright
echo
$newbright
>
$FSET
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment