adding zoomin into scripts
This commit is contained in:
		
							parent
							
								
									8b481e4109
								
							
						
					
					
						commit
						b34c81f801
					
				
					 2 changed files with 33 additions and 0 deletions
				
			
		
							
								
								
									
										32
									
								
								scripts/zoomin
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										32
									
								
								scripts/zoomin
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
#!/usr/bin/env -S sbcl --script
 | 
			
		||||
(require "uiop")
 | 
			
		||||
(defparameter output
 | 
			
		||||
  (with-output-to-string (out)
 | 
			
		||||
    (run-program "hyprctl"
 | 
			
		||||
                 '("getoption" "misc:cursor_zoom_factor")
 | 
			
		||||
                 :search "/run/current-system/sw/bin/"
 | 
			
		||||
                 :output out)
 | 
			
		||||
    out))
 | 
			
		||||
 | 
			
		||||
(defun parse-string-to-float (string)
 | 
			
		||||
  (let ((*read-eval* nil))
 | 
			
		||||
    (with-input-from-string (stream string)
 | 
			
		||||
      (loop for number = (read stream nil nil)
 | 
			
		||||
            while number collect number))))
 | 
			
		||||
 | 
			
		||||
(defparameter zoom
 | 
			
		||||
  (car (parse-string-to-float
 | 
			
		||||
        (subseq output (+ (search "float: " output) 7) (+ (search "float: " output) 13)))))
 | 
			
		||||
 | 
			
		||||
(defparameter increment (+ zoom 0.1))
 | 
			
		||||
(defparameter decrement (- zoom 0.1))
 | 
			
		||||
 | 
			
		||||
(if (member "in" (uiop:command-line-arguments) :test #'string=)
 | 
			
		||||
    (run-program "hyprctl" `("keyword" "misc:cursor_zoom_factor" ,(write-to-string increment))
 | 
			
		||||
                 :search "/run/current-system/sw/bin/"
 | 
			
		||||
                 :output *standard-output*)
 | 
			
		||||
    (if (member "out" (uiop:command-line-arguments) :test #'string=)
 | 
			
		||||
        (run-program "hyprctl" `("keyword" "misc:cursor_zoom_factor" ,(write-to-string decrement))
 | 
			
		||||
                     :search "/run/current-system/sw/bin/"
 | 
			
		||||
                     :output *standard-output*)))
 | 
			
		||||
;; -*-lisp-*-
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue