Lots of stuff

This commit is contained in:
2021-06-13 11:43:14 +01:00
parent dad3e90dcf
commit 61b9707ae7
10 changed files with 90 additions and 19 deletions

View File

@@ -1,20 +1,16 @@
#!/bin/sh
#!/bin/sh
files="$(find -L "$HOME/Tower/Library")"
files="$(find -L "$HOME/Tower/Library" -name '*.pdf' -or -name '*.epub')"
options=$(echo $files | xargs --delimiter="\n" basename -a)
options=$(echo "$files" | xargs --delimiter="\n" basename -a)
# Get user selection via dmenu from emoji file.
chosen=$(cut -d ';' -f1 ~/.local/share/emojis | dmenu -i -l 30 | sed "s/ .*//")
chosen=$(echo "$options" | dmenu -i -ix -c -l 30)
# Exit if none chosen.
[ -z "$chosen" ] && exit
# If you run this command with an argument, it will automatically insert the
# character. Otherwise, show a message that the emoji has been copied.
if [ -n "$1" ]; then
xdotool type "$chosen"
else
printf "$chosen" | xclip -selection clipboard
notify-send "'$chosen' copied to clipboard." &
fi
line="$(($chosen + 1))"
file="$(echo "$files" | sed "${line}q;d")"
zathura "$file"

View File

@@ -3,4 +3,4 @@
# This script is the SUDO_ASKPASS variable, meaning that it will be used as a
# password prompt if needed.
dmenu -fn Monospace-18 -P -p "$1" <&- && echo
dmenu -P -p "$1" <&- && echo

44
.local/bin/enp Executable file
View File

@@ -0,0 +1,44 @@
#! /usr/bin/zsh
pwdpath="/tmp/pwd.gpg"
pinpath="${XDG_DATA_HOME:-$HOME/.local/share}/pin.gpg"
if [ -f "$pwdpath" ]
then
PIN="$(dmenupass "PIN")"
export MASTERPW="$(gpg --batch --yes --passphrase "$PIN" --decrypt "$pwdpath" 2&>/dev/null)"
elif [ -f "$pinpath" ]
then
export MASTERPW="$(dmenupass "Password")"
PIN="$(gpg --batch --yes --passphrase "$MASTERPW" --decrypt "$pinpath" 2&>/dev/null)"
echo "$MASTERPW" | gpg --symmetric --batch --yes --passphrase "$PIN" --output "$pwdpath"
else
export MASTERPW="$(dmenupass "Password")"
PIN="$(dmenupass "PIN")"
echo "$PIN" | gpg --symmetric --batch --yes --passphrase "$MASTERPW" --output "$pinpath"
echo "$MASTERPW" | gpg --symmetric --batch --yes --passphrase "$PIN" --output "$pwdpath"
fi
[ -z "$MASTERPW" ] && exit 1;
choices="$(enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort show 2>&1 | sed -n '/level=info/p')"
awkcommand='
{
if (length($3)) {
$line = $2" ("$3")"; # If username exists wrap it in brackets
} else {
$line = $2; # Otherwise just show title
}
print $line;
}
'
chosen="$(echo "$choices" | awk -F '\\s*(title|login|pass|cat\\.)\\s*:\\s*' "$awkcommand" | dmenu -i -ix -l 30)"
linenumber="$((chosen + 1))"
line="$(echo "$choices" | sed "${linenumber}q;d")"
echo $line | sed -n -e 's/.*? pass : (.*)+$/\\1/p'

View File

@@ -32,3 +32,6 @@ setupdev
setupwacom
setupmaptool
setupkeyring
setupfirefox
setupjoplin
setupnextcloud

View File

@@ -0,0 +1,9 @@
#! /bin/bash
[ -z MASTERPW ] &&
export MASTERPW=$(dialog --no-cancel --passwordbox "Enter Enpass master password." 10 60 3>&1 1>&2 2>&3 3>&1 | sed 's/\s//g')
PIN=$(dialog --no-cancel --passwordbox "Enter short term PIN for master password." 10 60 3>&1 1>&2 2>&3 3>&1 | sed 's/\s//g')

View File

@@ -4,8 +4,27 @@ TOWER=$(enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort show "Sca
TOWERUN=$(echo "$TOWER" | grep -Po "(?<=login: )\w+")
TOWERPW=$(echo "$TOWER" | grep -Po "(?<=pass : ).+(?=\")")
path="https://tower.scarif.space/remote.php/dav/files/chris/Joplin"
joplin config sync.target 5
joplin config sync.5.path https://tower.scarif.space/remote.php/dav/files/chris/Joplin
joplin config sync.5.path "$path"
joplin config sync.5.username "$TOWERUN"
joplin config sync.5.password "$TOWERPW"
joplin sync
joplin sync &
echo "$path" | xclip -selection clipboard -i
joplin-desktop &
clipnotify
echo "$TOWERUN" | xclip -selection clipboard -i
clipnotify
echo "$TOWERPW" | xclip -selection clipboard -i
read -n 1 -r -s -p $'Press enter when you have synced Joplin...\n'
echo "" | xclip -selection clipboard -i