Add get_qb_content and prefix *marks
This commit is contained in:
		
							parent
							
								
									05ddce993a
								
							
						
					
					
						commit
						56f3abd860
					
				
							
								
								
									
										33
									
								
								qb
								
								
								
								
							
							
						
						
									
										33
									
								
								qb
								
								
								
								
							|  | @ -65,6 +65,10 @@ define_vars() {                                                 # {{{ | |||
| 	QUTEBROWSER_SESSION_FILE="/tmp/qutebrowser_buffers_zsbd" | ||||
| 	QUTEBROWSER_SOCKET_FILE="${XDG_RUNTIME_DIR}/qutebrowser/ipc-$(echo -n "$USER" | md5sum | cut -d' ' -f1)" | ||||
| 	QUTEBROWSER_GLOBAL_CONTENT="/tmp/qutebrowser_global_content" | ||||
| 	rm -f -- "${QUTEBROWSER_GLOBAL_CONTENT}" ; touch "${QUTEBROWSER_GLOBAL_CONTENT}" | ||||
| 
 | ||||
| 	QUTEBROWSER_QUICKMARK_FILE="${HOME}/.config/qutebrowser/quickmarks" | ||||
| 	QUTEBROWSER_BOOKMARK_FILE="${HOME}/.config/qutebrowser/bookmarks/urls" | ||||
| 
 | ||||
| } | ||||
| # }}} | ||||
|  | @ -223,18 +227,23 @@ get_qutebrowser_buffers() {                                     # {{{ | |||
| 
 | ||||
| 	sed "s/^/ff /g" "${QUTEBROWSER_SESSION_FILE}" >> "${QUTEBROWSER_GLOBAL_CONTENT}" | ||||
| 
 | ||||
| } | ||||
| # }}} | ||||
| get_qutebrowser_content() {                                    # {{{ | ||||
| 
 | ||||
| 	[ -S "${QUTEBROWSER_SOCKET_FILE}" ] && get_qutebrowser_buffers | ||||
| 
 | ||||
| 	[ -f "${QUTEBROWSER_QUICKMARK_FILE}" ] && sed "s/^/qq /g" "${QUTEBROWSER_QUICKMARK_FILE}" >> "${QUTEBROWSER_GLOBAL_CONTENT}" | ||||
| 	[ -f "${QUTEBROWSER_BOOKMARK_FILE}" ] && sed "s/^/bb /g" "${QUTEBROWSER_BOOKMARK_FILE}" >> "${QUTEBROWSER_GLOBAL_CONTENT}" | ||||
| 
 | ||||
| } | ||||
| # }}} | ||||
| search_qb_content() {                                          # {{{ | ||||
| 
 | ||||
| 	debug_message "search_qb_content − \ | ||||
| Search in Qutebrowser's content (*marks, buffers,…)." | ||||
| 	get_qutebrowser_content | ||||
| 
 | ||||
| 	## Get current buffers from Qutebrowser | ||||
| 	get_qutebrowser_buffers | ||||
| 	## Add quickmarks and bookmarks to global Qutebrowser content | ||||
| 	cat "${HOME}/.config/qutebrowser/quickmarks" >> "${QUTEBROWSER_GLOBAL_CONTENT}" | ||||
| 	cat "${HOME}/.config/qutebrowser/bookmarks/urls" >> "${QUTEBROWSER_GLOBAL_CONTENT}" | ||||
| 	debug_message "search_qb_content − \ | ||||
| Search in Qutebrowser's content ${QUTEBROWSER_GLOBAL_CONTENT} file." | ||||
| 
 | ||||
| 	st -g 90x30+0+540 -n QuteBrowser -t QuteBrowser -e sh -c "cat ${QUTEBROWSER_GLOBAL_CONTENT} | fzf +m > ${choice_temp_file}" | ||||
| 
 | ||||
|  | @ -263,19 +272,19 @@ get_url() {                                                     # {{{ | |||
| Try to manage ${RED}$(cat "${choice_temp_file}")${COLOR_DEBUG}." | ||||
| 
 | ||||
| 	case "${local_content}" in | ||||
| 		http* )   ## Classic bookmark | ||||
| 			url=$(printf "%s" "${local_content}" | sed -e "s;\(http.*\) .*;\1;") | ||||
| 		bb*http* )   ## Classic bookmark | ||||
| 			url=$(printf "%s" "${local_content}" | sed -e "s;bb \(http.*\) .*;\1;") | ||||
| 			return_get_url="0" | ||||
| 			debug_message "get_url − \ | ||||
| URL from classic bookmark ${RED}${url}${COLOR_DEBUG}." | ||||
| 			;; | ||||
| 		*http* )  ## Quickmark | ||||
| 			url=$(printf "%s" "${local_content}" | sed -e "s;.*\(http.*\);\1;") | ||||
| 		qq*http* )  ## Quickmark | ||||
| 			url=$(printf "%s" "${local_content}" | sed -e "s;qq .*\(http.*\);\1;") | ||||
| 			return_get_url="0" | ||||
| 			debug_message "get_url − \ | ||||
| URL from quickmark ${RED}${url}${COLOR_DEBUG}." | ||||
| 			;; | ||||
| 		ff* )     ## Buffer | ||||
| 		ff*http )  ## Buffer | ||||
| 			url="" | ||||
| 			return_get_url="1" | ||||
| 			debug_message "get_url − \ | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue