Add l5-flashlight application

This commit is contained in:
Kyle Rankin 2020-08-12 08:46:49 -07:00
parent 2556299314
commit f8e5e07a22
No known key found for this signature in database
GPG Key ID: 91AB3245B1D14ABD
6 changed files with 36 additions and 2 deletions

View File

@ -1,2 +1,2 @@
all:
shellcheck l5-contacts-importer l5-screenshot
shellcheck l5-contacts-importer l5-screenshot l5-flashlight

1
debian/control vendored
View File

@ -25,3 +25,4 @@ Description: Librem 5 Goodies
- L5 Contacts Importer: A simple application to import contacts from a vcard
file to GNOME Contacts.
- L5 Screenshot: A simple application to make screenshots on the Librem 5
- L5 Flashlight: A simple application to control the torch on the Librem 5

View File

@ -2,3 +2,5 @@ l5-contacts-importer /usr/bin
l5-contacts-importer.desktop /usr/share/applications
l5-screenshot /usr/bin
l5-screenshot.desktop /usr/share/applications
l5-flashlight /usr/bin
l5-flashlight.desktop /usr/share/applications

View File

@ -1,3 +1,3 @@
Test-Command: /usr/bin/l5-contacts-importer --help && /usr/bin/l5-screenshot --help
Test-Command: /usr/bin/l5-contacts-importer --help && /usr/bin/l5-screenshot --help && /usr/bin/l5-flashlight --help
Restrictions: superficial
Depends: librem5-goodies

25
l5-flashlight Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
function usage()
{
echo "Usage: $0, or just press the Flashlight Icon in the app tray"
exit 0
}
case "$1" in
--help|-h|-?)
usage
;;
esac
# Enable the LED so we can poll its state
sudo bash -c 'echo 255 > /sys/class/leds/flash_en/brightness'
yad --title flashlight --form \
--field='Flashlight ON!switch-on-symbolic':fbtn "sudo i2cset -y 1 0x53 0x10 0x1a" \
--field='Flashlight OFF!switch-off-symbolic':fbtn "sudo i2cset -y 1 0x53 0x10 0x18" \
--button='Close!gtk-cancel':1
sudo bash -c 'echo 0 > /sys/class/leds/flash_en/brightness'
exit

6
l5-flashlight.desktop Normal file
View File

@ -0,0 +1,6 @@
[Desktop Entry]
Name=Flashlight
Type=Application
Icon=system-shutdown
Exec=flashlight
Categories=Utility;