Commit e02d7983 authored by Askarus's avatar Askarus

initial commit

parents
Pyra Zenity scripts for
- Display
- Keyboard
- LED
brightness and settings
NOTE:
1. LCD brightness can not be set to "0" to prevent a black screen. That can and will be changed later.
2. The "pyra-keyboard-toggle.sh" script does create a file in /var/lib/pyra
Here the previous brightness level is stored and overwritten if necessary
#!/bin/sh
minbright=0
curbright="$(cat /sys/devices/platform/keyboard-backlight/backlight/keyboard-backlight/actual_brightness)"
if [ "$curbright" = "$minbright" ]; then
newbright=$minbright
else
newbright=$(($curbright-1))
fi
echo $newbright > /sys/devices/platform/keyboard-backlight/backlight/keyboard-backlight/brightness
#!/bin/sh
maxbright="$(cat /sys/devices/platform/keyboard-backlight/backlight/keyboard-backlight/max_brightness)"
curbright="$(cat /sys/devices/platform/keyboard-backlight/backlight/keyboard-backlight/actual_brightness)"
if [ $curbright = $maxbright]; then
newbright=$maxbright
else
newbright=$(($curbright+1))
fi
echo $newbright > /sys/devices/platform/keyboard-backlight/backlight/keyboard-backlight/brightness
#!/bin/sh
minbright=0
maxbright="$(cat /sys/devices/platform/keyboard-backlight/backlight/keyboard-backlight/max_brightness)"
curbright="$(cat /sys/devices/platform/keyboard-backlight/backlight/keyboard-backlight/actual_brightness)"
if [ ! $1 ]; then
newbright=$(zenity --scale --text "pick a number" --min-value=$minbright --max-value=$maxbright --value=$curbright --step 1);
else
newbright=$1
fi
if [ $newbright ]; then
if [ $newbright -le $minbright ]; then newbright=$minbright; fi
if [ $newbright -ge $maxbright ]; then newbright=$maxbright; fi
echo $newbright > /sys/devices/platform/keyboard-backlight/backlight/keyboard-backlight/brightness
fi
#!/bin/sh
curbright="$(cat /sys/devices/platform/keyboard-backlight/backlight/keyboard-backlight/actual_brightness)"
if [ $curbright = 0 ]; then
newbright="$( cat /var/lib/pyra/keyboard-toggle-value)"
else
echo $curbright > /var/lib/pyra/keyboard-toggle-value
newbright=0
fi
echo $newbright > /sys/devices/platform/keyboard-backlight/backlight/keyboard-backlight/brightness
#!/bin/sh
if [ $1 ]; then
led=$1
else
led=$(zenity --list --height 580 --width 300 --text "LED" --radiolist --column "Pick" --column "LED" TRUE logo:blue:bottom FALSE logo:blue:top FALSE logo:green:bottom FALSE logo:green:top FALSE logo:red:bottom FALSE logo:red:top FALSE pyra:blue:left mmc0 pyra:blue:mid FALSE pyra:blue:right mmc1 pyra:green:left FALSE pyra:green:mid FALSE pyra:green:right FALSE pyra:red:left FALSE pyra:red:mid FALSE pyra:red:right);
fi
minbright=0;
maxbright="$(cat /sys/class/leds/$led/max_brightness)"
curbright="$(cat /sys/class/leds/$led/brightness)"
if [ $2 ]; then
newbright=$2;
else
newbright=$(zenity --scale --text "pick a number" --min-value=$minbright --max-value=$maxbright --value=$curbright --step 1);
fi
echo $newbright > /sys/class/leds/$led/brightness
#!/bin/sh
if [ $1 ]; then
if [ $2 ]; then
trigger=$2
else
trigger=$(zenity --list --text "Trigger for $led" --radiolist --column "Pick" --column "Opinion" TRUE none FALSE kbd-scrolllock FALSE kbd-numlock FALSE kbd-capslock FALSE kbd-kanalock FALSE kbd-shiftlock FALSE kbd-altgrlock FALSE kbd-ctrllock FALSE kbd-altlock FALSE kbd-shiftllock FALSE kbd-shiftrlock FALSE kbd-ctrlllock FALSE kbd-ctrlrlock FALSE usb-gadget FALSE usb-host FALSE mmc1 FALSE timer FALSE oneshot FALSE disk-activity FALSE ide-disk FALSE heartbeat FALSE cpu0 FALSE cpu1 FALSE default-on FALSE panic FALSE mmc0 FALSE mmc2 FALSE mmc3 FALSE generic-adc-batt-charging-or-full FALSE generic-adc-batt-charging FALSE generic-adc-batt-full FALSE generic-adc-batt-charging-blink-full-solid FALSE bq27421-0-charging-or-full FALSE bq27421-0-charging FALSE bq27421-0-full FALSE bq27421-0-charging-blink-full-solid FALSE bq24297-online FALSE rfkill0);
fi
led=$1
else
led=$(zenity --list --height 570 --width 300 --text "LED" --radiolist --column "Pick" --column "LED" TRUE logo:blue:bottom FALSE logo:blue:top FALSE logo:green:bottom FALSE logo:green:top FALSE logo:red:bottom FALSE logo:red:top FALSE pyra:blue:left mmc0 pyra:blue:mid FALSE pyra:blue:right mmc1 pyra:green:left FALSE pyra:green:mid FALSE pyra:green:right FALSE pyra:red:left FALSE pyra:red:mid FALSE pyra:red:right);
trigger=$(zenity --list --height 500 --width 300 --text "Trigger for $led" --radiolist --column "Pick" --column "Opinion" TRUE none FALSE kbd-scrolllock FALSE kbd-numlock FALSE kbd-capslock FALSE kbd-kanalock FALSE kbd-shiftlock FALSE kbd-altgrlock FALSE kbd-ctrllock FALSE kbd-altlock FALSE kbd-shiftllock FALSE kbd-shiftrlock FALSE kbd-ctrlllock FALSE kbd-ctrlrlock FALSE usb-gadget FALSE usb-host FALSE mmc1 FALSE timer FALSE oneshot FALSE disk-activity FALSE ide-disk FALSE heartbeat FALSE cpu0 FALSE cpu1 FALSE default-on FALSE panic FALSE mmc0 FALSE mmc2 FALSE mmc3 FALSE generic-adc-batt-charging-or-full FALSE generic-adc-batt-charging FALSE generic-adc-batt-full FALSE generic-adc-batt-charging-blink-full-solid FALSE bq27421-0-charging-or-full FALSE bq27421-0-charging FALSE bq27421-0-full FALSE bq27421-0-charging-blink-full-solid FALSE bq24297-online FALSE rfkill0);
fi
echo $trigger > /sys/class/leds/$led/trigger
#!/bin/sh
minbright=1
curbright="$(cat /sys/devices/platform/backlight/backlight/backlight/actual_brightness)"
if [ "$curbright" = "$minbright" ]; then
newbright=$minbright
else
newbright=$(($curbright-1))
fi
echo $newbright > /sys/devices/platform/backlight/backlight/backlight/brightness
#!/bin/sh
maxbright="$(cat /sys/devices/platform/backlight/backlight/backlight/max_brightness)"
curbright="$(cat /sys/devices/platform/backlight/backlight/backlight/actual_brightness)"
if [ $curbright = $maxbright]; then
newbright=$maxbright
else
newbright=$(($curbright+1))
fi
echo $newbright > /sys/devices/platform/backlight/backlight/backlight/brightness
#!/bin/sh
minbright=1
maxbright="$(cat /sys/devices/platform/backlight/backlight/backlight/max_brightness)"
curbright="$(cat /sys/devices/platform/backlight/backlight/backlight/actual_brightness)"
if [ ! $1 ]; then
newbright=$(zenity --scale --text "pick a number" --min-value=$minbright --max-value=$maxbright --value=$curbright --step 1);
else
newbright=$1
fi
if [ $newbright ]; then
if [ $newbright -le $minbright ]; then newbright=$minbright; fi
if [ $newbright -ge $maxbright ]; then newbright=$maxbright; fi
echo $newbright > /sys/devices/platform/backlight/backlight/backlight/brightness
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment