summaryrefslogtreecommitdiff
path: root/.emacs.d/modules/thanos-aesthetics.el
blob: 3ba8956977f3fde531a01ce895ba4ba8d7759e89 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
;;; thanos-aesthetics.el ---                         -*- lexical-binding: t; -*-

;; Copyright (C) 2023  Thanos Apollo

;; Author: Thanos Apollo <[email protected]>
;; Keywords: 

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:
;; ╭━━━━┳╮╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━━━╮╱╱╱╱╱╭╮╭╮╱╱╱╱╱╱╱╱╭━━━╮
;; ┃╭╮╭╮┃┃╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃╭━╮┃╱╱╱╱╱┃┃┃┃╱╱╱╱╱╱╱╱┃╭━━╯
;; ╰╯┃┃╰┫╰━┳━━┳━╮╭━━┳━━╮┃┃╱┃┣━━┳━━┫┃┃┃╭━━╮╱╱╱╱┃╰━━┳╮╭┳━━┳━━┳━━╮
;; ╱╱┃┃╱┃╭╮┃╭╮┃╭╮┫╭╮┃━━┫┃╰━╯┃╭╮┃╭╮┃┃┃┃┃╭╮┃╭━━╮┃╭━━┫╰╯┃╭╮┃╭━┫━━┫
;; ╱╱┃┃╱┃┃┃┃╭╮┃┃┃┃╰╯┣━━┃┃╭━╮┃╰╯┃╰╯┃╰┫╰┫╰╯┃╰━━╯┃╰━━┫┃┃┃╭╮┃╰━╋━━┃
;; ╱╱╰╯╱╰╯╰┻╯╰┻╯╰┻━━┻━━╯╰╯╱╰┫╭━┻━━┻━┻━┻━━╯╱╱╱╱╰━━━┻┻┻┻╯╰┻━━┻━━╯
;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃┃
;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰╯
;;; Code:

(setf inhibit-startup-message t)
(setf initial-scratch-message nil)

;; Transparency
(add-to-list 'default-frame-alist '(alpha-background . 90))
(add-to-list 'default-frame-alist '(alpha 90 90))

(when (equal is-phone nil)
  (scroll-bar-mode -1)
  (set-fringe-mode 10))

(tool-bar-mode -1)
(tooltip-mode -1)
(menu-bar-mode -1)
(which-key-mode 1)
(blink-cursor-mode -1)
(menu-bar--visual-line-mode-enable)
(global-visual-line-mode 1)

;; Set emojis for emacs 29
(require 'emojify)
(setf global-emojify-mode 1)

(setf visible-bell t)

(column-number-mode)
(global-display-line-numbers-mode 1)
(menu-bar--display-line-numbers-mode-relative)

;;Disable line numbers for some modes
(defvar thanos/no-line-number-modes
  '(pdf-view-mode-hook
    org-mode-hook
    term-mode-hook
    shell-mode-hook
    eshell-mode-hook
    vterm-mode-hook
    elfeed
    vterm-mode
    telega-chat-mode-hook
    telega-root-mode-hook
    nov-mode-hook
    transmission-mode-hook))

(cl-loop for mode in thanos/no-line-number-modes
	 do (add-hook mode (lambda () (display-line-numbers-mode 0))))

;; Set font-size for each device
(custom-set-faces
 (if is-hermes '(default ((t (:inherit nil :height 120 :family "Jetbrains Mono"))))
   '(default ((t (:inherit nil :height 130 :family "Jetbrains Mono"))))))

;; Modus-themes configuration
(setf modus-themes-italic-constructs t
      modus-themes-bold-constructs nil
      modus-themes-mixed-fonts nil
      modus-themes-subtle-line-numbers t
      modus-themes-intense-mouseovers nil
      modus-themes-deuteranopia t
      modus-themes-tabs-accented t
      modus-themes-variable-pitch-ui nil
      modus-themes-inhibit-reload t ; only applies to `customize-set-variable' and related
      modus-themes-fringes nil ; {nil,'subtle,'intense}
      ;; Options for `modus-themes-lang-checkers' are either nil (the
      ;; default), or a list of properties that may include any of those
      ;; symbols: `straight-underline', `text-also', `background',
      ;; `intense' OR `faint'.
      modus-themes-lang-checkers nil
      ;; Options for `modus-themes-mode-line' are either nil, or a list
      ;; that can combine any of `3d' OR `moody', `borderless',
      ;; `accented', a natural number for extra padding (or a cons cell
      ;; of padding and NATNUM), and a floating point for the height of
      ;; the text relative to the base font size (or a cons cell of
      ;; height and FLOAT)
      modus-themes-mode-line '(accented borderless (padding . 2) (height . 1.0))
      ;; Same as above:
      ;; modus-themes-mode-line '(accented borderless 4 0.9)

      ;; Options for `modus-themes-markup' are either nil, or a list
      ;; that can combine any of `bold', `italic', `background',
      ;; `intense'.
      modus-themes-markup '(background bold italic)

      ;; Options for `modus-themes-syntax' are either nil (the default),
      ;; or a list of properties that may include any of those symbols:
      ;; `faint', `yellow-comments', `green-strings', `alt-syntax'
      modus-themes-syntax '(green-strings)

      ;; Options for `modus-themes-hl-line' are either nil (the default),
      ;; or a list of properties that may include any of those symbols:
      ;; `accented', `underline', `intense'
      modus-themes-hl-line '(underline accented)

      ;; Options for `modus-themes-paren-match' are either nil (the
      ;; default), or a list of properties that may include any of those
      ;; symbols: `bold', `intense', `underline'
      modus-themes-paren-match '(bold intense)

      ;; Options for `modus-themes-links' are either nil (the default),
      ;; or a list of properties that may include any of those symbols:
      ;; `neutral-underline' OR `no-underline', `faint' OR `no-color',
      ;; `bold', `italic', `background'
      modus-themes-links '(neutral-underline italic)

      ;; Options for `modus-themes-box-buttons' are either nil (the
      ;; default), or a list that can combine any of `flat', `accented',
      ;; `faint', `variable-pitch', `underline', `all-buttons', the
      ;; symbol of any font weight as listed in `modus-themes-weights',
      ;; and a floating point number (e.g. 0.9) for the height of the
      ;; button's text.
      modus-themes-box-buttons '(variable-pitch flat faint 0.9)

      ;; Options for `modus-themes-prompts' are either nil (the
      ;; default), or a list of properties that may include any of those
      ;; symbols: `background', `bold', `gray', `intense', `italic'
      modus-themes-prompts '(intense)

      ;; The `modus-themes-completions' is an alist that reads three
      ;; keys: `matches', `selection', `popup'.  Each accepts a nil
      ;; value (or empty list) or a list of properties that can include
      ;; any of the following (for WEIGHT read further below):
      ;;
      ;; `matches' - `background', `intense', `underline', `italic', WEIGHT
      ;; `selection' - `accented', `intense', `underline', `italic', `text-also' WEIGHT
      ;; `popup' - same as `selected'
      ;; `t' - applies to any key not explicitly referenced (check docs)
      ;;
      ;; WEIGHT is a symbol such as `semibold', `light', or anything
      ;; covered in `modus-themes-weights'.  Bold is used in the absence
      ;; of an explicit WEIGHT.
      modus-themes-completions '((matches . (bold underline))
				 (selection . (semibold accented))
				 (popup . (accented intense)))

      modus-themes-mail-citations nil ; {nil,'intense,'faint,'monochrome}

      ;; Options for `modus-themes-region' are either nil (the default),
      ;; or a list of properties that may include any of those symbols:
      ;; `no-extend', `bg-only', `accented'
      modus-themes-region '(bg-only no-extend)

      ;; Options for `modus-themes-diffs': nil, 'desaturated, 'bg-only
      modus-themes-diffs 'desaturated

      modus-themes-org-blocks 'gray-background ; {nil,'gray-background,'tinted-background}

      modus-themes-org-agenda ; this is an alist: read the manual or its doc string
      '((header-block . (variable-pitch 1.3))
	(header-date . (grayscale workaholic bold-today 1.1))
	(event . (accented varied))
	(scheduled . uniform)
	(habit . traffic-light))

      modus-themes-headings ; this is an alist: read the manual or its doc string
      '((1 . (overline background variable-pitch 1.3))
	(2 . (rainbow overline 1.1))
	(t . (semibold))))


(load-theme 'doom-molokai)
(doom-modeline-mode 1)
(setf doom-modeline-height 35)


;; Custom function to load theme
(defun thanos/load-theme ()
  "Disable current theme and load a new one."
  (interactive)
  (let ((theme (intern (completing-read "Theme: " (custom-available-themes)))))
    (disable-theme (car custom-enabled-themes))
    (load-theme theme t)))

(define-key thanos/applications-map (kbd "t") 'thanos/load-theme)

;; Don't display battery-mode on desktop
(if is-zeus
    (display-battery-mode 0)
  (display-battery-mode 1))

;; UI -- Vertico, consult, marginalia
(vertico-mode)
(savehist-mode)
(define-key global-map (kbd "C-x b") 'consult-buffer)
(define-key global-map (kbd "C-c m") 'consult-imenu)

(add-hook 'marginalia-mode-hook #'nerd-icons-completion-marginalia-setup)
(marginalia-mode)

;; Helpful
(define-key global-map (kbd "C-h f") #'helpful-callable)
(define-key global-map (kbd "C-h v") #'helpful-variable)
(define-key global-map (kbd "C-h k") #'helpful-key)
(define-key global-map (kbd "C-h x") #'helpful-command)

(define-key global-map (kbd "C-c C-d") #'helpful-at-point)
(define-key global-map (kbd "C-h F") #'helpful-function)

;; ibuffer
(global-set-key (kbd "C-x C-b") 'ibuffer)

(add-hook 'ibuffer-mode-hook 'nerd-icons-ibuffer-mode)

(require 'markdown-mode)
(setq markdown-header-scaling t)
(add-to-list 'auto-mode-alist '("\\.md\\'" . gfm-mode))
(setq markdown-command "multimarkdown")

(electric-pair-mode 1)
(auto-insert-mode 1)
(global-flycheck-mode)
(global-set-key (kbd "M-.") 'xref-find-definitions)
(global-set-key (kbd "C-c L") 'display-line-numbers-mode)

;; wallpapers
(defvar wallpapers-dir "~/wallpapers/")

(defun thanos/wallpaper-set (image)
  "Set IMAGE as wallpaper, using feh."
  (call-process-shell-command
   (concat "xwallpaper --focus " wallpapers-dir image) nil 0))

(defun thanos/wallpaper-random ()
  "Set random wallpaper."
  (interactive)
  (let ((wallpapers (directory-files "~/wallpapers" nil "^[^.].*")))
    (thanos/wallpaper-set (nth (random (length wallpapers)) wallpapers))))

(defun thanos/wallpaper-select ()
  "Set wallpaper."
  (interactive)
  (let ((wallpaper (completing-read "Choose wallpaper: " (directory-files wallpapers-dir nil "^[^.].*"))))
    (thanos/wallpaper-set wallpaper)))

(define-key thanos/applications-map (kbd "w") 'thanos/wallpaper-select)

;; Symbols
(add-hook 'emacs-lisp-mode-hook 'prettify-symbols-mode)

(provide 'thanos-aesthetics)
;;; thanos-aesthetics.el ends here