36 lines
		
	
	
	
		
			887 B
		
	
	
	
		
			Scheme
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
	
		
			887 B
		
	
	
	
		
			Scheme
		
	
	
		
			Executable file
		
	
	
	
	
#!/usr/bin/env -S guile -s
 | 
						|
!#
 | 
						|
(use-modules (ice-9 rdelim)
 | 
						|
             (ice-9 string-fun))
 | 
						|
 | 
						|
(define hypr-sig (getenv "HYPRLAND_INSTANCE_SIGNATURE"))
 | 
						|
(define sock (socket 1 1 0))
 | 
						|
(connect sock AF_UNIX (string-concatenate `("/tmp/hypr/" ,hypr-sig "/.socket.sock")))
 | 
						|
 | 
						|
(define get-zoom-cmd "/getoption misc:cursor_zoom_factor")
 | 
						|
 | 
						|
(define (send msg)
 | 
						|
  (display msg sock))
 | 
						|
 | 
						|
(define (set-zoom amount)
 | 
						|
  (send (string-concatenate `("/keyword misc:cursor_zoom_factor " ,(number->string amount)))))
 | 
						|
 | 
						|
(send get-zoom-cmd)
 | 
						|
 | 
						|
(define zoom
 | 
						|
  (do ((line (read-line sock) (read-line sock)))
 | 
						|
      ((eof-object? line))
 | 
						|
    (when (string-contains line "float")
 | 
						|
      (+ (string->number
 | 
						|
          (string-trim (string-replace-substring line "float: " " ")))
 | 
						|
         0.1))))
 | 
						|
 | 
						|
(display zoom)
 | 
						|
 | 
						|
(do ((line (read-line sock) (read-line sock)))
 | 
						|
    ((eof-object? line))
 | 
						|
  (display line)
 | 
						|
  (newline))
 | 
						|
 | 
						|
(close sock)
 | 
						|
 |