#!/bin/sh # hh-recent-pipemenu - Openbox "Recent Files" pipe menu (GTK-free) # # Loosely modeled on CrunchBang++'s cbpp-recent-files-pipemenu # (github.com/CBPP/cbpp-pipemenus), but that one parses GTK's # ~/.local/share/recently-used.xbel, which nothing on Hammerhead writes # (no GTK). Instead: find(1) over $HOME for recently-modified # docs/images, opened with the matching viewer. # # Usage:
max_entries=12 home="${HOME:-/root}" xml_escape() { printf '%s' "$1" | sed \ -e 's/&/\&/g' \ -e 's/\</g' \ -e 's/>/\>/g' \ -e 's/"/\"/g' } viewer_for() { case "$1" in *.pdf) echo "hh-pdf" ;; *.png|*.jpg|*.jpeg|*.gif|*.bmp) echo "hh-images" ;; *) echo "xnedit" ;; esac } printf '