diff --git a/misc/userscripts/dmenu_qutebrowser b/misc/userscripts/dmenu_qutebrowser index fbb70ca51..8e209ebec 100755 --- a/misc/userscripts/dmenu_qutebrowser +++ b/misc/userscripts/dmenu_qutebrowser @@ -39,10 +39,9 @@ [ -z "$QUTE_URL" ] && QUTE_URL='http://google.com' -url=$(echo "$QUTE_URL" | cat - ~/.config/qutebrowser/quickmarks ~/.local/share/qutebrowser/history | dmenu -l 15 -p qutebrowser) -url=$(echo $url | sed -E 's/[^ ]+ +//g' | egrep "https?:" || echo $url) +url=$(echo "$QUTE_URL" | cat - "$QUTE_CONFIG_DIR/quickmarks" "$QUTE_DATA_DIR/history" | dmenu -l 15 -p qutebrowser) +url=$(echo "$url" | sed -E 's/[^ ]+ +//g' | egrep "https?:" || echo "$url") [ -z "${url// }" ] && exit echo "open $url" >> "$QUTE_FIFO" || qutebrowser "$url" - diff --git a/misc/userscripts/open_download b/misc/userscripts/open_download index fa3e98675..a9b92d8bd 100755 --- a/misc/userscripts/open_download +++ b/misc/userscripts/open_download @@ -19,6 +19,7 @@ # Any feedback is welcome! # open a file from the download directory using rofi +DOWNLOAD_DIR=${DOWNLOAD_DIR:-$QUTE_DOWNLOAD_DIR} DOWNLOAD_DIR=${DOWNLOAD_DIR:-$HOME/Downloads} # the name of the rofi command ROFI_CMD=${ROFI_CMD:-rofi} @@ -49,7 +50,7 @@ die() { if ! [ -d "$DOWNLOAD_DIR" ] ; then die "Download directory »$DOWNLOAD_DIR« not found!" fi -if ! $(which "${ROFI_CMD}" > /dev/null ) ; then +if ! which "${ROFI_CMD}" > /dev/null ; then die "Rofi command »${ROFI_CMD}« not found in PATH!" fi @@ -109,5 +110,3 @@ fi msg info "Opening »$file« (of type $filetype) with ${application%.desktop}" xdg-open "$path" & - - diff --git a/misc/userscripts/qutebrowser_viewsource b/misc/userscripts/qutebrowser_viewsource index 0985297d7..e8481eb15 100755 --- a/misc/userscripts/qutebrowser_viewsource +++ b/misc/userscripts/qutebrowser_viewsource @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . -# +# # This script fetches the unprocessed HTML source for a page and opens it in vim. # :bind gf spawn --userscript qutebrowser_viewsource # diff --git a/misc/userscripts/qutedmenu b/misc/userscripts/qutedmenu index 2b47d0fce..3f8b13514 100755 --- a/misc/userscripts/qutedmenu +++ b/misc/userscripts/qutedmenu @@ -7,7 +7,6 @@ # If you would like to set a custom colorscheme/font use these dirs. # https://github.com/halfwit/dotfiles/blob/master/.config/dmenu/bemenucolors readonly confdir=${XDG_CONFIG_HOME:-$HOME/.config} -readonly datadir=${XDG_DATA_HOME:-$HOME/.local/share} readonly optsfile=$confdir/dmenu/bemenucolors @@ -15,17 +14,17 @@ create_menu() { # Check quickmarks while read -r url; do printf -- '%s\n' "$url" - done < "$confdir"/qutebrowser/quickmarks + done < "$QUTE_CONFIG_DIR"/quickmarks # Next bookmarks while read -r url _; do printf -- '%s\n' "$url" - done < "$confdir"/qutebrowser/bookmarks/urls + done < "$QUTE_CONFIG_DIR"/bookmarks/urls # Finally history while read -r _ url; do printf -- '%s\n' "$url" - done < "$datadir"/qutebrowser/history + done < "$QUTE_DATA_DIR"/history } get_selection() { diff --git a/qutebrowser/commands/userscripts.py b/qutebrowser/commands/userscripts.py index b5ce00e76..a8e62cf39 100644 --- a/qutebrowser/commands/userscripts.py +++ b/qutebrowser/commands/userscripts.py @@ -29,6 +29,7 @@ from qutebrowser.utils import message, log, objreg, standarddir from qutebrowser.commands import runners, cmdexc from qutebrowser.config import config from qutebrowser.misc import guiprocess +from qutebrowser.browser.webkit import downloads class _QtFIFOReader(QObject): @@ -379,6 +380,12 @@ def run(cmd, *args, win_id, env, verbose=False): config_dir = standarddir.config() if config_dir is not None: env['QUTE_CONFIG_DIR'] = config_dir + data_dir = standarddir.data() + if data_dir is not None: + env['QUTE_DATA_DIR'] = data_dir + download_dir = downloads.download_dir() + if download_dir is not None: + env['QUTE_DOWNLOAD_DIR'] = download_dir cmd_path = os.path.expanduser(cmd) # if cmd is not given as an absolute path, look it up