From 0de0f0922a2c3ce0246c99c8f6f276d06cf11531 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Wed, 25 Jun 2025 10:16:49 +0200 Subject: checkpoint --- bin/extra/saveself | 7 +------ bin/menuscripts/mpwgen | 39 ++++++++++++++++++++------------------- 2 files changed, 21 insertions(+), 25 deletions(-) (limited to 'bin') 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" -- cgit v1.2.3-70-g09d2