about summary refs log tree commit diff stats
path: root/nofetch.scm
blob: 88bb3e997414e213a62a5c20e60c52610e6de80e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh
#| -*- scheme -*-
exec csi -s $0 "$@"
NOFETCH
Copyright (C) 2022 C Duckworth <acdw@acdw.net>
Licensed under the Fair license.  See COPYING for details.
|#

(import (chicken format)
	(chicken port)
        (chicken random)
        (chicken string))

(define (clear)
  (display #\escape)
  (display "[2J"))

(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)
      ""
      (format #f "~A:~A~A"
              thing
              (make-string (- 10 (string-length (symbol->string thing))) #\space)
              (case thing
                ('os "FUCK OFF")
                ('host "A COMPUTER")
                ('kernel "IDK")
                ('uptime "WHO CARES")
                ('pkgs "OH MY GOD WHO CARES")
                ('memory (pseudo-random-integer (* 4 (* 1024 (* 1024 1024)))))))))

(define message #<#END
     _______
    / ===== \    #(get 'os)
   | _______ |   #(get 'host)
   | | -   | |   #(get 'kernel)
   | |_____| |   #(get 'uptime)
   \_=_______/   #(get 'pkgs)
   / ::::::: \   #(get 'memory)
  (___________)

  NOBODY CARES ABOUT YOUR STUPID COMPUTER.
END
)

(define short-message "NOBODY CARES ABOUT YOUR STUPID COMPUTER.\n")

(define message-height
  (length (string-split message "\n" #t)))

(define (main)
  (clear)
  (let ((n (- terminal-height message-height 4)))
    (if (> n 0)
        (begin (display message)
               (display (make-string n #\newline)))
        (display short-message))))

(main)