aboutsummaryrefslogtreecommitdiff
path: root/dm-frecent
diff options
context:
space:
mode:
Diffstat (limited to 'dm-frecent')
-rwxr-xr-xdm-frecent27
1 files changed, 27 insertions, 0 deletions
diff --git a/dm-frecent b/dm-frecent
new file mode 100755
index 0000000..0b12a92
--- /dev/null
+++ b/dm-frecent
@@ -0,0 +1,27 @@
+#!/usr/bin/env sh
+# Pick a frecent file via fre, open with the right app for its type.
+set -eu
+
+file=$(
+ fre --sorted \
+ | while IFS= read -r f; do [ -f "$f" ] && printf '%s\n' "$f"; done \
+ | dmenu -l 20 -i -p 'frecent:'
+) || exit 0
+[ -n "$file" ] || exit 0
+
+fre --add "$file" # bump score on reopen
+
+case "$file" in
+ *.pdf|*.epub)
+ exec zathura "$file" ;;
+ *.odt|*.ods|*.odp|*.doc|*.docx|*.xls|*.xlsx|*.ppt|*.pptx)
+ exec libreoffice "$file" ;;
+ *.png|*.jpg|*.jpeg|*.gif|*.webp|*.bmp|*.tiff)
+ exec nsxiv "$file" ;;
+ *.mp4|*.mkv|*.webm|*.avi|*.mov|*.mp3|*.flac|*.ogg|*.opus|*.wav|*.m4a)
+ exec mpv "$file" ;;
+ *.html|*.htm)
+ exec firefox "$file" ;;
+ *)
+ exec st -e vim "$file" ;;
+esac