init.lisp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. ;;; init.lisp --- Vital settings and loading other files
  2. ;; Copyright © 2013-2016 Alex Kost <alezost@gmail.com>
  3. ;; This program is free software; you can redistribute it and/or modify
  4. ;; it under the terms of the GNU General Public License as published by
  5. ;; the Free Software Foundation, either version 3 of the License, or
  6. ;; (at your option) any later version.
  7. ;;
  8. ;; This program is distributed in the hope that it will be useful,
  9. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. ;; GNU General Public License for more details.
  12. ;;
  13. ;; You should have received a copy of the GNU General Public License
  14. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. ;;; Commentary:
  16. ;; This file should be symlinked by "~/.stumpwmrc".
  17. ;; I compile stumpwm with swank, so i don't need to load it.
  18. ;;; Code:
  19. (in-package :stumpwm)
  20. (defvar al/display-number
  21. (multiple-value-bind (_ array)
  22. (cl-ppcre:scan-to-strings ":([0-9]+)" (getenv "DISPLAY"))
  23. (declare (ignore _))
  24. (if (vectorp array)
  25. (parse-integer (aref array 0))
  26. 0))
  27. "The number of the current DISPLAY.")
  28. (swank:create-server
  29. :dont-close t
  30. :port (+ swank::default-server-port al/display-number))
  31. ;;; Loading additional rc files
  32. (defvar al/init-directory
  33. (directory-namestring
  34. (truename (merge-pathnames (user-homedir-pathname)
  35. ".stumpwmrc")))
  36. "A directory with initially loaded files.")
  37. (defun al/load (filename)
  38. "Load a file FILENAME (without extension) from `al/init-directory'."
  39. (let ((file (merge-pathnames (concat filename ".lisp")
  40. al/init-directory)))
  41. (if (probe-file file)
  42. (load file)
  43. (format *error-output* "File '~a' doesn't exist." file))))
  44. (set-module-dir
  45. (pathname-as-directory (concat (getenv "HOME")
  46. "/src/stumpwm-contrib")))
  47. (al/load "keys")
  48. (al/load "utils")
  49. (al/load "layouts")
  50. (al/load "mana")
  51. (al/load "sound")
  52. (al/load "settings")
  53. (al/load "visual")
  54. ;;; init.lisp ends here