From f3ea1783e110b9570c184937bf4b0f89ce9723a2 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 10 Jan 2023 09:19:25 -0600 Subject: Allow output to a non-terminal Also remove dependency on posix-utils. --- nofetch.scm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/nofetch.scm b/nofetch.scm index 01c26c3..88bb3e9 100755 --- a/nofetch.scm +++ b/nofetch.scm @@ -7,17 +7,18 @@ Licensed under the Fair license. See COPYING for details. |# (import (chicken format) + (chicken port) (chicken random) - (chicken string) - posix-utils) + (chicken string)) (define (clear) (display #\escape) (display "[2J")) -(define terminal-size (get-terminal-size)) -(define terminal-width (cadr terminal-size)) -(define terminal-height (car terminal-size)) +(define-values (terminal-height terminal-width) + (if (terminal-port? (current-output-port)) + (terminal-size (current-output-port)) + (values 24 80))) (define (get thing) (if (< terminal-width 48) -- cgit 1.4.1-21-gabe81