aboutsummaryrefslogtreecommitdiff
path: root/public/.local/bin/dmenu-opentable.sh
blob: 229efff4ea23ed04145df355a87981bef6b5207c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash
# xdg-open a file selected through dmenu

notify() {
    mimetype=$(xdg-mime query filetype "$DIR/$FILE")
    defaultprogram=$(xdg-mime query default "$mimetype")
    notify-send "Opening $FILE ($mimetype) with $defaultprogram"
}

DIR="$HOME/docs/spreadsheet"
FILE=$(ls "$DIR" | dmenu -i -l 10 -p "Select spreadsheet:")
[ -z "$FILE" ] && exit 1
notify
xdg-open "$DIR/$FILE"