소스 검색

Add a couple of interactive workspace switching commands

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

+ 21 - 0
i3wm.el

@@ -123,6 +123,27 @@ Switch to a fullscreen layout."
 Toggle container floating."
   (i3wm-command  "floating toggle"))
 
+;; Interactive commands
+
+(defun i3wm-switch-to-workspace (workspace)
+  "I3wm-switch-to-workspace WORKSPACE.
+
+If called interactively, prompt for and provide completion for
+workspace name and switch to it."
+  (interactive (list (completing-read "Workspace Name: "
+                                      (mapcar (lambda (workspace)
+                                                (cdr (assoc 'name workspace)))
+                                              (i3wm-get-workspaces)))))
+  (i3wm-workspace workspace))
+
+(defun i3wm-switch-to-workspace-number (number)
+  "I3wm-switch-to-workspace-number NUMBER.
+
+If called interactively, prompt for a workspace number and
+switch."
+  (interactive (list (read-number "Workspace Number: ")))
+  (i3wm-workspace-numbered number))
+
 (provide 'i3wm)
 
 ;;; i3wm.el ends here