summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/extra/saveself7
-rwxr-xr-xbin/menuscripts/mpwgen39
2 files changed, 21 insertions, 25 deletions
diff --git a/bin/extra/saveself b/bin/extra/saveself
index 8906a5f..90eba98 100755
--- a/bin/extra/saveself
+++ b/bin/extra/saveself
@@ -17,20 +17,15 @@ PrevCapacity="$(GetBatteryCapacity)"
while true
do
- sleep 5
Capacity="$(GetBatteryCapacity)"
if [ "$Capacity" -lt "$PrevCapacity" ]
then
if [ "$Capacity" -le "$Threshold" ]
then
- setsid slock
HostName="$(hostname)"
if [ "$HostName" = "spring" ]
then
- doas /usr/sbin/zzz -Z
- elif [ "$HostName" = "winter" ]
- then
- systemctl hibernate
+ setsid doas /usr/sbin/zzz -Z
fi
fi
PrevCapacity="$Capacity"
diff --git a/bin/menuscripts/mpwgen b/bin/menuscripts/mpwgen
index 331e431..791fac3 100755
--- a/bin/menuscripts/mpwgen
+++ b/bin/menuscripts/mpwgen
@@ -1,23 +1,24 @@
-#!/usr/bin/env sh
+#!/bin/sh
-input () { commander -c -i -p "$1"; }
-
-choice="$(printf "multiline\nsingle\n" | commander -c -w 2 -y 1)"
-[ "$choice" ] || exit 1
-
-password="$(input "name:")"
-[ "$password" ] || exit 1
-
-if [ "$choice" = "multiline" ]
+if [ "$MENUCMD" = "dmenu" ]
then
- login="$(find "${PASSWORD_STORE_DIR:=$HOME/.password-store}"/e-mails \
- -type f \
- -maxdepth 1 \
- -iname "*.gpg" \
- -printf "%f\n" | sed 's/\.gpg$//' | commander -c -p 'login:')"
- [ "$login" ] || exit 1
- printf "%s\nlogin: %s\n" "${password}" "${login}" | pass insert -mf "${password}"
- pass generate -ci "${password}"
+ input()
+ {
+ dmenu -p "${1% }" -c < /dev/null
+ }
else
- pass generate -cf "${password}"
+ input()
+ {
+ >&2 printf '%s: ' "${1%: }"
+ head -n 1
+ }
fi
+
+URL="$(input 'url: ')"
+[ "$URL" ] || exit 1
+Login="$(input 'login: ')"
+[ "$Login" ] || exit 1
+
+Password="websites/$URL/$Login"
+pass generate -c "$Password"
+notify-send '*mpwgen' "$Password"