aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/,gopassmenu23
-rwxr-xr-xbin/,passmenu300
-rwxr-xr-xbin/,url_handler17
-rwxr-xr-xbin/,url_image12
-rwxr-xr-xbin/,xev_keys3
-rwxr-xr-xbin/akko_config8
-rwxr-xr-xbin/idea_config10
-rw-r--r--bin/mem.clj1
-rwxr-xr-xbin/power_menu17
9 files changed, 0 insertions, 391 deletions
diff --git a/bin/,gopassmenu b/bin/,gopassmenu
deleted file mode 100755
index 7031bb4..0000000
--- a/bin/,gopassmenu
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-
-DMENU_BIN="${DMENU_CMD:-/usr/bin/dmenu}"
-
-PROMPT="senha:"
-
-case "$1" in
- "--copy"|"-c")
- gopass ls --flat | ${DMENU_BIN} -p "${PROMPT}" | xargs --no-run-if-empty gopass show -c
- ;;
- "--type"|"-t")
- gopass ls --flat | ${DMENU_BIN} -p "${PROMPT}" | xargs --no-run-if-empty gopass show -o | wtype -
- ;;
- "--user"|"-l")
- gopass ls --flat | ${DMENU_BIN} -p "${PROMPT}" | xargs --no-run-if-empty -- bash -c 'gopass show -f $0 user' | head -n 1 | xdotool type --clearmodifiers --file -
- ;;
- *)
- echo "USAGE:"
- echo "-c or --copy: copy selected entry's password field to the clipboard"
- echo "-t or --type: type selected entry's password field using xdotool"
- echo "-l or --login: type selected entry's login field using xdotool"
- ;;
-esac
diff --git a/bin/,passmenu b/bin/,passmenu
deleted file mode 100755
index b25c129..0000000
--- a/bin/,passmenu
+++ /dev/null
@@ -1,300 +0,0 @@
-#!/usr/bin/env bash
-
-VERSION="23.1.4"
-
-set -eu
-
-FLAG_AUTOTYPE=0
-FLAG_COPY=0
-FLAG_FILEISUSER=0
-FLAG_ONLYPASSWORD=0
-FLAG_SQUASH=0
-FLAG_TYPE=0
-FLAG_HELP=0
-
-CMD_COPY="${CMD_COPY:-"wl-copy"}"
-CMD_TYPE="${CMD_TYPE:-"wtype -"}"
-
-# We expect to find these fields in pass(1)'s output
-PASS_FIELD_USERNAME="${PASS_FIELD_USERNAME:-"username"}"
-
-WOFI_PASS_AUTOTYPE="${WOFI_PASS_AUTOTYPE:-":username :tab :password"}"
-WOFI_PASS_DELAY=${WOFI_PASS_DELAY:-2}
-WOFI_PASS_AUTO_ENTER="${WOFI_PASS_AUTO_ENTER:-"false"}"
-
-function _wofi() {
- fuzzel -d "${@}"
-}
-
-function _pass() {
- pass "${@}"
-}
-
-function _trim() {
- local var="${*}"
- # remove leading whitespace characters
- var="${var#"${var%%[![:space:]]*}"}"
- # remove trailing whitespace characters
- var="${var%"${var##*[![:space:]]}"}"
- printf '%s' "${var}"
-}
-
-function generate_otp() {
- local -r passname="${1}"
- pass otp "${passname}" | tail -n1 | { IFS= read -r pass; printf %s "${pass}"; }
-}
-
-function parse_fields() {
- local field_list
- local has_username=0
- local -r passname="${1}"
- mapfile -t entries < <(_pass show "${passname}" | tail -n +2 )
- local line=""
- local fields=()
-
- for entry in "${entries[@]}"; do
- if [[ "${entry}" == "autotype_always" ]]; then
- fields+=("${entry}")
- else
- field="$(echo "${entry}" | cut -d: -f1 -s)"
- [ -n "${field}" ] && fields+=("${field}")
- fi
- done
-
- field_list+=("password")
- if [ ${FLAG_FILEISUSER} -eq 1 ]; then
- has_username=1
- field_list+=( "${PASS_FIELD_USERNAME}" )
- fi
- for line in "${fields[@]}"; do
- if [ "${line}" = "${PASS_FIELD_USERNAME}" ]; then
- if [ ${has_username} -eq 0 ]; then
- has_username=1
- field_list+=( "${line}" )
- fi
- elif [ "${line}" = "otpauth" ]; then
- field_list+=( "OTP" )
- elif [ "${line}" = "autotype_always" ]; then
- FLAG_AUTOTYPE=1
- else
- field_list+=( "${line}" )
- fi
- done
-
- if [ ${FLAG_TYPE} -eq 1 ] && [ ${has_username} -eq 1 ]; then
- field_list=("autotype" "${field_list[@]}")
- fi
-
- printf "%s\n" "${field_list[@]}"
-}
-
-function pass_field() {
- local -r passname="${1}"
- shift
- _trim "$(_pass show "${passname}" | tail -n+2 | grep "^${*}:.*$" | cut -d: -f1 -s --complement)"
-}
-
-function pass_get() {
- local -r passname="${1}"
- local -r field="${2}"
- if [ "${field}" = "password" ]; then
- _pass show "${passname}" | { IFS= read -r pass; printf %s "${pass}"; }
- elif [ "${field}" = "OTP" ]; then
- generate_otp "${passname}"
- elif [ ${FLAG_FILEISUSER} -eq 1 ] && [ "${field}" = "${PASS_FIELD_USERNAME}" ]; then
- printf %s "${passname##*/}"
- else
- pass_field "${@}"
- fi
-}
-
-function usage() {
- cat <<EOF
- Usage:
- wofi-pass [options]
-
- Options:
- -a, --autotype autotype whatever entry is chosen
- -c, --copy=[cmd] copy to clipboard. Defaults to wl-copy if no cmd is given.
- -f, --fileisuser use the name of the password file as username
- -h, --help show this help message
- -s, --squash don't show field choice if password file only contains password
- -t, --type=[cmd] type the selection instead of copying to clipboard.
- Defaults to wtype if no cmd is given.
-
- wofi-pass version ${VERSION}
-EOF
-}
-
-get_config_file () {
- local config_base_dir="${XDG_CONFIG_HOME:-"${HOME}/.config"}"
- readonly config_base_dir
-
- config_files=("${WOFI_PASS_CONFIG:-""}"
- "${config_base_dir}/wofi-pass/config"
- "/etc/wofi-pass.conf")
-
- # return the first config file with a valid path
- for config in "${config_files[@]}"; do
- if [[ -n "${config}" && -f "${config}" ]]; then
- printf "%s" "${config}"
- return
- fi
- done
-}
-
-load_config_file () {
- config_file="$(get_config_file)"
- if [[ -n "${config_file}" ]]; then
- #shellcheck source=wofi-pass.conf
- source "${config_file}"
- fi
-}
-
-function parse_arguments() {
- OPTS="$(getopt --options ac::fhst:: --longoptions autotype,copy::,fileisuser,help,squash,type:: -n 'wofi-pass' -- "${@}")"
- eval set -- "${OPTS}"
- while true; do
- case "${1}" in
- -a | --autotype) FLAG_AUTOTYPE=1; shift;;
- -c | --copy)
- FLAG_COPY=1
- [ -n "${2}" ] && CMD_COPY="${2}"
- shift 2;;
- -f | --fileisuser) FLAG_FILEISUSER=1; shift;;
- -h | --help) FLAG_HELP=1; shift;;
- -s | --squash) FLAG_SQUASH=1; shift;;
- -t | --type)
- FLAG_TYPE=1
- [ -n "${2}" ] && CMD_TYPE="${2}"
- shift 2;;
- --) shift; break;;
- *) break;;
- esac
- done
-}
-
-function exit_if_help_flag_set() {
- if [ ${FLAG_HELP} -eq 1 ]; then
- usage >&2
- exit 0
- fi
-}
-
-function verify_flags() {
- if [ ${FLAG_TYPE} -eq 1 ] && [ ${FLAG_COPY} -eq 1 ]; then
- printf "copy and type cannot be used at same time. Please pass only one.\n" >&2
- exit 1
- elif [ ${FLAG_TYPE} -eq 0 ] && [ ${FLAG_COPY} -eq 0 ]; then
- printf "neither -c/--copy or -t/--type passed. Defaulting to copying with %s.\n" "${CMD_COPY}" >&2
- fi
-}
-
-function get_passname_from_menu() {
- local -r pass_dir="${PASSWORD_STORE_DIR:-${HOME}/.password-store}"
- local password_files
- password_files="$(find "${pass_dir}" -name "*.gpg" | sed "s|^${pass_dir}\/\(.*\)\.gpg$|\1|" | sort)"
- readonly password_files
-
- printf "%s" "$(printf '%s\n' "${password_files}" | _wofi --dmenu)"
-}
-
-function get_field_from_menu() {
- local field
- local field_count
- local -r passname="${1}"
- mapfile -t field_list < <(parse_fields "${passname}")
- field_count=${#field_list[@]}
- readonly field_list
- readonly field_count
- if [ ${FLAG_SQUASH} -eq 1 ] && [ "${field_count}" -le 1 ]; then
- printf "password"
- FLAG_ONLYPASSWORD=1
- elif [ ${FLAG_AUTOTYPE} -ne 1 ]; then
- printf "%s" "$(printf '%s\n' "${field_list[@]}" | _wofi --dmenu)"
- fi
-}
-
-function get_output_cmd() {
- if [ ${FLAG_TYPE} -eq 1 ]; then
- printf "%s" "${CMD_TYPE}"
- else
- printf "%s" "${CMD_COPY}"
- fi
-}
-
-function press_key() {
- local -r key="${1}"
- wtype -P "${key}" -p "${key}"
-}
-
-function output_autotype() {
- local -r passname="${1}"
- local -r cmd_output="${2}"
- local password
- password="$(pass_get "${passname}" "password")"
- readonly password
- local autotype
-
- autotype="$(pass_get "${passname}" "autotype")"
- [ -z "${autotype}" ] && autotype="${WOFI_PASS_AUTOTYPE}"
- readonly autotype
-
- for word in ${autotype}; do
- case "${word}" in
- ":tab") [ ${FLAG_TYPE} -eq 1 ] && press_key "Tab" || printf "\t";;
- ":space") [ ${FLAG_TYPE} -eq 1 ] && press_key "space" || printf " ";;
- ":enter") [ ${FLAG_TYPE} -eq 1 ] && press_key "Return" || printf "\n";;
- ":delay") [ ${FLAG_TYPE} -eq 1 ] && sleep "${WOFI_PASS_DELAY}";;
- ":otp") printf "%s" "$(generate_otp "${passname}")" | ${cmd_output};;
- ":password") printf "%s" "${password}" | ${cmd_output};;
- ":username") printf "%s" "$(pass_get "${passname}" "${PASS_FIELD_USERNAME}")" | ${cmd_output};;
- ":path") printf "%s" "${passname##*/}" | ${cmd_output};;
- *) printf "%s" "$(pass_get "${passname}" "${word}")" | ${cmd_output}
- esac
- done
- [[ "${WOFI_PASS_AUTO_ENTER}" != "false" ]] && press_key "Return"
-}
-
-function output_field() {
- local cmd_output
- local -r passname="${1}"
- local -r field="${2}"
- cmd_output="$(get_output_cmd)"
-
- if [ ${FLAG_AUTOTYPE} -eq 1 ] || [ "${field}" = "autotype" ]; then
- # check if we are autotyping a password-only file
- if [ ${FLAG_ONLYPASSWORD} -eq 1 ]; then
- local -r password="$(pass_get "${passname}" "password")"
- printf '%s\n' "${password}" | ${cmd_output}
- else
- output_autotype "${passname}" "${cmd_output}"
- fi
- else
- pass_get "${passname}" "${field}" | ${cmd_output}
- fi
-}
-
-function main() {
- local passname
- local field
-
- load_config_file
-
- parse_arguments "${@}"
-
- exit_if_help_flag_set
-
- verify_flags
-
- passname="$(get_passname_from_menu)"
- [ -n "${passname}" ] || exit
-
- field="$(get_field_from_menu "${passname}")"
-
- output_field "${passname}" "${field}"
-}
-
-if [[ -z "${WOFI_PASS_TESTING:-""}" ]]; then
- main "${@}"
-fi
diff --git a/bin/,url_handler b/bin/,url_handler
deleted file mode 100755
index 510ed39..0000000
--- a/bin/,url_handler
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/env bash
-
-# manage the program in which the url should be displayed in
-# intended use with programs such as urlscan or urlview
-
-urlname="$(basename "$1")"
-
-case "$urlname" in
- *.jpg) urlImage "$1";;
- *.jpeg) urlImage "$1";;
- *.png) urlImage "$1";;
- *.html) "$BROWSER_CLI"-I "UTF-8" -T text/html "$1";;
- *.mp4) mpv "$1";;
- *.mp3) mpv "$1";;
- *.webm) mpv "$1";;
- *) "$BROWSER" "$1"
-esac
diff --git a/bin/,url_image b/bin/,url_image
deleted file mode 100755
index 5589de7..0000000
--- a/bin/,url_image
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-# Pipe images from URLs into sxiv
-
-# get image extension
-EXT="${1##*.}"
-
-# download it into a tmp file
-wget "$1" -O /tmp/img.$EXT
-
-# open in image viewer
-xdg-open /tmp/img.$EXT
diff --git a/bin/,xev_keys b/bin/,xev_keys
deleted file mode 100755
index da00dad..0000000
--- a/bin/,xev_keys
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-xev | awk -F'[ )]+' '/^KeyPress/ { a[NR+2] } NR in a { printf "%-3s %s\n", $5, $8 }'
diff --git a/bin/akko_config b/bin/akko_config
deleted file mode 100755
index a0ac8fb..0000000
--- a/bin/akko_config
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-#kbd="/dev/input/by-id/usb-ROYUAN_AKKO_Multi-modes_Keyboard-B-event-kbd"
-export kbd="/dev/input/"$(grep -B8 -A4 12001 /proc/bus/input/devices | grep AKKO -A4 | grep -oE 'event[0-9]+')""
-file="$HOME/.config/kmonad/akko.kbd"
-kbd_cfg="$(envsubst < "$file")"
-
-kmonad <(echo "$kbd_cfg")
diff --git a/bin/idea_config b/bin/idea_config
deleted file mode 100755
index 6522231..0000000
--- a/bin/idea_config
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-kbd="/dev/input/by-path/platform-i8042-serio-0-event-kbd"
-file="$HOME/.config/kmonad/ideapad.kbd"
-
-if [ -L "$kbd" ]; then
- kmonad "$file"
-else
- echo 'keyboard not connected'
-fi
diff --git a/bin/mem.clj b/bin/mem.clj
deleted file mode 100644
index 7e4a835..0000000
--- a/bin/mem.clj
+++ /dev/null
@@ -1 +0,0 @@
-#!/bin/env bb
diff --git a/bin/power_menu b/bin/power_menu
deleted file mode 100755
index 4e0fa79..0000000
--- a/bin/power_menu
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-
-# small power menu using rofi, i3, systemd and pm-utils
-# (last 3 dependencies are adjustable below)
-# tostiheld, 2016
-
-poweroff_command="loginctl poweroff"
-reboot_command="loginctl reboot"
-logout_command="loginctl terminate-session"
-
-# you can customise the rofi command all you want ...
-menu_command="fuzzel"
-
-options=$'poweroff\nreboot\nlogout'
-
-# ... because the essential options (-dmenu and -p) are added here
-eval \$"$(echo "$options" | $menu_command --dmenu)_command"