init.lisp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. ;;; init.lisp --- Vital settings and loading other files
  2. ;; Copyright © 2013–2016, 2018–2019 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. ;;; Code:
  18. (in-package :stumpwm)
  19. (defvar al/display-number
  20. (multiple-value-bind (_ array)
  21. (cl-ppcre:scan-to-strings ":([0-9]+)" (getenv "DISPLAY"))
  22. (declare (ignore _))
  23. (if (vectorp array)
  24. (parse-integer (aref array 0))
  25. 0))
  26. "The number of the current DISPLAY.")
  27. (swank:create-server
  28. :dont-close t
  29. :port (+ swank::default-server-port al/display-number))
  30. ;;; Loading additional rc files
  31. (defvar al/init-directory
  32. (directory-namestring
  33. (truename (merge-pathnames (user-homedir-pathname)
  34. ".stumpwmrc")))
  35. "A directory with initially loaded files.")
  36. (defun al/load (filename)
  37. "Load a file FILENAME (without extension) from `al/init-directory'."
  38. (let ((file (merge-pathnames (concat filename ".lisp")
  39. al/init-directory)))
  40. (if (probe-file file)
  41. (load file)
  42. (format *error-output* "File '~a' doesn't exist." file))))
  43. (redirect-all-output (merge-pathnames "log" al/init-directory))
  44. ;; Currently I don't use "stumpwm-contrib" modules. I use my analogs
  45. ;; instead ("mode-line-*.lisp" files).
  46. ;; (set-module-dir
  47. ;; (pathname-as-directory (concat (getenv "HOME")
  48. ;; "/src/stumpwm-contrib")))
  49. (al/load "keys")
  50. (al/load "utils")
  51. (al/load "xkb")
  52. (al/load "sound")
  53. (al/load "settings")
  54. (al/load "visual")
  55. ;;; init.lisp ends here