#!/usr/bin/env bash set -e last_dir_file=/run/user/1000/rofi-fb.last-dir if (( ROFI_RETV == 0 )) then # echo "first call" >&2 rm -f /run/user/1000/rofi-fb.last-dir fi if [[ -e "$last_dir_file" ]] then ld="$(cat "$last_dir_file")" # echo "change to $ld" >&2 [[ -d "$ld" ]] && cd "$ld" fi if [[ -d "$1" ]] then cd "$1" echo "$PWD" > "$last_dir_file" elif [[ -x "$1" ]] then "$1" elif [[ -n "$1" ]] then file="$(realpath "$1")" echo "opening '$file'" >&2 systemd-run --user --scope xdg-open "$file" &>/dev/null exit 0 fi echo ".." ls -A # vim:sw=4:ts=4:et: