commit 014dfc2c21a86773b9d3bfc4ec4d4a66e7fa75a6 Spenser Truex <truex@equwal.com> 2025-09-01 18:39:04 -0400 Add scripts and submodules
.gitmodules | 12 ++++++++++++ dbc | 5 +++++ dbrowsel | 30 ++++++++++++++++++++++++++++++ dmenu_run | 2 ++ dmodurl | 1 + dpatchmail | 1 + dsad | 1 + dshow | 6 ++++++ dsudo | 3 +++ passmenu | 25 +++++++++++++++++++++++++ prompt-mail | 1 + y-or-n | 5 +++++ 12 files changed, 92 insertions(+)
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e1ba945 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,12 @@ +[submodule "prompt-mail"] + path = prompt-mail + url = /home/jose/src/sh/dmenu-folder/dmenu-scripts-public/prompt-mail +[submodule "dmodurl"] + path = dmodurl + url = git@github.com:equwal/dmodurl +[submodule "dsad"] + path = dsad + url = git@github.com:equwal/dsad +[submodule "dpatchmail"] + path = dpatchmail + url = git@github.com:equwal/dpatchmail diff --git a/dbc b/dbc new file mode 100755 index 0000000..893a40d --- /dev/null +++ b/dbc @@ -0,0 +1,5 @@ +#!/bin/sh +# also see dshow +ARITH="$(echo '' | dmenu -p 'ARITHMETIC FOR: bc -l' | bc -l)" +echo EXIT | dmenu -p "$ARITH" | sed -n '' +echo "$ARITH" diff --git a/dbrowsel b/dbrowsel new file mode 100755 index 0000000..1e3f7e7 --- /dev/null +++ b/dbrowsel @@ -0,0 +1,30 @@ +#!/bin/bash + +# Dmenu for selecting which browser to open. +# from github.com/AlexChaplinBraz/dmenu-scripts/blob/master/dbrowsel +# (with edits) + +THEBROWSER="1. \$BROWSER $BROWSER + clipboard" +BROWSER2='2. firefox + clipboard' +XSELECT='3. clipboard' + +BROWSERS="$THEBROWSER +$BROWSER2 +$XSELECT" + +[ -z "$1" ] && URL="$(xclip -o)" +[ -z "$1" ] || URL="$1" + +SHORTURL="$(echo "$URL" | sed 's!https?:?/?/?!!' | sed 's!/.*!!')" + +CHOSEN=$(printf %s\\n "$BROWSERS" | dmenu -i -l 5 -p "Select browser for ($SHORTURL...): ") + +[ -z "$CHOSEN" ] && exit 1 + +case $CHOSEN in + "$THEBROWSER") command -v "$BROWSER" && echo "$URL" | xclip -i -sel clip && $BROWSER "$URL";; + "$TOR") command -v "tor-browser" && echo "$URL" | xclip -i -sel clip && tor-browser "$URL";; # tor-browser in PATH? + "$BROWSER2") command -v "firefox" && firefox "$URL";; + "$XSELECT") command -v "xclip" && echo "$URL" | xclip -i -sel clip ;; # TODO: maybe support xsel + *) eval "$CHOSEN" "$URL";; +esac diff --git a/dmenu_run b/dmenu_run new file mode 100755 index 0000000..834ede5 --- /dev/null +++ b/dmenu_run @@ -0,0 +1,2 @@ +#!/bin/sh +dmenu_path | dmenu "$@" | ${SHELL:-"/bin/sh"} & diff --git a/dmodurl b/dmodurl new file mode 160000 index 0000000..46485b1 --- /dev/null +++ b/dmodurl @@ -0,0 +1 @@ +Subproject commit 46485b181caa009512b4c3a508dc0a137acc839d diff --git a/dpatchmail b/dpatchmail new file mode 160000 index 0000000..8be09ae --- /dev/null +++ b/dpatchmail @@ -0,0 +1 @@ +Subproject commit 8be09ae7f67cc4fec6843f826916fba891d45cbc diff --git a/dsad b/dsad new file mode 160000 index 0000000..4bc47fb --- /dev/null +++ b/dsad @@ -0,0 +1 @@ +Subproject commit 4bc47fb4c35ea9bf65fde3b711d01aea13302df9 diff --git a/dshow b/dshow new file mode 100755 index 0000000..6b04faa --- /dev/null +++ b/dshow @@ -0,0 +1,6 @@ +#!/bin/sh +# also see dbc +#dmenu_path | dmenu "$@" | ${SHELL:-"/bin/sh"} & +COMM="$(dmenu_path | dmenu -p 'Command and args:' | ${SHELL:-"/bin/sh"})" +echo EXIT | dmenu -p "$COMM" +echo "$COMM" diff --git a/dsudo b/dsudo new file mode 100755 index 0000000..a15e270 --- /dev/null +++ b/dsudo @@ -0,0 +1,3 @@ +#!/bin/sh + +sudo dmenu_run diff --git a/passmenu b/passmenu new file mode 100755 index 0000000..83268bc --- /dev/null +++ b/passmenu @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +shopt -s nullglob globstar + +typeit=0 +if [[ $1 == "--type" ]]; then + typeit=1 + shift +fi + +prefix=${PASSWORD_STORE_DIR-~/.password-store} +password_files=( "$prefix"/**/*.gpg ) +password_files=( "${password_files[@]#"$prefix"/}" ) +password_files=( "${password_files[@]%.gpg}" ) + +password=$(printf '%s\n' "${password_files[@]}" | dmenu "$@") + +[[ -n $password ]] || exit + +if [[ $typeit -eq 0 ]]; then + pass show -c "$password" 2>/dev/null +else + pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | + xdotool type --clearmodifiers --file - +fi diff --git a/prompt-mail b/prompt-mail new file mode 160000 index 0000000..9d7bccc --- /dev/null +++ b/prompt-mail @@ -0,0 +1 @@ +Subproject commit 9d7bccc6b373f94ebfd6f758a628bf233e57e8d9 diff --git a/y-or-n b/y-or-n new file mode 100755 index 0000000..f67d12b --- /dev/null +++ b/y-or-n @@ -0,0 +1,5 @@ +#!/bin/sh +# dmenu yes/no prompt. + +# y-or-n.sh "prompt" +[ $(printf 'yes\nno' | dmenu -i -p "$1") = "yes" ]