diff options
| author | Raymaekers Luca <luca@spacehb.net> | 2025-06-25 10:16:49 +0200 |
|---|---|---|
| committer | Raymaekers Luca <luca@spacehb.net> | 2025-06-25 10:16:49 +0200 |
| commit | 0de0f0922a2c3ce0246c99c8f6f276d06cf11531 (patch) | |
| tree | 71028e93f32be21efdb4cf50dd77237f96fab8ee | |
| parent | 32518bbe83424217a55399c721816a4e69c23b22 (diff) | |
checkpoint
| -rwxr-xr-x | bin/extra/saveself | 7 | ||||
| -rwxr-xr-x | bin/menuscripts/mpwgen | 39 |
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" |
