summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-05-17 03:02:17 +0300
committerThanos Apollo <[email protected]>2024-05-17 03:02:17 +0300
commit2a97b778e543dea95a7708ad725e6d4f6fd1558b (patch)
tree32f52e5e7a8066db030dbd0548e016318a1e6717
parent405030147e0a93e7efd92d6057845da63f80a0c9 (diff)
[fix] emacs: Fix wallpaper functions
-rw-r--r--.config/emacs/init.el107
1 files changed, 70 insertions, 37 deletions
diff --git a/.config/emacs/init.el b/.config/emacs/init.el
index 493f554..2186262 100644
--- a/.config/emacs/init.el
+++ b/.config/emacs/init.el
@@ -141,9 +141,7 @@
(defun dired-set-wallpaper ()
"Set NAME as wallpaper using feh."
(interactive)
- (let ((command (if is-zeus "swaybg -o DP-2 -i" "feh --bg-scale")))
- (call-process-shell-command
- (format "%s %s" command (dired-get-filename)) nil 0)))
+ (thanos/wallpaper-set (dired-get-filename)))
(defun dired-delete-files-except ()
"Delete all files inside directory except match."
@@ -157,12 +155,12 @@
(string-match except-match file))
(dired-delete-file file t)))))
- (defun dired-delete-file-match ()
+ (defun dired-delete-files-match (&optional directory match)
"Delete all files inside directory except match."
(interactive)
- (let* ((directory (read-directory-name "Select directory: "))
+ (let* ((directory (or directory (read-directory-name "Select directory: ")))
(files (directory-files directory t))
- (match (read-string "Delete files that match: ")))
+ (match (or match (read-string "Delete files that match: "))))
(dolist (file files)
(when (string-match-p match file)
(dired-delete-file file t)))))
@@ -214,8 +212,7 @@
;; Transparency
(add-to-list 'default-frame-alist '(alpha-background . 85))
-;; theming
-;; (global-hl-line-mode)
+;; Theming
(global-visual-line-mode)
(defun thanos/terminal-theming ()
@@ -234,16 +231,13 @@
(tooltip-mode -1)
(menu-bar-mode -1)
-;; (when is-zeus
-;; (guix-emacs-autoload-packages))
-
(use-package org
:ensure t
:config
(setf org-directory "~/org/"
org-agenda-files '("~/org/seminars.org" "~/org/lectures.org")
org-default-notes-file (expand-file-name "notes.org" org-directory)
- org-ellipsis " ▼ "
+ org-ellipsis " "
org-log-done 'time
org-hide-emphasis-markers nil ;;change to t to hide emphasis markers
org-table-convert-region-max-lines 20000
@@ -256,12 +250,45 @@
("l" . "src lisp")
("b" . "src bash")
("q" . "QUOTE")))
+
+ ;; Export
+ (add-to-list 'org-latex-classes
+ '("article"
+ "\\documentclass[11pt,a4paper]{article}
+\\usepackage[utf8]{inputenc}
+\\usepackage[T1]{fontenc}
+\\usepackage{fixltx2e}
+\\usepackage{graphicx}
+\\usepackage{longtable}
+\\usepackage{float}
+\\usepackage{wrapfig}
+\\usepackage{rotating}
+\\usepackage[normalem]{ulem}
+\\usepackage{amsmath}
+\\usepackage{textcomp}
+\\usepackage{marvosym}
+\\usepackage{wasysym}
+\\usepackage{amssymb}
+\\usepackage{hyperref}
+\\usepackage{mathpazo}
+\\usepackage{color}
+\\usepackage{enumerate}
+\\definecolor{bg}{rgb}{0.95,0.95,0.95}
+\\tolerance=1000
+ [NO-DEFAULT-PACKAGES]
+ [PACKAGES]
+ [EXTRA]
+\\linespread{1.1}
+\\hypersetup{pdfborder=0 0 0}"
+ ("\\section{%s}" . "\\section*{%s}")
+ ("\\subsection{%s}" . "\\subsection*{%s}")
+ ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
+ ("\\paragraph{%s}" . "\\paragraph*{%s}")))
:hook ((org-mode . org-auto-tangle-mode)
(org-mode . (lambda () (display-line-numbers-mode -1) (flyspell-mode))))
- :bind (:map org-mode-map
- (("C-c l" . org-store-link)
- ("C-c M-t" . org-todo))))
+ :bind (:map org-mode-map (("C-c l" . org-store-link)
+ ("C-c M-t" . org-todo))))
(defun org-insert-book ()
"Insert org-link from ~/Library for book."
@@ -354,9 +381,6 @@
(use-package org-roam-ui
:defer t)
-;; (use-package jabber
-;; :defer t)
-
(use-package modus-themes
:straight t
:config
@@ -372,8 +396,7 @@
modus-themes-org-blocks 'tinted-background)
;; Palette overrides
(setf modus-themes-common-palette-overrides
- '(;; (fg-line-number-inactive "gray40")
- (fg-line-number-active cyan-intense)
+ '((fg-line-number-active cyan-intense)
;; (bg-main "#1d2021") ;;grubox-hard
;; (bg-main "#191919") ;; 1337
;; (bg-main "#1d1f21") ;; tomorrow night
@@ -452,17 +475,6 @@
:config
(which-key-mode 1))
-(defun elfeed-mpv (&optional use-generic-p)
- "Play video link with mpv."
- (interactive "P")
- (let ((entries (elfeed-search-selected)))
- (cl-loop for entry in entries
- do (elfeed-untag entry 'unread)
- when (elfeed-entry-link entry)
- do (start-process-shell-command "elfeed-video" nil (format "mpv \"%s\"" it)))
- (mapc #'elfeed-search-update-entry entries)
- (unless (use-region-p) (forward-line))))
-
(use-package elfeed
:defer t
:config
@@ -486,16 +498,30 @@
("http://rss-bridge.thanosapollo.org/?action=display&bridge=CssSelectorBridge&home_page=https%3A%2F%2Fmedfac.mu-sofia.com%2Fen%2Fnews%2F&url_selector=div.news-card&url_pattern=%2F*&content_selector=article.richtext-area&content_cleanup=&title_cleanup=&limit=&format=Atom" musofia med)
("http://rss-bridge.thanosapollo.org/?action=display&bridge=CssSelectorBridge&home_page=https%3A%2F%2Fedition.cnn.com%2Fworld%2Feurope&url_selector=a.container__link--type-article&url_pattern=&content_selector=div.article__content&content_cleanup=&&title_cleanup=-+breaking+news%2C+video%2C+headlines+and+opinion&limit=&format=Atom" news cnn europe)
("http://rss-bridge.thanosapollo.org/?action=display&bridge=CssSelectorBridge&home_page=https%3A%2F%2Fedition.cnn.com%2Fworld%2Famericas&url_selector=a.container__link--type-article&url_pattern=&content_selector=div.article__content&content_cleanup=div.data-uri&title_cleanup=-+breaking+news%2C+video%2C+headlines+and+opinion&limit=&format=Atom" news cnn americas)
- ("https://annas-blog.org/rss.xml"
- anna piracy)
("https://rss-bridge.thanosapollo.org/?action=display&bridge=CssSelectorBridge&home_page=https%3A%2F%2Fwww.theguardian.com%2Feurope&url_selector=a.dcr-lv2v9o&url_pattern=&content_selector=div.article-body-commercial-selector&content_cleanup=figure.dcr-173mewl%2C+div.dcr-ut4tvs&title_cleanup=News%2C+sport+and+opinion+from+the+Guardian%27s+Europe+edition+%7C&limit=&format=Atom" news guardian europe)
+ ("https://rss-bridge.thanosapollo.org/?action=display&bridge=CssSelectorBridge&home_page=https%3A%2F%2Fwww.tovima.gr%2Flatest-news%2F&url_selector=a.columns&url_pattern=&content_selector=div.main-content&content_cleanup=div.wrap-facebook%2Cdiv.googlenews&title_cleanup=&limit=&format=Atom" tovima greek news)
+ ("https://rss-bridge.thanosapollo.org/?action=display&bridge=CssSelectorBridge&home_page=https%3A%2F%2Fwww.tovima.gr%2Fcategory%2Fscience%2F&url_selector=a.columns&url_pattern=&content_selector=div.main-content&content_cleanup=div.wrap-facebook%2Cdiv.googlenews&title_cleanup=&limit=&format=Atom" tovima greek science)
+ ("https://annas-blog.org/rss.xml" anna piracy)
("https://planet.emacslife.com/atom.xml" emacs emacslife)
("https://localmonero.co/static/rss/the-monero-standard/feed.xml" monero)
("https://devonzuegel.com/feed" devon)
("https://www.addtoany.com/add_to/feed?linkurl=http%3A%2F%2Fwww.thelancet.com%2Frssfeed%2Flancet_online.xml&type=feed&linkname=The%20Lancet%20Online%20First&linknote=" lancet med)
("http://tools.cdc.gov/podcasts/feed.asp?feedid=183" cdc med)
("http://planet.lisp.org/rss20.xml" lisp planetlisp)
- ("https://guix.gnu.org/feeds/blog.atom" guix)))
+ ("https://guix.gnu.org/feeds/blog.atom" guix)
+ ("https://protesilaos.com/master.xml" prot)))
+
+ (defun elfeed-mpv (&optional use-generic-p)
+ "Play video link with mpv."
+ (interactive "P")
+ (let ((entries (elfeed-search-selected)))
+ (cl-loop for entry in entries
+ do (elfeed-untag entry 'unread)
+ when (elfeed-entry-link entry)
+ do (start-process-shell-command "elfeed-video" nil (format "mpv \"%s\"" it)))
+ (mapc #'elfeed-search-update-entry entries)
+ (unless (use-region-p) (forward-line))))
+
:bind (("C-x f" . elfeed)
:map elfeed-search-mode-map
("v" . 'elfeed-mpv)
@@ -1133,6 +1159,13 @@ Create a temporary frame to execute BODY, which will then be deleted."
("crun checkpatch script" . my-mu4e-action-run-check-patch)
("MCheck if merged" . my-mu4e-action-check-if-merged)))))
+ (define-minor-mode mu4e-mode
+ "Fix for mu4e mode guix (undefined)."
+ :global t
+ :group 'mu4e
+ :lighter nil
+ (message "mu4e mode"))
+
:bind (("C-x m" . 'mu4e))
:hook
;; Sign messages
@@ -1209,20 +1242,20 @@ Create a temporary frame to execute BODY, which will then be deleted."
(call-process-shell-command "kill -15 $(pgrep swaybg | tail -n 1)")
;; Set wallpaper
(call-process-shell-command
- (format "%s %s%s -m stretch" command wallpapers-dir image)
+ (format "%s %s -m stretch" command 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))))
+ (thanos/wallpaper-set (format "%s%s" wallpapers-dir (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)))
+ (thanos/wallpaper-set (format "%s%s" wallpapers-dir wallpaper))))
(defvar-keymap thanos/applications-map
:doc "Thanos commonly used programs"