#!/usr/bin/sh # # fuzzel_mount.sh # # Mount devices. Requires fuzzel and udisksctl. LSBLK_PART_TYPE="part" LSBLK_LIST=$(lsblk -Ppo name,type,mountpoint) while read -r line; do while read -r keyval; do eval "$keyval" done <<- EOF $line EOF expr "$NAME" : "/dev/sda." && continue [ "$TYPE" = "$LSBLK_PART_TYPE" ] || continue if [ -n "$MOUNTPOINT" ]; then option_list=$(printf %s%s\\n "$option_list" "udisksctl unmount -b $NAME") else option_list=$(printf %s%s\\n "$option_list" "udisksctl mount -b $NAME") fi done <<- EOF $LSBLK_LIST EOF selection=$(printf %s "$option_list" | fuzzel --dmenu --prompt "$ ") if [ -n "$selection" ]; then # TODO: notification and error reporting exec $selection fi