소스 검색

Added some initial functions

Samuel W. Flint 7 년 전
부모
커밋
31ac069c4c
1개의 변경된 파일27개의 추가작업 그리고 0개의 파일을 삭제
  1. 27 0
      i3wm.el

+ 27 - 0
i3wm.el

@@ -18,7 +18,34 @@
 (require 'json)
 (require 'cl-lib)
 
+(defun i3-command (command &rest arguments)
+  "I3-command COMMAND &rest ARGUMENTS.
 
+Execute the givenn COMMAND with the given ARGUMENTS."
+  (json-read-from-string
+   (shell-command-to-string
+    (format "i3-msg \"%s\"" (apply #'format command arguments)))))
+
+(defun i3-get-workspaces ()
+  "I3-get-workspaces.
+
+List all workspaces."
+  (json-read-from-string
+   (shell-command-to-string "i3-msg -t get_workspaces")))
+
+(defun i3-get-outputs ()
+  "I3-get-outputs.
+
+List all outputs."
+  (json-read-from-string
+   (shell-command-to-string "i3-msg -t get_outputs")))
+
+(defun i3-get-version ()
+  "I3-get-version.
+
+Retrieve i3 version."
+  (json-read-from-string
+   (shell-command-to-string "i3-msg -t get_version")))
 
 (provide 'i3wm)