I showed you my source code, pls respond
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

159 lines
4.7 KiB

4 years ago
4 years ago
  1. ;; Once the mail's synchronized, and has indexed with =mu=, it's time to install the required packages for Emacs.
  2. ;; + Update every 5 minutes
  3. ;; + Scale text for all devices
  4. ;; + Sign outbound mail with GPG key
  5. ;; + Configure mail account(s)
  6. (use-package mu4e
  7. :load-path "/usr/share/emacs/site-lisp/mu4e"
  8. :custom (mu4e-maildir "~/.cache/mail")
  9. (mu4e-update-interval (* 5 60))
  10. (mu4e-get-mail-command "mbsync -a")
  11. (mu4e-compose-format-flowed t)
  12. (mu4e-change-filenames-when-moving t)
  13. (message-send-mail-function 'smtpmail-send-it)
  14. (mml-secure-openpgp-signers '("37AB1CB72B741E478CA026D43025DCBD46F81C0F"))
  15. (mu4e-compose-signature (concat "Chris Hayward\n"
  16. "https://chrishayward.xyz\n"))
  17. :config
  18. (add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime)
  19. (setq mu4e-contexts
  20. (list
  21. ;; Main
  22. ;; chris@chrishayward.xyz
  23. (make-mu4e-context
  24. :name "Main"
  25. :match-func
  26. (lambda (msg)
  27. (when msg
  28. (string-prefix-p "/Main" (mu4e-message-field msg :maildir))))
  29. :vars
  30. '((user-full-name . "Christopher James Hayward")
  31. (user-mail-address . "chris@chrishayward.xyz")
  32. (smtpmail-smtp-server . "mail.chrishayward.xyz")
  33. (smtpmail-smtp-service . 587)
  34. (smtpmail-stream-type . starttls))))))
  35. ;; Use [[https://github.com/iqbalansari/mu4e-alert][mu4e-alert]] to give us desktop notifications about incoming mail.
  36. (use-package mu4e-alert
  37. :after mu4e
  38. :custom (mu4e-alert-set-default-style 'libnotify)
  39. :config (mu4e-alert-enable-notifications)
  40. (mu4e-alert-enable-mode-line-display))
  41. ;; Create a keybinding to open the mail dashboard with =SPC m=.
  42. (dotfiles/leader
  43. "m" '(mu4e :which-key "Mail"))
  44. ;; Browser
  45. ;; Write out the ~$BROWSER~ environment variable.
  46. (setenv "BROWSER" dotfiles/browser)
  47. ;; Methods
  48. ;; Define a method to run an external process, allowing us to launch any application on a new process without interferring with Emacs.
  49. (defun dotfiles/run (command)
  50. "Run an external process."
  51. (interactive (list (read-shell-command "λ ")))
  52. (start-process-shell-command command nil command))
  53. ;; Apply methods to the current call process to avoid issues with hooks.
  54. (defun dotfiles/run-in-background (command)
  55. (let ((command-parts (split-string command "[ ]+")))
  56. (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))
  57. ;; Place keybindings for executing shell commands behind =SPC x=.
  58. ;; + Run shell commands with =x=
  59. ;; + Run async shell commands with =z=
  60. (dotfiles/leader
  61. "x" '(:ignore t :which-key "Run")
  62. "xx" '(dotfiles/run :which-key "Run")
  63. "xz" '(async-shell-command :which-key "Async"))
  64. ;; Displays
  65. ;; When the window manager first launches the ~init-hook~ executes, allowing us to define some custom logic.
  66. ;; + Display time and date
  67. ;; + Display battery info (if available)
  68. ;; In my personal configuration, I do not want the battery or time displayed within Emacs when it's not running as desktop environment because that information is typically already available.
  69. (defun dotfiles/init-hook ()
  70. (exwm-workspace-switch-create 1)
  71. (setq display-time-and-date t)
  72. (display-battery-mode 1)
  73. (display-time-mode 1))
  74. ;; Using =autorandr= with pre configured profiles, switching screens (AKA hot plugging) is also handled through a hook.
  75. (defun dotfiles/update-display ()
  76. "Update the displays by forcing a change through autorandr."
  77. (dotfiles/run-in-background "autorandr --change --force"))
  78. ;; Configuration
  79. ;; Connect our custom hooks and configure the input keys, a custom layer for key capture layers.
  80. ;; + Enable =randr= support
  81. ;; + Pass through to Emacs
  82. ;; + =M-x= to Emacs
  83. ;; + =C-g= to Emacs
  84. ;; + =C-SPC= to Emacs
  85. ;; + Bindings with =S= (Super / Win)
  86. ;; + Reset =S-r=
  87. ;; + Launch =S-&=
  88. ;; + Workspace =S-[1..9]=
  89. (use-package exwm
  90. :custom (exwm-workspace-show-all-buffers t)
  91. (exwm-input-prefix-keys
  92. '(?\M-x
  93. ?\C-c
  94. ?\C-g
  95. ?\C-\ ))
  96. (exwm-input-global-keys
  97. `(([?\s-r] . exwm-reset)
  98. ,@(mapcar (lambda (i)
  99. `(,(kbd (format "s-%d" i)) .
  100. (lambda ()
  101. (interactive)
  102. (exwm-workspace-switch-create ,i))))
  103. (number-sequence 1 9))))
  104. :config (require 'exwm-randr)
  105. (exwm-randr-enable)
  106. (add-hook 'exwm-init-hook #'dotfiles/init-hook)
  107. (add-hook 'exwm-randr-screen-change-hook #'dotfiles/update-display)
  108. (dotfiles/update-display)
  109. (exwm-enable))