This commit is contained in:
parent
d39704ed6d
commit
1d8bbf1abe
|
@ -22,6 +22,6 @@ Depends:
|
||||||
Description: Librem 5 Goodies
|
Description: Librem 5 Goodies
|
||||||
A collection of bash scripts and applications made to add functionalities to
|
A collection of bash scripts and applications made to add functionalities to
|
||||||
the Librem 5 phone and Phosh Shell. It includes the following:
|
the Librem 5 phone and Phosh Shell. It includes the following:
|
||||||
- Contacts Importer: A simple application to import contacts from a vcard file
|
- L5 Contacts Importer: A simple application to import contacts from a vcard
|
||||||
to GNOME Contacts.
|
file to GNOME Contacts.
|
||||||
- Screenshot: A simple application to make screenshots on the Librem 5
|
- L5 Screenshot: A simple application to make screenshots on the Librem 5
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
contacts-importer /usr/bin
|
l5-contacts-importer /usr/bin
|
||||||
contacts-importer.desktop /usr/share/applications
|
l5-contacts-importer.desktop /usr/share/applications
|
||||||
screenshot /usr/bin
|
l5-screenshot /usr/bin
|
||||||
screenshot.desktop /usr/share/applications
|
l5-screenshot.desktop /usr/share/applications
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
# Adapted for the L5 with gnome-contacts
|
||||||
|
# Original Script: https://www.isticktoit.net/?p=1536
|
||||||
|
|
||||||
|
function usage()
|
||||||
|
{
|
||||||
|
echo "Usage: $0 <vcard-file>"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
NOTIFY_SEND="notify-send -i preferences-desktop-personal"
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
--help|-h|-?)
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#Selecting a file
|
||||||
|
|
||||||
|
if [ -n "$1" ]; then
|
||||||
|
FILE="$1"
|
||||||
|
else
|
||||||
|
FILE=$(yad --title "Import Contacts" --text="Select a VCF file to import" --file=)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$FILE" == "" ]; then
|
||||||
|
yad --title "Import Contacts" --text="You did not selected any file"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
$NOTIFY_SEND -t 1000 "Import Contacts" "Importing Contacts from $FILE"
|
||||||
|
|
||||||
|
#Name of the database where the contacts will be imported to.
|
||||||
|
CONTACTDB=$(syncevolution --print-databases | grep "system-address-book"| sed 's#(.*##' | sed 's# ##g' )
|
||||||
|
|
||||||
|
#Temp directory to mess with files:
|
||||||
|
|
||||||
|
TEMP=$(mktemp -d -t contacts-importer-XXXXXXXXXXXXX-"$(date +%Y-%m-%d-%H-%M-%S)")
|
||||||
|
|
||||||
|
#Some control info to make sure the file is a vcard
|
||||||
|
|
||||||
|
MIMETYPE=$(file --mime-type -b "$FILE")
|
||||||
|
CONTROL="text/vcard"
|
||||||
|
|
||||||
|
if [[ "$MIMETYPE" != "$CONTROL" ]]; then
|
||||||
|
$NOTIFY_SEND -t 1000 "File is not a vcard! Bye!" && exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#Begin importing contacts
|
||||||
|
|
||||||
|
cd "$TEMP"
|
||||||
|
|
||||||
|
awk ' /BEGIN:VCARD/ { ++a; fn=sprintf("card_import_L5_%02d.vcf", a); print "Writing: ", fn } { print $0 >> fn; } ' "$FILE"
|
||||||
|
|
||||||
|
RET=0
|
||||||
|
for f in "$TEMP"/card_import_L5*
|
||||||
|
do
|
||||||
|
syncevolution --import "${f%}" backend=evolution-contacts database="${CONTACTDB}" || RET=1
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $RET -eq 0 ]
|
||||||
|
then
|
||||||
|
$NOTIFY_SEND "Successful import"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
$NOTIFY_SEND "Error"
|
||||||
|
exit 1
|
||||||
|
fi
|
|
@ -0,0 +1,44 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# This screenshot program was based on an initial command-line only version
|
||||||
|
# by the purismforum user in community/librem-5
|
||||||
|
#
|
||||||
|
# I've since expanded it to use libnotify and provide a GUI
|
||||||
|
# It requires the grim, libnotify-bin and yad packages:
|
||||||
|
# sudo apt install grim yad libnotify-bin
|
||||||
|
|
||||||
|
# Adding usage information and Icon to libnotify
|
||||||
|
|
||||||
|
function usage()
|
||||||
|
{
|
||||||
|
echo "Usage: $0, or just press the Screen Shot Icon in the app tray"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
NOTIFY_SEND="notify-send -i applets-screenshooter"
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
--help|-h|-?)
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
#Variable
|
||||||
|
|
||||||
|
SCREENSHOT="/home/$USER/Pictures/$(date +%Y-%m-%d-%H%M%S).png"
|
||||||
|
|
||||||
|
if [ -e /usr/bin/yad ]; then
|
||||||
|
INPUT=$(yad --title Screenshot --text="Take screenshot after X seconds" --form --field=filename:SFL --field=seconds:NUM "$SCREENSHOT" "5" --focus-field=2)
|
||||||
|
echo "$INPUT"
|
||||||
|
SCREENSHOT=$(echo "$INPUT" | cut -d '|' -f1)
|
||||||
|
SECONDS=$(echo "$INPUT" | cut -d '|' -f2)
|
||||||
|
else
|
||||||
|
SECONDS=$(yad --title Screenshot --text="Take screenshot after X seconds" --entry-text=5 --entry)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$SECONDS" -eq 0 ]; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
$NOTIFY_SEND -t 1000 screenshot "Taking a screenshot in $SECONDS seconds"
|
||||||
|
sleep "$SECONDS";
|
||||||
|
grim "$SCREENSHOT"
|
||||||
|
$NOTIFY_SEND screenshot "Screenshot stored at ${SCREENSHOT}"
|
Loading…
Reference in New Issue