Nyxt launches mpv with a hinted url now
This commit is contained in:
		
							parent
							
								
									5935064a00
								
							
						
					
					
						commit
						7fdc04e4d4
					
				
					 1 changed files with 8 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -25,15 +25,19 @@
 | 
			
		|||
 | 
			
		||||
;; Create a function to launch mpv with given url
 | 
			
		||||
(defun mpv (url)
 | 
			
		||||
    "MPV launches with given url"
 | 
			
		||||
   (uiop:run-program (list "mpv" url)))
 | 
			
		||||
    "MPV launches with given url using the fast profile."
 | 
			
		||||
  (uiop:run-program (list "mpv" "--profile=fast" url)))
 | 
			
		||||
 | 
			
		||||
;; Let's create a function to hint videos and play them in MPV
 | 
			
		||||
;; Let's create a function to hint videos, convert the url to a sting, and play them in MPV
 | 
			
		||||
(define-command hint-mpv (&key nyxt/web-mode::annotate-visible-only-p)
 | 
			
		||||
    "Show a set of element hints, and copy the URL of the user inputted one."
 | 
			
		||||
  (nyxt/web-mode:query-hints "Copy element URL"
 | 
			
		||||
                             (lambda (nyxt/web-mode::result)
 | 
			
		||||
                               (mpv nyxt/web-mode::result))
 | 
			
		||||
                              ;; this converts the url to a string to be used in mpv
 | 
			
		||||
                               (let* ((url (format nil "~a"
 | 
			
		||||
                                                   (url (first nyxt/web-mode::result)))))
 | 
			
		||||
                             ;; here we take that string and pipe it into mpv
 | 
			
		||||
                                     (mpv url)))
 | 
			
		||||
                             :annotate-visible-only-p
 | 
			
		||||
                             nyxt/web-mode::annotate-visible-only-p))
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue