From 1abce784cf269fd98ee5faa09e52ba642f2e61ec Mon Sep 17 00:00:00 2001 From: Adam Stück Date: Wed, 22 Mar 2023 07:49:52 +0100 Subject: switched from i3 to sway --- .local/bin/menu/pass | 24 ++++++++++++++++++++++++ .local/bin/menu/power | 9 +++++++++ 2 files changed, 33 insertions(+) create mode 100755 .local/bin/menu/pass create mode 100755 .local/bin/menu/power (limited to '.local/bin/menu') diff --git a/.local/bin/menu/pass b/.local/bin/menu/pass new file mode 100755 index 0000000..86fd1ee --- /dev/null +++ b/.local/bin/menu/pass @@ -0,0 +1,24 @@ +#!/bin/sh + +MENU_CMD="bemenu -p 'pass'" + +entry=$(find "$PASSWORD_STORE_DIR" -name '*.gpg' |\ + sed "s|$PASSWORD_STORE_DIR/||" |\ + sed "s|.gpg||" |\ + sort -n |\ + eval "$MENU_CMD") || exit 1 + +details=$(pass "$entry") || exit 1 +user=$(echo "$details" | sed -n '2p' | sed 's|user: ||') +pass=$(echo "$details" | head -n1) + +case "$(printf "autotype\npass\nuser" | eval "$MENU_CMD")" in + autotype) + wtype "$user" + wtype -k Tab + wtype "$pass" ;; + pass) + wtype "$pass" ;; + user) + wtype "$user" ;; +esac diff --git a/.local/bin/menu/power b/.local/bin/menu/power new file mode 100755 index 0000000..4962580 --- /dev/null +++ b/.local/bin/menu/power @@ -0,0 +1,9 @@ +#!/bin/sh + +case "$(printf "shutdown\nreboot\nlogout\nsuspend\nlock" | eval bemenu -p 'power')" in + shutdown) exec systemctl poweroff;; + reboot) exec systemctl reboot;; + logout) exec loginctl terminate-session "${XDG_SESSION_ID-}";; + suspend) exec systemctl suspend;; + lock) exec swaylock -f -c 000000;; +esac -- cgit v1.2.3-70-g09d2