i3wm.el 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. ;;; i3wm.el --- i3wm integration library
  2. ;; Copyright (C) 2016 Samuel Flint
  3. ;; Author: Samuel W. Flint <swflint@flintfam.org>
  4. ;; Version: 0.5
  5. ;; Package-requires: ((cl-lib "0.5") (json))
  6. ;; Keywords: convenience, exteensions
  7. ;; URL: https://git.flintfam.org/swflint/emacs-i3wm
  8. ;;; Commentary:
  9. ;;
  10. ;;; Code:
  11. (require 'json)
  12. (require 'cl-lib)
  13. (defun i3wm-command (command &rest arguments)
  14. "I3wm-command COMMAND &rest ARGUMENTS.
  15. Execute the givenn COMMAND with the given ARGUMENTS."
  16. (json-read-from-string
  17. (shell-command-to-string
  18. (format "i3-msg \"%s\"" (apply #'format command arguments)))))
  19. (defun i3wm-get-workspaces ()
  20. "I3wm-get-workspaces.
  21. List all workspaces."
  22. (json-read-from-string
  23. (shell-command-to-string "i3-msg -t get_workspaces")))
  24. (defun i3wm-get-outputs ()
  25. "I3wm-get-outputs.
  26. List all outputs."
  27. (json-read-from-string
  28. (shell-command-to-string "i3-msg -t get_outputs")))
  29. (defun i3wm-get-version ()
  30. "I3wm-get-version.
  31. Retrieve i3 version."
  32. (json-read-from-string
  33. (shell-command-to-string "i3-msg -t get_version")))
  34. (provide 'i3wm)
  35. ;;; i3wm.el ends here