qutebrowser: Fix open downloads script for spaces

Fixed the 'open downloads' userscript to work correctly for files with
spaces in them.
This commit is contained in:
Marty Oehme 2022-01-17 09:45:44 +01:00
parent 08a46ed691
commit 701c5bbcfc
Signed by: Marty
GPG key ID: B7538B8F50A1C800

View file

@ -16,7 +16,7 @@
# see the recent downloads, just press "sd".
#
# Thorsten Wißmann, 2015 (thorsten` on Libera Chat)
# Refactored to work with bemenu by Marty Oehme, 2021 (@martyo@matrix.org on Matrix)
# Marty Oehme, 2021 (@martyo@matrix.org on Matrix), refactored to work with bemenu
# Any feedback is welcome!
set -e
@ -73,7 +73,7 @@ if ! command -v "${ROFI_CMD}" >/dev/null; then
fi
crop-first-column() {
cut -d' ' -f2
cut -d' ' -f2-
}
ls-files() {
@ -91,9 +91,9 @@ if [ "${#entries[@]}" -eq 0 ]; then
die "Download directory »${DOWNLOAD_DIR}« empty"
fi
line=$(printf '%s\n' "${entries[@]}" |
crop-first-column |
$ROFI_CMD "${ROFI_ARGS[@]}") || true
line=$(printf '%s\n' "${entries[@]}" \
| crop-first-column \
| $ROFI_CMD "${ROFI_ARGS[@]}") || true
if [ -z "$line" ]; then
exit 0
fi