aboutsummaryrefslogtreecommitdiff
path: root/module/vulgar/info.scm
blob: 04c19c24736906844f9fa7f08b96d2ace518c5d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
(define-module (vulgar info)
  :use-module ((srfi srfi-1) :select (car+cdr))
  :use-module (srfi srfi-71)
  :export (get-terminal-size))

;; Sort-of backwards subprocess call since we want the current terminal to be
;; inherited by stty
(define (get-terminal-size)
 (let ((rpipe wpipe (car+cdr (pipe))))
   (system (format #f "stty size > /proc/~s/fd/~s"
                   (getpid) (port->fdes wpipe)))
   (values (read rpipe)
           (read rpipe))))