aboutsummaryrefslogtreecommitdiff
path: root/dmenuOpen.sh
blob: ff0a8395e36dae7a969475c87dffbd4e6e570780 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash

# dmenuOpen.sh
#
# Selects a file in a folder with dmenu and opens it with rifle

set -euo pipefail
IFS=$'\n\t'

folder="$1"
[ -z "$folder" ] && exit 0

lines="$(find "$folder" -type f | wc -l)"
selected="$(find "$folder" -type f | grep -o '[^/]*$' | dmenu -l "$lines" -p "File to open: ")"
o "${folder}/${selected}"