;; TODO: get info like: ;; - [ ] is connected to internet ;; - [ ] is connected using wifi or ethernet ;; - [ ] if wifi, the netkwork name ;; - [ ] network usage (speed) (add-to-load-path "..") (use-modules (ice-9 popen) (ice-9 textual-ports) (org helpers) (org format)) (define (run-command command-string) (let* ((port (open-input-pipe command-string)) (str (get-string-all port))) (close-pipe port) (string-trim-both str))) (define active-connections-command (string-join '("nmcli -t" "con" "show" "--active"))) ;; TODO: alist is better, fix org-format (define (make-connection-list conn) (let ((params '("NAME" "UUID" "TYPE" "DEVICE"))) (map (lambda (x y) `(,x ,y)) params conn))) (define (split-on-colone str) (string-split str #\:)) (define (active-connections) (map (lambda (c) (make-connection-list c)) (map split-on-colon (string-split (run-command active-connections-command) #\nl)))) (map org-properties (active-connections))