Add gpe(gpg wrapper) for ranger

This commit is contained in:
Smirnov Alexandr 2021-03-22 19:13:32 +02:00
parent 633e8ad6cd
commit 71ddd0ad2f
7 changed files with 61 additions and 14 deletions

View file

@ -1,19 +1,29 @@
#!/bin/sh
kernel=$(cat /proc/sys/kernel/osrelease|cut -d '-' -f1)
# Kernel version
kernel=$(cat /proc/sys/kernel/osrelease | cut -d '-' -f1)
# Window manager
[ ! "$wm" ] && [ "$DISPLAY" ] && command -v xprop >/dev/null && {
wmname="$(xprop -id $(xprop -root -notype\
| awk '$1=="_NET_SUPPORTING_WM_CHECK:"{print $5}') -notype -f _NET_WM_NAME 8t\
| grep "WM_NAME"\
| cut -f2 -d \")"
}
# Shell
shell=$(basename $SHELL)
# Installed packages
manager=$(which apt pacman yay 2>/dev/null)
manager=${manager##*/}
case "$manager" in
apt) packages="$(dpkg-query -f '${binary:Package}\n' -W | wc -l)";;
yay) packages="$(yay -Q | wc -l)";;
pacman) packages="$(pacman -Q | wc -l)";;
apt) packages="$(dpkg-query -f '${binary:Package}\n' -W | wc -l)" ;;
yay) packages="$(yay -Q | wc -l)" ;;
pacman) packages="$(pacman -Q | wc -l)" ;;
esac
# Text decorations
bold=$(tput bold)
reset="\e[0m"
blue="\e[36m"

24
bin/gpe Executable file
View file

@ -0,0 +1,24 @@
#!/usr/bin/env bash
# For working this script set in $GPG_KEY you gpg key
## Functions
function encrypt() {
gpg -ea -r $GPG_KEY $@
}
function decrypt() {
local fn="$1"
if [ ${fn: -4} == ".asc" ]
then
gpg -d -o ${fn%%.asc} $@
elif [ ${fn: -4} == ".gpg" ]
then
gpg -d -o ${fn%%.gpg} $@
fi
}
## Logic
case "$1" in
enc|e) shift; encrypt $@ ;;
dec|d) shift; decrypt $@ ;;
*) echo "Error." ;;
esac