Merge remote-tracking branch 'origin/master' into x250

This commit is contained in:
Dr. Amr Osman 2019-04-12 22:08:08 +02:00
commit 1e1af1fc46
5 changed files with 58 additions and 89 deletions

View File

@ -1,26 +1,3 @@
#
# Calcurse keys configuration file
#
# This file sets the keybindings used by Calcurse.
# Lines beginning with "#" are comments, and ignored by Calcurse.
# To assign a keybinding to an action, this file must contain a line
# with the following syntax:
#
# ACTION KEY1 KEY2 ... KEYn
#
# Where ACTION is what will be performed when KEY1, KEY2, ..., or KEYn
# will be pressed.
#
# To define bindings which use the CONTROL key, prefix the key with 'C-'.
# The escape, space bar and horizontal Tab key can be specified using
# the 'ESC', 'SPC' and 'TAB' keyword, respectively.
# Arrow keys can also be specified with the UP, DWN, LFT, RGT keywords.
# Last, Home and End keys can be assigned using 'KEY_HOME' and 'KEY_END'
# keywords.
#
# A description of what each ACTION keyword is used for is available
# from calcurse online configuration menu.
generic-cancel ESC generic-cancel ESC
generic-select SPC generic-select SPC
generic-credits @ generic-credits @

0
.config/user-dirs.dirs Executable file → Normal file
View File

View File

@ -3,7 +3,6 @@
# If they're in /etc/fstab, they'll be mounted automatically. # If they're in /etc/fstab, they'll be mounted automatically.
# Otherwise, you'll be prompted to give a mountpoint from already existsing directories. # Otherwise, you'll be prompted to give a mountpoint from already existsing directories.
# If you input a novel directory, it will prompt you to create that directory. # If you input a novel directory, it will prompt you to create that directory.
pgrep -x dmenu && exit
getmount() { \ getmount() { \
[ -z "$chosen" ] && exit 1 [ -z "$chosen" ] && exit 1
@ -17,7 +16,7 @@ getmount() { \
mountusb() { \ mountusb() { \
chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?" | awk '{print $1}')" chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?" | awk '{print $1}')"
sudo -A mount "$chosen" && notify-send "$chosen mounted." && exit 0 sudo -A mount "$chosen" && notify-send "💻 USB mounting" "$chosen mounted." && exit 0
alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$2=="part"&&$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not \( -path *%s -prune \) \ \n",$3}') alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$2=="part"&&$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not \( -path *%s -prune \) \ \n",$3}')
getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted" getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted"
partitiontype="$(lsblk -no "fstype" "$chosen")" partitiontype="$(lsblk -no "fstype" "$chosen")"
@ -25,14 +24,14 @@ mountusb() { \
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;; "vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;;
*) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" 741 "$mp";; *) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" 741 "$mp";;
esac esac
notify-send "$chosen mounted to $mp." notify-send "💻 USB mounting" "$chosen mounted to $mp."
} }
mountandroid() { \ mountandroid() { \
chosen=$(echo "$anddrives" | dmenu -i -p "Which Android device?" | cut -d : -f 1) chosen=$(echo "$anddrives" | dmenu -i -p "Which Android device?" | cut -d : -f 1)
getmount "$HOME -maxdepth 3 -type d" getmount "$HOME -maxdepth 3 -type d"
simple-mtpfs --device "$chosen" "$mp" simple-mtpfs --device "$chosen" "$mp"
notify-send "Android device mounted to $mp." notify-send "🤖 Android Mounting" "Android device mounted to $mp."
} }
asktype() { \ asktype() { \

View File

@ -7,17 +7,17 @@ unmountusb() {
[ -z "$drives" ] && exit [ -z "$drives" ] && exit
chosen=$(echo "$drives" | dmenu -i -p "Unmount which drive?" | awk '{print $1}') chosen=$(echo "$drives" | dmenu -i -p "Unmount which drive?" | awk '{print $1}')
[ -z "$chosen" ] && exit [ -z "$chosen" ] && exit
sudo -A umount "$chosen" && pgrep -x dunst && notify-send "$chosen unmounted." sudo -A umount "$chosen" && notify-send "💻 USB unmounting" "$chosen unmounted."
} }
unmountandroid() { \ unmountandroid() { \
chosen=$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -i -p "Unmount which device?") chosen=$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -i -p "Unmount which device?")
[ -z "$chosen" ] && exit [ -z "$chosen" ] && exit
sudo -A umount -l "$chosen" && pgrep -x dunst && notify-send "$chosen unmounted." sudo -A umount -l "$chosen" && notify-send "🤖 Android unmounting" "$chosen unmounted."
} }
asktype() { \ asktype() { \
case $(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?") in case "$(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?")" in
USB) unmountusb ;; USB) unmountusb ;;
Android) unmountandroid ;; Android) unmountandroid ;;
esac esac

View File

@ -1,21 +1,14 @@
#!/bin/sh #!/bin/sh
[ -z "$1" ] && echo "Give either a pdf file or a DOI as an argument." && exit
# Give this script a .pdf and it will attempt if [ -f "$1" ]; then
# to return a proper .bib citation via doi. # Try to get DOI from pdfinfo or pdftotext output.
# Internet connection required.
if [ -f "$1" ];
then
# Get the doi from metadata, if not possible, get
# doi from pdftotext output, if not possible, exit.
doi=$(pdfinfo "$1" | grep -io "doi:.*") || doi=$(pdfinfo "$1" | grep -io "doi:.*") ||
doi=$(pdftotext "$1" 2>/dev/null - | grep -o "doi:.*" -m 1) || doi=$(pdftotext "$1" 2>/dev/null - | grep -io "doi:.*" -m 1) ||
exit 1 exit 1
else else
# If not given file, assume argument is doi
doi="$1" doi="$1"
fi fi
# Check crossref.org for the bib citation. # Check crossref.org for the bib citation.
curl -s "http://api.crossref.org/works/$doi/transform/application/x-bibtex" -w "\\n" | curl -s "http://api.crossref.org/works/$doi/transform/application/x-bibtex" -w "\\n"
sed -e "/^[^\\(\\t\\|@\\|}\\)]/d"