diff options
| author | stkhan <personal@slickd.xyz> | 2022-04-08 09:06:03 -0800 |
|---|---|---|
| committer | stkhan <personal@slickd.xyz> | 2022-04-08 09:06:03 -0800 |
| commit | df966cab682c913e8b62b460c9ef900e1046863f (patch) | |
| tree | 99c5f7363f91fdfcd7cd37ebcd6e51d185073759 /dwm-6.3/scripts | |
| parent | 356b726ec5ac1d6796cfb5ca6171d20b4d0783a1 (diff) | |
Added dwmblocks scripts, sxiv, and modified dwm bindings
Diffstat (limited to 'dwm-6.3/scripts')
| -rwxr-xr-x | dwm-6.3/scripts/dmenuunicode | 18 | ||||
| -rwxr-xr-x | dwm-6.3/scripts/passmenu2 | 60 |
2 files changed, 78 insertions, 0 deletions
diff --git a/dwm-6.3/scripts/dmenuunicode b/dwm-6.3/scripts/dmenuunicode new file mode 100755 index 0000000..7d9a4ea --- /dev/null +++ b/dwm-6.3/scripts/dmenuunicode @@ -0,0 +1,18 @@ +#!/bin/sh + +# The famous "get a menu of emojis to copy" script. + +# Get user selection via dmenu from emoji file. +chosen=$(cut -d ';' -f1 ~/.local/share/larbs/emoji | dmenu -i -l 30 | sed "s/ .*//") + +# Exit if none chosen. +[ -z "$chosen" ] && exit + +# If you run this command with an argument, it will automatically insert the +# character. Otherwise, show a message that the emoji has been copied. +if [ -n "$1" ]; then + xdotool type "$chosen" +else + printf "$chosen" | xclip -selection clipboard + notify-send "'$chosen' copied to clipboard." & +fi diff --git a/dwm-6.3/scripts/passmenu2 b/dwm-6.3/scripts/passmenu2 new file mode 100755 index 0000000..3847219 --- /dev/null +++ b/dwm-6.3/scripts/passmenu2 @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +shopt -s nullglob globstar + +typeit=0 +if [[ $1 == "--type" ]]; then + typeit=1 + shift +fi + + +STARTDIR=${PASSWORD_STORE_DIR-~/.password-store} +BASEDIR=$STARTDIR +DONE=0 +LEVEL=0 +PREVSELECTION="" +SELECTION="" + +while [ "$DONE" -eq 0 ] ; do + password_files=( "$STARTDIR"/* ) + password_files=( "${password_files[@]#"$STARTDIR"/}" ) + password_files=( "${password_files[@]%.gpg}" ) + + if [ "$LEVEL" -ne 0 ] ; then + password_files=(".." "${password_files[@]}") + fi + entry=$(printf '%s\n' "${password_files[@]}" | dmenu "$@" -l 15) + + echo "entry: $entry" + if [ -z "$entry" ] ; then + DONE=1 + exit + fi + + if [ "$entry" != ".." ] ; then + PREVSELECTION=$SELECTION + SELECTION="$SELECTION/$entry" + + # check if another dir + if [ -d "$STARTDIR/$entry" ] ; then + STARTDIR="$STARTDIR/$entry" + LEVEL=$((LEVEL+1)) + else + # not a directory so it must be a real password entry + + if [[ $typeit -eq 0 ]]; then + pass show -c "$SELECTION" 2>/dev/null + else + xdotool - <<<"type --clearmodifiers -- $(pass show "$SELECTION" | head -n 1)" + fi + DONE=1 + fi + + else + LEVEL=$((LEVEL-1)) + SELECTION=$PREVSELECTION + STARTDIR="$BASEDIR/$SELECTION" + fi +done + |