Created
January 13, 2012 16:50
-
-
Save jollm/1607468 to your computer and use it in GitHub Desktop.
commands to operate wicd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defcommand wicd-x () () | |
"disconnect wicd" | |
(run-shell-command "wicd-cli -x")) | |
(defcommand wicd-c () (:rest) | |
"Allow the user to select a network from a list" | |
(let ((network (second (select-from-menu | |
(current-screen) | |
(append '(("wired" "wired")) | |
(mapcar (lambda (v) (list (elt v 1) (elt v 0))) | |
(mapcar (lambda (s) (nth-value 1 (cl-ppcre:scan-to-strings "(\\d){1,2}\\s+\\S\\S(?::\\S\\S){5}\\s+\\d{1,2}\\s+(\\w+)" s))) | |
(rest (split-string (run-shell-command "wicd-cli --wireless -Sl" t)))))))))) | |
(when network | |
(connect-wicd network)))) | |
(defun connect-wicd (network-number) | |
"connect wicd to the specified network" | |
(if (equalp network-number "wired") | |
(run-shell-command "wicd-cli --wired -c") | |
(run-shell-command (concat "wicd-cli --wireless -c -n " network-number)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment