aboutsummaryrefslogtreecommitdiff
path: root/dm-frecent
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-05-10 22:57:02 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-05-10 22:57:02 +0200
commit3cd9138c9d8fb9be248c75330cca9da47f4d2e8a (patch)
treeb3b677a9c1a474589f45d20953028a987fa73b80 /dm-frecent
parent83f7fe4b8402bab171d110703a1b1115efbc9b28 (diff)
downloadbin-3cd9138c9d8fb9be248c75330cca9da47f4d2e8a.tar.gz
bin-3cd9138c9d8fb9be248c75330cca9da47f4d2e8a.zip
added a whole bunch of scripts
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