40 lines
1.0 KiB
Scheme
40 lines
1.0 KiB
Scheme
(define (list-of-processes? thing)
|
|
(and (proper-list? thing)
|
|
(every process-info? thing)))
|
|
|
|
(define (print-processes processes)
|
|
(map (lambda (pi)
|
|
(apply format
|
|
(append
|
|
(list #f
|
|
"~A ~A ~A ~A '~A ~A'~%")
|
|
(map (lambda (s) (s pi))
|
|
(list process-info-pid
|
|
process-info-ppid
|
|
process-info-real-uid
|
|
process-info-%cpu
|
|
process-info-executable
|
|
process-info-command-line)))))
|
|
processes))
|
|
|
|
(define (pps-receiver message)
|
|
(debug-message "pps-receiver " message)
|
|
(cond
|
|
((next-command-message? message)
|
|
(pps))
|
|
((init-with-result-message? message)
|
|
(init-with-result-message-result message))
|
|
((print-message? message)
|
|
(let ((processes (message-result-object message)))
|
|
(make-print-object 1 1 (print-processes processes)
|
|
'() '())))
|
|
((key-pressed-message? message)
|
|
(pps))
|
|
((restore-message? message)
|
|
(values))
|
|
((selection-message? message)
|
|
"'()")))
|
|
|
|
(register-plugin!
|
|
(make-view-plugin pps-receiver list-of-processes?))
|