diff options
| author | Vito Graffagnino <vito@graffagnino.xyz> | 2020-09-08 18:10:49 +0100 |
|---|---|---|
| committer | Vito Graffagnino <vito@graffagnino.xyz> | 2020-09-08 18:10:49 +0100 |
| commit | 3b0142cedcde39e4c2097ecd916a870a3ced5ec6 (patch) | |
| tree | 2116c49a845dfc0945778f2aa3e2118d72be428b /.config/qutebrowser/misc/userscripts/qutedmenu | |
| parent | 8cc927e930d5b6aafe3e9862a61e81705479a1b4 (diff) | |
Added the relevent parts of the .config directory. Alss add ssh config
Diffstat (limited to '.config/qutebrowser/misc/userscripts/qutedmenu')
| -rwxr-xr-x | .config/qutebrowser/misc/userscripts/qutedmenu | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/.config/qutebrowser/misc/userscripts/qutedmenu b/.config/qutebrowser/misc/userscripts/qutedmenu new file mode 100755 index 0000000..de1b8d6 --- /dev/null +++ b/.config/qutebrowser/misc/userscripts/qutedmenu @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +# Handle open -s && open -t with bemenu + +#:bind o spawn --userscript /path/to/userscripts/qutedmenu open +#:bind O spawn --userscript /path/to/userscripts/qutedmenu tab + +# 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 optsfile=$confdir/dmenu/bemenucolors + +create_menu() { + # Check quickmarks + while read -r url; do + printf -- '%s\n' "$url" + done < "$QUTE_CONFIG_DIR"/quickmarks + + # Next bookmarks + while read -r url _; do + printf -- '%s\n' "$url" + done < "$QUTE_CONFIG_DIR"/bookmarks/urls + + # Finally history + while read -r _ url; do + printf -- '%s\n' "$url" + done < "$QUTE_DATA_DIR"/history + } + +get_selection() { + opts+=(-p qutebrowser) + #create_menu | dmenu -l 10 "${opts[@]}" + create_menu | bemenu -l 10 "${opts[@]}" +} + +# Main +# https://github.com/halfwit/dotfiles/blob/master/.config/dmenu/font +[[ -s $confdir/dmenu/font ]] && read -r font < "$confdir"/dmenu/font + +[[ $font ]] && opts+=(-fn "$font") + +# shellcheck source=/dev/null +[[ -s $optsfile ]] && source "$optsfile" + +url=$(get_selection) +url=${url/*http/http} + +# If no selection is made, exit (escape pressed, e.g.) +[[ ! $url ]] && exit 0 + +case $1 in + open) printf '%s' "open $url" >> "$QUTE_FIFO" || qutebrowser "$url" ;; + tab) printf '%s' "open -t $url" >> "$QUTE_FIFO" || qutebrowser "$url" ;; +esac |
