about summary refs log tree commit diff stats
path: root/nofetch.scm
blob: 340d9ac3523a7e7e18e6a8f71148df3199d17e8c (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
#!/bin/sh
#| -*- scheme -*-
exec csi -s $0 "$@"
|#

(import (chicken format)
        (chicken random)
        (chicken string)
        posix-utils)

(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 (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)