From 4db3110293abfb260729be94bf7b8e290adb7494 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 10 May 2024 08:51:38 +0300 Subject: Remove xinitrc it's wayland time babe:) --- .xinitrc | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 .xinitrc diff --git a/.xinitrc b/.xinitrc deleted file mode 100644 index 385cdc1..0000000 --- a/.xinitrc +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -source /etc/profile - -export PATH="/usr/bin:$PATH" -export XDG_SESSION_TYPE="x11" -export SBCL_HOME=/usr/lib64/sbcl - -/usr/bin/qtile start -#/usr/local/bin/stumpwm -- cgit v1.2.3 From 3723b427e0d97deb3d14d74344b6ef0b70fe4d24 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 10 May 2024 08:52:19 +0300 Subject: Readd stumpwm? --- .stumpwm.d/colors.lisp | 21 +------- .stumpwm.d/commands.lisp | 61 +-------------------- .stumpwm.d/init.lisp | 21 +------- .stumpwm.d/keybindings.lisp | 125 +------------------------------------------- .stumpwm.d/modeline.lisp | 46 +--------------- .stumpwm.d/theme.lisp | 65 +---------------------- .stumpwm.d/utils.lisp | 28 +--------- 7 files changed, 7 insertions(+), 360 deletions(-) mode change 100644 => 120000 .stumpwm.d/colors.lisp mode change 100644 => 120000 .stumpwm.d/commands.lisp mode change 100644 => 120000 .stumpwm.d/init.lisp mode change 100644 => 120000 .stumpwm.d/keybindings.lisp mode change 100644 => 120000 .stumpwm.d/modeline.lisp mode change 100644 => 120000 .stumpwm.d/theme.lisp mode change 100644 => 120000 .stumpwm.d/utils.lisp diff --git a/.stumpwm.d/colors.lisp b/.stumpwm.d/colors.lisp deleted file mode 100644 index 9fa1cfd..0000000 --- a/.stumpwm.d/colors.lisp +++ /dev/null @@ -1,20 +0,0 @@ - -(defvar thanos-hope "#1c1d20") -(defvar thanos-hope-alt "#151619") -(defvar thanos-hope0 "#1B2229") -(defvar thanos-hope1 "#1c1f24") -(defvar thanos-hope2 "#202328") -(defvar thanos-hope3 "#23272e") -(defvar thanos-hope4 "#3f444a") -(defvar thanos-hope5 "#5B6268") -(defvar thanos-hope6 "#686b78") -(defvar thanos-hope7 "#9ca0a4") -(defvar thanos-hope8 "#DFDFDF") -(defvar thanos-hope-fg "#cbccd1") -(defvar thanos-hope-alt "#5B6268") - - -(defvar thanos-black-bg "#000000") -(defvar thanos-black-dim "#1e1e1e") -(defvar thanos-black-active "#535353") -(defvar thanos-black-inactive "#303030") diff --git a/.stumpwm.d/colors.lisp b/.stumpwm.d/colors.lisp new file mode 120000 index 0000000..dbd2dbc --- /dev/null +++ b/.stumpwm.d/colors.lisp @@ -0,0 +1 @@ +/gnu/store/3wp5npi1xy1cmyzx8j3cg24kssq4n8vb-home-dotfiles--stumpwm-d-colors-lisp \ No newline at end of file diff --git a/.stumpwm.d/commands.lisp b/.stumpwm.d/commands.lisp deleted file mode 100644 index 1ad62a5..0000000 --- a/.stumpwm.d/commands.lisp +++ /dev/null @@ -1,60 +0,0 @@ - -(defmacro defnyxt-search (name search-url command) - `(stumpwm:defcommand ,(intern (concatenate 'string "nyxt-" name)) (query) - ((:string "Search: ")) - (stumpwm:run-shell-command - (concatenate 'string "nyxt -r -e '(" ,command "\"" ,search-url query "\"" ")'")))) - -(defvar duckduckgo "https://duckduckgo.com/?q=") -(defvar github "https://github.com/search?q=") - -(defnyxt-search "duck" duckduckgo "buffer-load") -(defnyxt-search "duck-newb" duckduckgo "set-url-new-buffer :url") -(defnyxt-search "http" "http://" "buffer-load") -(defnyxt-search "gh" github "buffer-load") - -;; Sly setup -(ql:quickload :slynk) - -(defcommand sly-start-server () () - "Start a slynk server for sly." - (sb-thread:make-thread (lambda () (slynk:create-server :dont-close t)))) - -(defcommand sly-stop-server () () - "Stop current slynk server for sly." - (sb-thread:make-thread (lambda () (slynk:stop-server 4005)))) - - -(defcommand firefox () () - "Run or raise Firefox." - (sb-thread:make-thread (lambda () (run-or-raise "firefox" '(:class "firefox") t nil)))) - -(defcommand delete-window-and-frame () () - "Delete the current frame with its window." - (delete-window) - (remove-split)) - -(defcommand hsplit-and-focus () () - "Create a new frame on the right and focus it." - (hsplit) - (move-focus :right)) - -(defcommand vsplit-and-focus () () - "Create a new frame below and move focus to it." - (vsplit) - (move-focus :down)) - -(defcommand term (&optional program) () - "Invoke a terminal, possibly with a @arg{program}." - (sb-thread:make-thread - (lambda () - (run-shell-command (if program - (format nil "kitty ~A" program) - "kitty"))))) - -(when *initializing* - (mapc #'run-shell-command - '("picom" - "transmission-daemon" - "xsetroot -cursor_name left_ptr")) - (thanos/set-wallpapers)) diff --git a/.stumpwm.d/commands.lisp b/.stumpwm.d/commands.lisp new file mode 120000 index 0000000..dc1a495 --- /dev/null +++ b/.stumpwm.d/commands.lisp @@ -0,0 +1 @@ +/gnu/store/0mzi180himhrnjgc33n49slvs5vwb7rb-home-dotfiles--stumpwm-d-commands-lisp \ No newline at end of file diff --git a/.stumpwm.d/init.lisp b/.stumpwm.d/init.lisp deleted file mode 100644 index ccbaf58..0000000 --- a/.stumpwm.d/init.lisp +++ /dev/null @@ -1,20 +0,0 @@ -(in-package :stumpwm) -(setf *default-package* :stumpwm) - -(when *initializing* - (grename "[ALPHA]") - (gnewbg "[BETA]") - (gnewbg-dynamic "[GAMMA]")) - -(clear-window-placement-rules) - -;; Utils -(load "~/.stumpwm.d/utils.lisp") -;; Theme -(load "~/.stumpwm.d/theme.lisp") -;; Commmands -(load "~/.stumpwm.d/commands.lisp") -;; Modeline -(load "~/.stumpwm.d/modeline.lisp") -;; Keybindings -(load "~/.stumpwm.d/keybindings.lisp") diff --git a/.stumpwm.d/init.lisp b/.stumpwm.d/init.lisp new file mode 120000 index 0000000..c98020a --- /dev/null +++ b/.stumpwm.d/init.lisp @@ -0,0 +1 @@ +/gnu/store/lj5nq45z9a616607c956cdf73jq0nvq0-home-dotfiles--stumpwm-d-init-lisp \ No newline at end of file diff --git a/.stumpwm.d/keybindings.lisp b/.stumpwm.d/keybindings.lisp deleted file mode 100644 index 68e1655..0000000 --- a/.stumpwm.d/keybindings.lisp +++ /dev/null @@ -1,124 +0,0 @@ -(in-package :stumpwm) - -(defcommand colon1 (&optional (initial "")) (:rest) - (let ((cmd (read-one-line (current-screen) ": " :initial-input initial))) - (when cmd - (eval-command cmd t)))) - -;; Flaoting window control -(setf *mouse-focus-policy* :click - *float-window-modifier* :SUPER) - -;; Float -(define-key *top-map* (kbd "s-f") "float-this") -(define-key *top-map* (kbd "s-F") "unfloat-this") - -(define-key *root-map* (kbd "C-r") "exec rofi -show drun -modi drun -show-icons") -(define-key *root-map* (kbd ",") "exec flameshot gui") -(define-key *root-map* (kbd "M-r") "restart-hard") -(define-key *root-map* (kbd "p") "exec emacsclient -e '(thanos/pass-launcher)'") -(define-key *root-map* (kbd "b") "windowlist") -(define-key *root-map* (kbd "d") "delete-window") -(define-key *root-map* (kbd "C-d") "remove") -;; Focus -(define-key *root-map* (kbd "C-f") "move-focus right") -(define-key *root-map* (kbd "C-b") "move-focus left") - -(defvar *thanos-buffers-map* - (let ((m (make-sparse-keymap))) - (define-key m (kbd "0") "delete-window-and-frame") - (define-key m (kbd "3") "hsplit-and-focus") - (define-key m (kbd "b") "windowlist") - m)) - -(define-key *root-map* (kbd "C-x") *thanos-buffers-map*) -(define-key *root-map* (kbd "s") "hsplit-and-focus") -(define-key *root-map* (kbd "w") "windowlist") -(define-key *root-map* (kbd "k") "delete-window-and-frame") -(define-key *root-map* (kbd "S") "vsplit") -(define-key *root-map* (kbd "b") "global-windowlist") - -(define-key *root-map* (kbd "e") "exec emacsclient -c") - -(define-key *root-map* (kbd "C-e") "exec emacs") - -;; Lock screen -(define-key *root-map* (kbd "C-l") "exec slock") - -(define-key *top-map* (kbd "F11") "fullscreen") -;; Audio -(define-key *top-map* (kbd "XF86AudioLowerVolume") "execa mixer sset Master 5%-") -(define-key *top-map* (kbd "XF86AudioRaiseVolume") "exec amixer sset Master 5%+") - -;; x220 specific -(define-key *top-map* (kbd "F1") "exec brightnessctl --device='intel_backlight' set 5%-") -(define-key *top-map* (kbd "F2") "exec brightnessctl --device='intel_backlight' set +5%") -(define-key *top-map* (kbd "F3") "exec ~/.scripts/keyboard-light-x220.sh") - -;; Next -(define-key *top-map* (kbd "s-n") "fnext") - -;;Groups - -;; Switch to group -;; Root map -(define-key *root-map* (kbd "1") "gselect 1") -(define-key *root-map* (kbd "2") "gselect 2") -(define-key *root-map* (kbd "3") "gselect 3") -(define-key *root-map* (kbd "4") "gselect 4") -(define-key *root-map* (kbd "5") "gselect 5") -(define-key *root-map* (kbd "0") "gselect") -;; Move winodw -(define-key *root-map* (kbd "M-1") "gmove 1") -(define-key *root-map* (kbd "M-2") "gmove 2") -(define-key *root-map* (kbd "M-3") "gmove 3") -(define-key *root-map* (kbd "M-4") "gmove 4") -(define-key *root-map* (kbd "M-5") "gmove 5") -(define-key *root-map* (kbd "M-0") "gmove") -;; Top map, using super -(define-key *top-map* (kbd "s-1") "gselect 1") -(define-key *top-map* (kbd "s-2") "gselect 2") -(define-key *top-map* (kbd "s-3") "gselect 3") -(define-key *top-map* (kbd "s-4") "gselect 4") -(define-key *top-map* (kbd "s-5") "gselect 5") -(define-key *top-map* (kbd "s-6") "gselect 6") -(define-key *top-map* (kbd "s-7") "gselect 7") -(define-key *top-map* (kbd "s-0") "gselect 5") -(define-key *top-map* (kbd "s-9") "gselect") -;; Move window to group -(define-key *top-map* (kbd "s-!") "gmove 1") -(define-key *top-map* (kbd "s-@") "gmove 2") -(define-key *top-map* (kbd "s-#") "gmove 3") -(define-key *top-map* (kbd "s-$") "gmove 4") -(define-key *top-map* (kbd "s-%") "gmove 5") -(define-key *top-map* (kbd "s-^") "gmove 6") -(define-key *top-map* (kbd "s-)") "gmove 5") -(define-key *top-map* (kbd "s-(") "gmove") - -(define-key *root-map* (kbd "C-w") "gselect") - -;; Focus -(define-key *root-map* (kbd "M-b") "move-window left") -(define-key *root-map* (kbd "M-f") "move-window right") -(define-key *root-map* (kbd "M-n") "move-window down") - -;; Split & Focus -(define-key *root-map* (kbd "s") "hsplit-and-focus") - -;; Groups -(define-key *groups-map* (kbd "g") "gselect") - -;; Nyxt -;; (defvar *nyxt-map* (make-sparse-keymap)) -;; (define-key *root-map* (kbd "s") *nyxt-map*) - -;; (define-key *nyxt-map* (kbd "M-d") "nyxt-duck-newb") -;; (define-key *nyxt-map* (kbd "h") "nyxt-http") -;; (define-key *nyxt-map* (kbd "d") "nyxt-duck") -;; (define-key *nyxt-map* (kbd "g") "nyxt-gh") - - - -;; Productivity -(load-module "productivity") -(define-key *top-map* (kbd "F7") "productivity-mode-toggle") diff --git a/.stumpwm.d/keybindings.lisp b/.stumpwm.d/keybindings.lisp new file mode 120000 index 0000000..26cf1e9 --- /dev/null +++ b/.stumpwm.d/keybindings.lisp @@ -0,0 +1 @@ +/gnu/store/3fkzgz8klcybdjqc30k267aw2lyyn8kz-home-dotfiles--stumpwm-d-keybindings-lisp \ No newline at end of file diff --git a/.stumpwm.d/modeline.lisp b/.stumpwm.d/modeline.lisp deleted file mode 100644 index 308186f..0000000 --- a/.stumpwm.d/modeline.lisp +++ /dev/null @@ -1,45 +0,0 @@ -;; Modeline configuration -(load "~/.stumpwm.d/colors.lisp") - -(setf *default-package* :stumpwm) - -(load-module "battery-portable") -;; (stumpwm:load-module "stumptray") -(load-module "mem") -(load-module "cpu") - -(setf *mode-line-timeout* 2) -(setf *group-format* "%t") -(setf *window-format* "%n: %30t") - -;; set modeline colors and highlight -(setf *mode-line-background-color* thanos-black-bg ;"#252B48" - *mode-line-foreground-color* thanos-hope-fg - *mode-line-border-color* thanos-black-bg - *mode-line-highlight-template* "«~A»" - mem::*mem-modeline-fmt* "%p" - cpu:*cpu-modeline-fmt* "%c") - -(setf *mode-line-border-color* thanos-black-bg - *mode-line-border-width* 2) - -(setf *time-modeline-string* "%a %d/%m/%Y | %H:%M") - -(setf stumpwm:*screen-mode-line-format* - (list "%g ^> %C " - '(:eval (string-trim '(#\Newline) - (stumpwm:run-shell-command - "echo $(($(cat /sys/class/thermal/thermal_zone0/temp) / 1000))C" t))) - "| RAM:%M| VOL:" - '(:eval (string-trim '(#\Newline) - (stumpwm:run-shell-command - "amixer get Master | awk '/Front Left:/ { print substr($5, 2, length($5)-2) }'" t))) - " | " - ;; Check when hermes(laptop) t display battery - (when (equal (asdf:hostname) "hermes") - "BAT:%B |") - "%d")) - - -(when stumpwm:*initializing* - (mode-line)) diff --git a/.stumpwm.d/modeline.lisp b/.stumpwm.d/modeline.lisp new file mode 120000 index 0000000..be38179 --- /dev/null +++ b/.stumpwm.d/modeline.lisp @@ -0,0 +1 @@ +/gnu/store/4garpamz8m6h8dnfy7m4p59zp0s5lyys-home-dotfiles--stumpwm-d-modeline-lisp \ No newline at end of file diff --git a/.stumpwm.d/theme.lisp b/.stumpwm.d/theme.lisp deleted file mode 100644 index 55691db..0000000 --- a/.stumpwm.d/theme.lisp +++ /dev/null @@ -1,64 +0,0 @@ -;; Startup message - -(setf *startup-message* "Welcome back, Thanos") -(stumpwm:load-module "swm-gaps") -;; Colors -(stumpwm:load-module "ttf-fonts") -(load "~/.stumpwm.d/colors.lisp") - -(run-shell-command "~/.config/autostart/autostart.sh ") - -;; Wallpaper -(defun feh-set-wallpaper (wallpaper-name) - "Set wallpaper using feh" - (let ((wallpaper-dir "~/wallpapers/")) - (format t "Setting wallpaper: ~a~%" wallpaper-name) - (run-shell-command (format nil "feh --bg-scale ~a~a" wallpaper-dir wallpaper-name)))) - -(defun thanos/set-wallpapers () - "Set wallpapers depending on hostname." - (cond ((equal (asdf:hostname) "zeus") (feh-set-wallpaper "winter-dragons.jpg")) - ((equal (asdf:hostname) "hermes") (feh-set-wallpaper "cyberpunk-wallpaper2.jpg")))) - - -;; (when *initializing* -;; (thanos/set-wallpapers)) - -(setf *message-window-gravity* :center - *input-window-gravity* :center - *window-border-style* :thin - *mouse-focus-policy* :click - *float-window-modifier* :META - *transient-border-width* 2 - *normal-size-border-width* 2 - *message-window-padding* 10 - *message-window-y-padding* 10) - -(when *initializing* - (update-color-map (current-screen))) - - -(set-border-color thanos-black-bg) -(set-focus-color thanos-black-active) -(set-unfocus-color thanos-black-inactive) -(set-float-focus-color thanos-hope1) -(set-float-unfocus-color thanos-hope3) - -(set-fg-color thanos-hope-fg) -(set-bg-color thanos-black-bg) - -(setf swm-gaps:*head-gaps-size* 6 - swm-gaps:*inner-gaps-size* 6 - swm-gaps:*outer-gaps-size* 6) - -(when stumpwm:*initializing* - (swm-gaps:toggle-gaps-on)) - -;; (ql:quickload :clx-truetype) - -(stumpwm:set-font - `(,(make-instance 'xft:font - :family "JetBrains Mono" - :subfamily "Regular" - :size 12 - :antialias t))) diff --git a/.stumpwm.d/theme.lisp b/.stumpwm.d/theme.lisp new file mode 120000 index 0000000..7d51a75 --- /dev/null +++ b/.stumpwm.d/theme.lisp @@ -0,0 +1 @@ +/gnu/store/82s7lvf8s6hpmqvxamqxf2yp2wi7xy18-home-dotfiles--stumpwm-d-theme-lisp \ No newline at end of file diff --git a/.stumpwm.d/utils.lisp b/.stumpwm.d/utils.lisp deleted file mode 100644 index de820e3..0000000 --- a/.stumpwm.d/utils.lisp +++ /dev/null @@ -1,27 +0,0 @@ -(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" - (user-homedir-pathname)))) - (when (probe-file quicklisp-init) - (load quicklisp-init))) - -(in-package :stumpwm) - -(asdf:load-system :cffi) - -(setf *default-package* :stumpwm) -(set-module-dir "~/.stumpwm.d/modules") - -(stumpwm:load-module "notifications") -(stumpwm:load-module "productivity") -(stumpwm:load-module "kbd-layouts") -(stumpwm:load-module "mpd") -(stumpwm:load-module "pinentry") -(stumpwm:load-module "pass") -(stumpwm:load-module "swm-emacs") -(stumpwm:load-module "end-session") -(stumpwm:load-module "globalwindows") -(stumpwm:load-module "urgentwindows") - -(mpd:mpd-connect) - -(setf kbd-layouts:*caps-lock-behavior* :swapped) -(kbd-layouts:keyboard-layout-list "us" "gr" "bg -variant phonetic") diff --git a/.stumpwm.d/utils.lisp b/.stumpwm.d/utils.lisp new file mode 120000 index 0000000..616b237 --- /dev/null +++ b/.stumpwm.d/utils.lisp @@ -0,0 +1 @@ +/gnu/store/svvyhs2qfbdh620dagm5c30bflk7jn35-home-dotfiles--stumpwm-d-utils-lisp \ No newline at end of file -- cgit v1.2.3 From 0582004885cd35bfacbff5d4fdfdce8b834c32ce Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 10 May 2024 09:05:49 +0300 Subject: Remove stumpwm --- .stumpwm.d/colors.lisp | 1 - .stumpwm.d/commands.lisp | 1 - .stumpwm.d/init.lisp | 1 - .stumpwm.d/keybindings.lisp | 1 - .stumpwm.d/modeline.lisp | 1 - .stumpwm.d/modules | 1 - .stumpwm.d/theme.lisp | 1 - .stumpwm.d/utils.lisp | 1 - 8 files changed, 8 deletions(-) delete mode 120000 .stumpwm.d/colors.lisp delete mode 120000 .stumpwm.d/commands.lisp delete mode 120000 .stumpwm.d/init.lisp delete mode 120000 .stumpwm.d/keybindings.lisp delete mode 120000 .stumpwm.d/modeline.lisp delete mode 160000 .stumpwm.d/modules delete mode 120000 .stumpwm.d/theme.lisp delete mode 120000 .stumpwm.d/utils.lisp diff --git a/.stumpwm.d/colors.lisp b/.stumpwm.d/colors.lisp deleted file mode 120000 index dbd2dbc..0000000 --- a/.stumpwm.d/colors.lisp +++ /dev/null @@ -1 +0,0 @@ -/gnu/store/3wp5npi1xy1cmyzx8j3cg24kssq4n8vb-home-dotfiles--stumpwm-d-colors-lisp \ No newline at end of file diff --git a/.stumpwm.d/commands.lisp b/.stumpwm.d/commands.lisp deleted file mode 120000 index dc1a495..0000000 --- a/.stumpwm.d/commands.lisp +++ /dev/null @@ -1 +0,0 @@ -/gnu/store/0mzi180himhrnjgc33n49slvs5vwb7rb-home-dotfiles--stumpwm-d-commands-lisp \ No newline at end of file diff --git a/.stumpwm.d/init.lisp b/.stumpwm.d/init.lisp deleted file mode 120000 index c98020a..0000000 --- a/.stumpwm.d/init.lisp +++ /dev/null @@ -1 +0,0 @@ -/gnu/store/lj5nq45z9a616607c956cdf73jq0nvq0-home-dotfiles--stumpwm-d-init-lisp \ No newline at end of file diff --git a/.stumpwm.d/keybindings.lisp b/.stumpwm.d/keybindings.lisp deleted file mode 120000 index 26cf1e9..0000000 --- a/.stumpwm.d/keybindings.lisp +++ /dev/null @@ -1 +0,0 @@ -/gnu/store/3fkzgz8klcybdjqc30k267aw2lyyn8kz-home-dotfiles--stumpwm-d-keybindings-lisp \ No newline at end of file diff --git a/.stumpwm.d/modeline.lisp b/.stumpwm.d/modeline.lisp deleted file mode 120000 index be38179..0000000 --- a/.stumpwm.d/modeline.lisp +++ /dev/null @@ -1 +0,0 @@ -/gnu/store/4garpamz8m6h8dnfy7m4p59zp0s5lyys-home-dotfiles--stumpwm-d-modeline-lisp \ No newline at end of file diff --git a/.stumpwm.d/modules b/.stumpwm.d/modules deleted file mode 160000 index 472bdef..0000000 --- a/.stumpwm.d/modules +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 472bdef0acaac8893c9c5a38d4319da86f10c876 diff --git a/.stumpwm.d/theme.lisp b/.stumpwm.d/theme.lisp deleted file mode 120000 index 7d51a75..0000000 --- a/.stumpwm.d/theme.lisp +++ /dev/null @@ -1 +0,0 @@ -/gnu/store/82s7lvf8s6hpmqvxamqxf2yp2wi7xy18-home-dotfiles--stumpwm-d-theme-lisp \ No newline at end of file diff --git a/.stumpwm.d/utils.lisp b/.stumpwm.d/utils.lisp deleted file mode 120000 index 616b237..0000000 --- a/.stumpwm.d/utils.lisp +++ /dev/null @@ -1 +0,0 @@ -/gnu/store/svvyhs2qfbdh620dagm5c30bflk7jn35-home-dotfiles--stumpwm-d-utils-lisp \ No newline at end of file -- cgit v1.2.3 From d946fa919bd57f06fba132fcf3794b66a3cb7005 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 10 May 2024 09:05:59 +0300 Subject: Remove moc --- .moc/config | 704 ------------------------------------------------------- .moc/keymap.conf | 187 --------------- .moc/themes | 1 - 3 files changed, 892 deletions(-) delete mode 100644 .moc/config delete mode 100644 .moc/keymap.conf delete mode 160000 .moc/themes diff --git a/.moc/config b/.moc/config deleted file mode 100644 index 497eafe..0000000 --- a/.moc/config +++ /dev/null @@ -1,704 +0,0 @@ -# This is a configuration file for the MOC player. It should be named -# 'config' and placed in the ~/.moc directory. As this file can specify -# commands which invoke other applications, MOC will refuse to start if it -# is not owned by either root or the current user, or if it is writable by -# anyone other than its owner. All options are given with their default -# values, and therefore commented. - -# Comments begin with '#'. -# You can use quotes and escape ('\') in parameters. -# -# You can have variable values substituted by enclosing the variable name -# as "${...}". (This only applies to the portion of the option following -# the '='.) Variables are substituted first from the environment then, -# if not found, from the configuration options. (Note that the value of -# a configuration option substituted is that which it has at the time the -# substitution variable is encountered.) If there is a naming conflict -# between an environment and configuration variable, you may be able to -# resolve it by using lowercase as the environment variable matches are -# case-sensitive whereas the configuration variables are not. -# -# You can also use the form "${...:-...}" where the value in the second -# position will be substituted if the variable name given in the first -# position is unset or null. -# -# So, for example: -# -# MusicDir = /music/${USER:-public} -# Fastdir1 = ${MusicDir}/mp3/rock -# Fastdir2 = ${MusicDir}/mp3/electronic -# Fastdir3 = ${MusicDir}/mp3/rap -# Fastdir4 = ${MusicDir}/mp3/etc -# -# Variable names are limited to those accepted by the BASH shell; that -# is, those comprising the upper- and lowercase ASCII characters, digits -# and the underscore. -# -# If you need to use the "${" sequence for any other purpose, write "$${" -# and it will be replaced by "${" and not treated as a substitution. -# -# Some options take lists of strings as their values. The strings are -# separated by colons. Additional strings can be appended to the list -# using "+=" in place of a plain "=" to assign the value. For an example, -# see the XTerms option. -# -# You can override any configuration option when you run MOC using the -# '-O' command line option: -# -# mocp -O AutoNext=no -O messagelingertime=1 -O XTerms+=xxt:xwt -# -# This command line option can be repeated as many times as needed and -# the configuration option name is not case sensitive. (Note that MOC -# does not perform variable substitution on the value of such overridden -# configuration options.) Most option values are set before the -# configuration file is processed (which allows the new values to be -# picked up by substitutions), however list-valued options are overridden -# afterwards (which gives the choice of whether the configured values are -# replaced or added to). - -# Remember that the client and server are separate processes and the -# server will retain the configuration values formed from the environment -# within which it was originally started. - -# Show file titles (title, author, album) instead of file names? -#ReadTags = yes - -# In which directory do you store your music files? If you specify it -# you will be able to jump straight to this directory with the '-m' -# parameter or the 'm' command. This can also point to a playlist. -# -# Example: MusicDir = "/home/joe/music" -# -MusicDir = "/hdd/Music" - -# Start in the music directory by default? If set to 'no', start -# in the current directory by default. A single directory on -# the command line takes precedence. -StartInMusicDir = yes - -# The number of lines which are retained in an in-memory circular logging -# buffer. A value of zero indicates that lines will be written directly -# to the log file, otherwise the latest CircularLogSize lines are retained -# in memory and not written to the log file until the MOC client or server -# are shutdown. If the client or server terminates abnormally then the -# log lines are lost. -# -# This option is intended to help identify problems which occur infrequently -# and for which the amount of disk space consumed by logging would otherwise -# be a limiting factor. Obviously the memory footprint will increase in -# proportion to the value of this option. -#CircularLogSize = 0 - -# How to sort? FileName is the option's only value for now. -#Sort = FileName - -# Show errors in the streams (for example, broken frames in MP3 files)? -#ShowStreamErrors = no - -# Ignore CRC errors in MP3 files? Most players do that, so the default -# value is 'yes'. -#MP3IgnoreCRCErrors = yes - -# Set playback toggles. -#Repeat = no -#Shuffle = no -#AutoNext = yes - -# Default FormatString: -# -# %n - Track number -# %a - Artist -# %A - Album -# %t - Title -# %(X:TRUE:FALSE) - Ternary expression: if X exists, do TRUE, -# otherwise FALSE. The escape character must -# be doubled (i.e., '\\'). (See zshmisc -# documentation for more information.) -# -#FormatString = "%(n:%n :)%(a:%a - :)%(t:%t:)%(A: \(%A\):)" - -# Input and output buffer sizes (in kilobytes). -#InputBuffer = 512 # Minimum value is 32KB -#OutputBuffer = 512 # Minimum value is 128KB - -# How much to fill the input buffer before playing (in kilobytes)? -# This can't be greater than the value of InputBuffer. While this has -# a positive effect for network streams, it also causes the broadcast -# audio to be delayed. -#Prebuffering = 64 - -# Use this HTTP proxy server for internet streams. If not set, the -# environment variables http_proxy and ALL_PROXY will be used if present. -# -# Format: HTTPProxy = PROXY_NAME:PORT -# -#HTTPProxy = - -# Sound driver - OSS, ALSA, JACK, SNDIO (on OpenBSD) or null (only for -# debugging). You can enter more than one driver as a colon-separated -# list. The first working driver will be used. -#SoundDriver = JACK:ALSA:OSS - -# Jack output settings. -#JackClientName = "moc" -#JackStartServer = no -#JackOutLeft = "system:playback_1" -#JackOutRight = "system:playback_2" - -# OSS output settings. -#OSSDevice = /dev/dsp -#OSSMixerDevice = /dev/mixer -#OSSMixerChannel1 = pcm # 'pcm', 'master' or 'speaker' -#OSSMixerChannel2 = master # 'pcm', 'master' or 'speaker' - -# ALSA output settings. If you need to dump the audio produced by MOC -# to a file for diagnostic purposes, the following setting of 'ALSADevice' -# should do that: -# -# ALSADevice=tee:hw,'/tmp/out.wav',wav -# -#ALSADevice = default -#ALSAMixer1 = PCM -#ALSAMixer2 = Master - -# Under some circumstances on 32-bit systems, audio played continously -# for long periods of time may begin to stutter. Setting this option to -# 'yes' will force MOC to avoid ALSA's dmix resampling and prevent this -# stutter. But it also has other implications: -# -# - You may experience unacceptably high CPU load. -# - ALSA's resampler plug-ins will not be used. -# - The resampling may be of lower quality than ALSA would provide. -# - You may need to try different "ResampleMethod" option settings. -# - The "ForceSampleRate" option may be ineffective. -# - If libsamplerate is not configured, many audios may be unplayable. -# -#ALSAStutterDefeat = no - -# Save software mixer state? -# If enabled, a file 'softmixer' will be created in '~/.moc/' storing the -# mixersetting set when the server is shut down. -# Note that there is a "hidden" 'Amplification' setting in that file. -# Amplification (0-200) is used to scale the mixer setting (0-100). This -# results in a higher signal amplitude but may also produce clipping. -#Softmixer_SaveState = yes - -# Save equalizer state? -# If enabled, a file 'equalizer' will be created in '~/.moc/' storing the -# equalizer settings when the server is shut down. -# Note that there is a "hidden" 'Mixin' setting in that file. -# Mixin (0.0-1.0) is used to determine how much of the original signal is -# used after equalizing. 0 means to only use the equalized sound, while 1 -# effectively disabled the mixer. The default is 0.25. -#Equalizer_SaveState = yes - -# Show files with dot at the beginning? -#ShowHiddenFiles = no - -# Hide file name extensions? -#HideFileExtension = no - -# Show file format in menu? -#ShowFormat = yes - -# Show file time in menu? Possible values: 'yes', 'no' and 'IfAvailable' -# (meaning show the time only when it is already known, which often works -# faster). -#ShowTime = IfAvailable - -# Show time played as a percentage in the time progress bar. -#ShowTimePercent = no - -# Values of the TERM environment variable which are deemed to be managed by -# screen(1). If you are setting a specific terminal using screen(1)'s -# '-T ' option, then you will need to add 'screen.' to this list. -# Note that this is only a partial test; the value of the WINDOW environment -# variable must also be a number (which screen(1) sets). -#ScreenTerms = screen:screen-w:vt100 - -# Values of the TERM environment variable which are deemed to be xterms. If -# you are using MOC within screen(1) under an xterm, then add screen(1)'s -# TERM setting here as well to cause MOC to update the xterm's title. -#XTerms = xterm -#XTerms += xterm-colour:xterm-color -#XTerms += xterm-256colour:xterm-256color -#XTerms += rxvt:rxvt-unicode -#XTerms += rxvt-unicode-256colour:rxvt-unicode-256color -#XTerms += eterm - -# Theme file to use. This can be absolute path or relative to -# /usr/share/moc/themes/ (depends on installation prefix) or -# ~/.moc/themes/ . -# -# Example: Theme = laras_theme -# -Theme = orange - -# The theme used when running on an xterm. -# -# Example: XTermTheme = transparent-background -# -#XTermTheme = - -# Should MOC try to autoload the default lyrics file for an audio? (The -# default lyrics file is a text file with the same file name as the audio -# file name with any trailing "extension" removed.) -#AutoLoadLyrics = yes - -# MOC directory (where pid file, socket and state files are stored). -# You can use ~ at the beginning. -#MOCDir = ~/.moc - -# Use mmap() to read files. mmap() is much slower on NFS. -#UseMMap = no - -# Use MIME to identify audio files. This can make for slower loading -# of playlists but is more accurate than using "extensions". -#UseMimeMagic = no - -# Assume this encoding for ID3 version 1/1.1 tags (MP3 files). Unlike -# ID3v2, UTF-8 is not used here and MOC can't guess how tags are encoded. -# Another solution is using librcc (see the next option). This option is -# ignored if UseRCC is set to 'yes'. -#ID3v1TagsEncoding = WINDOWS-1250 - -# Use librcc to fix ID3 version 1/1.1 tags encoding. -#UseRCC = yes - -# Use librcc to filenames and directory names encoding. -#UseRCCForFilesystem = yes - -# When this option is set the player assumes that if the encoding of -# ID3v2 is set to ISO-8859-1 then the ID3v1TagsEncoding is actually -# that and applies appropriate conversion. -#EnforceTagsEncoding = no - -# Enable the conversion of filenames from the local encoding to UTF-8. -#FileNamesIconv = no - -# Enable the conversion of the xterm title from UTF-8 to the local encoding. -#NonUTFXterm = no - -# Should MOC precache files to assist gapless playback? -#Precache = yes - -# Remember the playlist after exit? -#SavePlaylist = yes - -# When using more than one client (interface) at a time, do they share -# the playlist? -#SyncPlaylist = yes - -# Choose a keymap file (relative to '~/.moc/' or using an absolute path). -# An annotated example keymap file is included ('keymap.example'). -# -# Example: Keymap = my_keymap -# -Keymap = keymap.conf - -# Use ASCII rather than graphic characters for drawing lines. This -# helps on some terminals. -#ASCIILines = no - -# FastDirs, these allow you to jump directly to a directory, the key -# bindings are in the keymap file. -# -# Examples: Fastdir1 = /mp3/rock -# Fastdir2 = /mp3/electronic -# Fastdir3 = /mp3/rap -# Fastdir4 = /mp3/etc -# -#Fastdir1 = -#Fastdir2 = -#Fastdir3 = -#Fastdir4 = -#Fastdir5 = -#Fastdir6 = -#Fastdir7 = -#Fastdir8 = -#Fastdir9 = -#Fastdir10 = - -# How fast to seek (in number of seconds per keystroke). The first -# option is for normal seek and the second for silent seek. -#SeekTime = 1 -#SilentSeekTime = 5 - -# PreferredDecoders allows you to specify which decoder should be used -# for any given audio format. It is a colon-separated list in which -# each entry is of the general form 'code(decoders)', where 'code' -# identifies the audio format and 'decoders' is a comma-separated list -# of decoders in order of preference. -# -# The audio format identifier may be either a filename extension or a -# MIME media type. If the latter, the format is 'type/subtype' (e.g., -# 'audio/flac'). Because different systems may give different MIME -# media types, any 'x-' prefix of the subtype is ignored both here and -# in the actual file MIME type (so all combinations of 'audio/flac' and -# 'audio/x-flac' match each other). -# -# For Internet streams the matching is done on MIME media type and on -# actual content. For files the matches are made on MIME media type -# (if the 'UseMimeMagic' option is set) and on filename extension. The -# MIME media type of a file is not determined until the first entry for -# MIME is encountered in the list. -# -# The matching is done in the order of appearance in the list with any -# entries added from the command line being matched before those listed -# here. Therefore, if you place all filename extension entries before -# all MIME entries you will speed up MOC's processing of directories -# (which could be significant for remote file systems). -# -# The decoder list may be empty, in which case no decoders will be used -# for files (and files with that audio format ignored) while Internet -# streams will be assessed on the actual content. Any decoder position -# may contain an asterisk, in which case any decoder not otherwise listed -# which can handle the audio format will be used. It is not an error to -# list the same decoder twice, but neither does it make sense to do so. -# -# If you have a mix of audio and non-audio files in your directories, you -# may wish to include entries at top of the list which ignore non-audio -# files by extension. -# -# In summary, the PreferredDecoders option provides fine control over the -# type of matching which is performed (filename extension, MIME media -# type and streamed media content) and which decoder(s) (if any) are used -# based on the option's list entries and their ordering. -# -# Examples: aac(aac,ffmpeg) first try FAAD2 for AACs then FFmpeg -# mp3() ignore MP3 files -# wav(*,sndfile) use sndfile for WAV as a last resort -# ogg(vorbis,*):flac(flac,*) try Xiph decoders first -# ogg():audio/ogg() ignore OGG files, and -# force Internet selection by content -# gz():html() ignore some non-audio files -# -# Any unspecified audio formats default to trying all decoders. -# Any unknown (or misspelt) drivers are ignored. -# All names are case insensitive. -# The default setting reflects the historical situation modified by -# the experience of users. -# -#PreferredDecoders = aac(aac,ffmpeg):m4a(ffmpeg) -#PreferredDecoders += mpc(musepack,*,ffmpeg):mpc8(musepack,*,ffmpeg) -#PreferredDecoders += sid(sidplay2):mus(sidplay2) -#PreferredDecoders += wav(sndfile,*,ffmpeg) -#PreferredDecoders += wv(wavpack,*,ffmpeg) -#PreferredDecoders += audio/aac(aac):audio/aacp(aac):audio/m4a(ffmpeg) -#PreferredDecoders += audio/wav(sndfile,*) - -# The following PreferredDecoders attempt to handle the ambiguity surrounding -# container types such as OGG for files. The first two entries will force -# a local file to the correct decoder (assuming the .ogg file contains Vorbis -# audio), while the MIME media types will cause Internet audio streams to -# be assessed on content (which may be either Vorbis or Speex). -# -#PreferredDecoders += ogg(vorbis,*,ffmpeg):oga(vorbis,*,ffmpeg):ogv(ffmpeg) -#PreferredDecoders += application/ogg(vorbis):audio/ogg(vorbis) -#PreferredDecoders += flac(flac,*,ffmpeg) -#PreferredDecoders += opus(ffmpeg) -#PreferredDecoders += spx(speex) - -# Which resampling method to use. There are a few methods of resampling -# sound supported by libresamplerate. The default is 'Linear') which is -# also the fastest. A better description can be found at: -# -# http://www.mega-nerd.com/libsamplerate/api_misc.html#Converters -# -# but briefly, the following methods are based on bandlimited interpolation -# and are higher quality, but also slower: -# -# SincBestQuality - really slow (I know you probably have an xx GHz -# processor, but it's still not enough to not see -# this in the top output :) The worst case -# Signal-to-Noise Ratio is 97dB. -# SincMediumQuality - much faster. -# SincFastest - the fastest bandlimited interpolation. -# -# And these are lower quality, but much faster methods: -# -# ZeroOrderHold - really poor quality, but it's really fast. -# Linear - a bit better and a bit slower. -# -#ResampleMethod = Linear - -# Always use this sample rate (in Hz) when opening the audio device (and -# resample the sound if necessary). When set to 0 the device is opened -# with the file's rate. -#ForceSampleRate = 0 - -# By default, even if the sound card reports that it can output 24bit samples -# MOC converts 24bit PCM to 16bit. Setting this option to 'yes' allows MOC -# to use 24bit output. (The MP3 decoder, for example, uses this format.) -# This is disabled by default because there were reports that it prevents -# MP3 files from playing on some soundcards. -#Allow24bitOutput = no - -# Use realtime priority for output buffer thread. This will prevent gaps -# while playing even with heavy load. The user who runs MOC must have -# permissions to set such a priority. This could be dangerous, because it -# is possible that a bug in MOC will freeze your computer. -#UseRealtimePriority = no - -# The number of audio files for which MOC will cache tags. When this limit -# is reached, file tags are discarded on a least recently used basis (with -# one second resolution). You can disable the cache by giving it a size of -# zero. Note that if you decrease the cache size below the number of items -# currently in the cache, the number will not decrease immediately (if at -# all). -#TagsCacheSize = 256 - -# Number items in the playlist. -#PlaylistNumbering = yes - -# Main window layouts can be configured. You can change the position and -# size of the menus (directory and playlist). You have three layouts and -# can switch between then using the 'l' key (standard mapping). By default, -# only two layouts are configured. -# -# The format is as follows: -# -# - Each layout is described as a list of menu entries. -# - Each menu entry is of the form: -# -# menu(position_x, position_y, width, height) -# -# where 'menu' is either 'directory' or 'playlist'. -# - The parameters define position and size of the menu. They can -# be absolute numbers (like 10) or a percentage of the screen size -# (like 45%). -# - 'width' and 'height' can have also value of 'FILL' which means -# fill the screen from the menu's position to the border. -# - Menus may overlap. -# -# You must describe at least one menu (default is to fill the whole window). -# There must be at least one layout (Layout1) defined; others can be empty. -# -# Example: Layout1 = playlist(50%,50%,50%,50%) -# Layout2 = "" -# Layout3 = "" -# -# Just one layout, the directory will occupy the whole -# screen, the playlist will have 1/4 of the screen size -# and be positioned at lower right corner. (Note that -# because the playlist will be hidden by the directory -# you will have to use the TAB key to make the playlist -# visible.) -# -# Example: Layout1 = playlist(0,0,100%,10):directory(0,10,100%,FILL) -# -# The screen is split into two parts: playlist at the top -# and the directory menu at the bottom. Playlist will -# occupy 10 lines and the directory menu the rest. -# -#Layout1 = directory(0,0,50%,100%):playlist(50%,0,FILL,100%) -#Layout2 = directory(0,0,100%,100%):playlist(0,0,100%,100%) -#Layout3 = "" - -# When the song changes, should the menu be scrolled so that the currently -# played file is visible? -#FollowPlayedFile = yes - -# What to do if the interface was started and the server is already playing -# something from the playlist? If CanStartInPlaylist is set to 'yes', the -# interface will switch to the playlist. When set to 'no' it will start -# from the last directory. -#CanStartInPlaylist = yes - -# Executing external commands (1 - 10) invoked with key commands (F1 - F10 -# by default). -# -# Some arguments are substituted before executing: -# -# %f - file path -# %i - title made from tags -# %S - start block mark (in seconds) -# %E - end block mark (in seconds) -# -# Data from tags can also be substituted: -# -# %t - title -# %a - album -# %r - artist -# %n - track -# %m - time of the file (in seconds) -# -# The parameters above apply to the currently selected file. If you change -# them to capital letters, they are taken from the file currently playing. -# -# Programs are run using execv(), not a shell, so you can't do things like -# redirecting the output to a file. The command string is split using blank -# characters as separators; the first element is the command to be executed -# and the rest are its parameters, so if you use "echo Playing: %I" we run -# program 'echo' (from $PATH) with 2 parameters: the string 'Playing:' and -# the title of the file currently playing. Even if the title contains -# spaces, it's still one parameter and it's safe if it contains `rm -rf /`. -# -# Examples: ExecCommand1 = "cp %f /mnt/usb_drive" -# ExecCommand2 = "/home/joe/now_playing %I" -# -#ExecCommand1 = -#ExecCommand2 = -#ExecCommand3 = -#ExecCommand4 = -#ExecCommand5 = -#ExecCommand6 = -#ExecCommand7 = -#ExecCommand8 = -#ExecCommand9 = -#ExecCommand10 = - -# Display the cursor in the line with the selected file. Some braille -# readers (the Handy Tech modular series ZMU 737, for example) use the -# cursor to focus and can make use of it to present the file line even -# when other fields are changing. -#UseCursorSelection = no - -# Set the terminal title when running under xterm. -#SetXtermTitle = yes - -# Set the terminal title when running under screen(1). If MOC can detect -# that it is running under screen(1), then it will set an appropriate -# title (see description of ScreenTerms above). However, if multiple -# levels of screen management are involved, detection might fail and this -# could cause a screen upset. In that situation you can use this option -# to force screen titles off. -#SetScreenTitle = yes - -# Display full paths instead of just file names in the playlist. -#PlaylistFullPaths = yes - -# The following setting describes how block markers are displayed in -# the play time progress bar. Its value is a string of exactly three -# characters. The first character is displayed in a position which -# corresponds to the time marked as the start of a block and the last -# character to the time marked as the end of the block. The middle -# character is displayed instead if both the start and the end of the block -# would fall in the same position (within the resolution of the interface). -# You can turn off the displaying of these block marker positions by using -# three space characters. -#BlockDecorators = "`\"'" - -# How long (in seconds) to leave a message displayed on the screen. -# Setting this to a high value allows you to scroll through the messages -# using the 'hide_message' key. Setting it to zero means you'll have to -# be quick to see any message at all. Any new messages will be queued up -# and displayed after the current message's linger time expires. -#MessageLingerTime = 3 - -# Does MOC display a prefix on delayed messages indicating -# the number of queued messages still to be displayed? -#PrefixQueuedMessages = yes - -# String to append to the queued message count if any -# error messages are still waiting to be displayed. -#ErrorMessagesQueued = "!" - -# Self-describing ModPlug options (with 'yes' or 'no' values). -#ModPlug_Oversampling = yes -#ModPlug_NoiseReduction = yes -#ModPlug_Reverb = no -#ModPlug_MegaBass = no -#ModPlug_Surround = no - -# ModPlug resampling mode. -# Valid values are: -# -# FIR - 8 tap fir filter (extremely high quality) -# SPLINE - Cubic spline interpolation (high quality) -# LINEAR - Linear interpolation (fast, good quality) -# NEAREST - No interpolation (very fast, extremely bad sound quality) -# -#ModPlug_ResamplingMode = FIR - -# Other self-describing ModPlug audio characteristic options. -# (Note that the 32 bit sample size seems to be buggy.) -#ModPlug_Channels = 2 # 1 or 2 channels -#ModPlug_Bits = 16 # 8, 16 or 32 bits -#ModPlug_Frequency = 44100 # 11025, 22050, 44100 or 48000 Hz -#ModPlug_ReverbDepth = 0 # 0 (quiet) to 100 (loud) -#ModPlug_ReverbDelay = 0 # Delay in ms (usually 40-200ms) -#ModPlug_BassAmount = 0 # 0 (quiet) to 100 (loud). -#ModPlug_BassRange = 10 # Cutoff in Hz (10-100). -#ModPlug_SurroundDepth = 0 # Surround level 0(quiet)-100(heavy). -#ModPlug_SurroundDelay = 0 # Surround delay in ms, usually 5-40ms. -#ModPlug_LoopCount = 0 # 0 (never), n (times) or -1 (forever) - -# Self-describing TiMidity audio characteristic options. -#TiMidity_Rate = 44100 # Between 8000 and 48000 -#TiMidity_Bits = 16 # 8 or 16 -#TiMidity_Channels = 2 # 1 or 2 -#TiMidity_Volume = 100 # 0 to 800 - -# You can setup a TiMidity-Config-File here. -# Leave it unset to use library defaults (/etc/timidity.cfg mostly). -# Setting it to 'yes' also uses the library defaults. -# Set it to 'no' if you don't have any configuration file. -# Otherwise set it to the name of a specific file. -#TiMidity_Config = - -# Self-describing SidPlay2 audio characteristic options. -#SidPlay2_DefaultSongLength = 180 # If not in database (in seconds) -#SidPlay2_MinimumSongLength = 0 # Play at least n (in seconds) -#SidPlay2_Frequency = 44100 # 4000 to 48000 -#SidPlay2_Bits = 16 # 8 or 16 -#SidPlay2_Optimisation = 0 # 0 (worst quality) to 2 (best quality) - -# Set path to a HVSC-compatible database (if not set, database is disabled). -#SidPlay2_Database = - -# SidPlay2 playback Mode: -# -# "M": Mono (best for many SIDs) -# "S": Stereo -# "L"/"R": Left / Right -# -#SidPlay2_PlayMode = "M" - -# Use start-song information from SID ('yes') or start at first song -# ('no'). Songs before the start-song won't be played. -#SidPlay2_StartAtStart = yes - -# Play sub-tunes. -#SidPlay2_PlaySubTunes = yes - -# Run the OnSongChange command when a new song starts playing. -# Specify the full path (i.e. no leading '~') of an executable to run. -# Arguments will be passed, and you can use the following escapes: -# -# %a artist -# %r album -# %f filename -# %t title -# %n track -# %d file duration in XX:YY form -# %D file duration, number of seconds -# -# No pipes/redirects can be used directly, but writing a shell script -# can do the job. -# -# Example: OnSongChange = "/home/jack/.moc/myscript %a %r" -# -#OnSongChange = - -# If RepeatSongChange is 'yes' then MOC will execute the command every time -# a song starts playing regardless of whether or not it is just repeating. -# Otherwise the command will only be executed when a different song is -# started. -#RepeatSongChange = no - -# Run the OnStop command (full path, no arguments) when MOC changes state -# to stopped (i.e., when user stopped playing or changes a song). -# -# Example: OnStop = "/home/jack/.moc/myscript_on_stop" -# -#OnStop = - -# This option determines which song to play after finishing all the songs -# in the queue. Setting this to 'yes' causes MOC to play the song which -# follows the song being played before queue playing started. If set to -# 'no', MOC will play the song following the last song in the queue if it -# is in the playlist. The default is 'yes' because this is the way other -# players usually behave. (Note that this option previously took the -# values 1 and 0; these are now deprecated in favour of 'yes' and 'no'.) -#QueueNextSongReturn = yes \ No newline at end of file diff --git a/.moc/keymap.conf b/.moc/keymap.conf deleted file mode 100644 index 84449a1..0000000 --- a/.moc/keymap.conf +++ /dev/null @@ -1,187 +0,0 @@ -# This is the example keymap file for MOC. You can define your own key -# bindings for MOC commands by creating your own keymap file and setting -# the 'Keymap' option in ~/.moc/config. -# -# The format of this file is: -# -# - Lines beginning with # are comments. -# - Blank lines are ignored. -# - Every other line is expected to be in one of the formats: -# -# COMMAND = [KEY ...] -# COMMAND += KEY ... -# -# The KEY can be: -# -# - Just a char, like i, L, ", * -# - CTRL-KEY sequence: ^k (CTRL-k), ^4 -# - ALT-KEY (meta) sequence: M-j (ALT-j), M-/ -# - Special keys: DOWN, UP -# LEFT, RIGHT -# HOME, END -# BACKSPACE -# INS, DEL -# ENTER -# PAGE_UP, PAGE_DOWN -# SPACE, TAB -# KEYPAD_CENTER -# ESCAPE -# F1 - F12 -# -# Note that the use of a digit as a KEY is deprecated. -# -# Maximum number of KEYs for one COMMAND is 5. -# -# Omitting the KEY for a COMMAND will unbind all its default keys. They -# will also be automatically unbound when you bind new KEYs to it. Individual -# default KEYs will be automatically unbound when they are explicitly bound -# to some other COMMAND. -# -# Using the '+=' form will cause the KEYs to be appended to any existing -# (default or explicit) bindings for the COMMAND. Appending an existing -# default binding for the same COMMAND will cause MOC to think of that KEY -# as then being explicitly bound. -# -# Only one binding for any given COMMAND can appear in the keymap file. One -# exception to this is that if the default keys for a COMMAND are explicitly -# unbound then a subsequent binding may appear for it. A second exception -# is that multiple appending bindings may appear. -# -# Meta-key detection is sensitive to the ESCDELAY environment variable (see -# the manpage for ncurses(3)). In its absence, MOC resets the default -# delay to 25ms. If you need to emulate meta-key sequences using the ESC -# key, then you may need to set the value of ESCDELAY back to its ncurses -# default of 1000ms (but doing so will make the response to the ESC key -# sluggish). -# -# If MOC's keypresses are being filtered through some other program (in a -# GUI environment, for example) which also does meta-key detection, then -# MOC is at the mercy of the timings with which that program presents them. -# -# Default key configuration for MOC (and a list of all available commands): - -# MOC control keys: -quit_client = q -quit = Q - -# Menu and interface control keys: -go = ENTER -menu_down = ^n -menu_up = ^p -menu_page_down = PAGE_DOWN -menu_page_up = PAGE_UP -menu_first_item = HOME -menu_last_item = END -search_menu = g / -toggle_read_tags = f -toggle_show_time = ^t -toggle_show_format = ^f -toggle_menu = TAB -toggle_layout = l -toggle_hidden_files = H -show_lyrics = L -theme_menu = T -help = h ? -refresh = ^r -reload = r - -# Audio playing and positioning keys: -seek_forward = RIGHT -seek_backward = LEFT -seek_forward_fast = ] -seek_backward_fast = [ -pause = SPACE -stop = s -next = N -previous = b -toggle_shuffle = S -toggle_repeat = R -toggle_auto_next = X -toggle_mixer = x -go_url = o - -# Volume control keys: -volume_down_1 = < -volume_up_1 = > -volume_down_5 = , -volume_up_5 = . -volume_10 = M-1 -volume_20 = M-2 -volume_30 = M-3 -volume_40 = M-4 -volume_50 = M-5 -volume_60 = M-6 -volume_70 = M-7 -volume_80 = M-8 -volume_90 = M-9 - -# Directory navigation keys: defaults are Shift-number -# (i.e., 'shift 1' -> '!' -> 'Fastdir1'). -go_to_a_directory = i -go_to_music_directory = m -go_to_fast_dir1 = ! -go_to_fast_dir2 = @ -go_to_fast_dir3 = # -go_to_fast_dir4 = $ -go_to_fast_dir5 = % -go_to_fast_dir6 = ^ -go_to_fast_dir7 = & -go_to_fast_dir8 = * -go_to_fast_dir9 = ( -go_to_fast_dir10 = ) -go_to_playing_file = G -go_up = U - -# Playlist specific keys: -add_file = a -add_directory = A -plist_add_stream = ^u -delete_from_playlist = d -playlist_full_paths = P -plist_move_up = u -plist_move_down = j -save_playlist = V -remove_dead_entries = Y -clear_playlist = C - -# Queue manipulation keys: -enqueue_file = z -clear_queue = Z - -# User interaction control: -history_up = f -history_down = b -delete_to_start = ^u -delete_to_end = ^k -cancel = ^x ESCAPE -hide_message = M - -# Softmixer specific keys: -toggle_softmixer = w -toggle_make_mono = J - -# Equalizer specific keys: -toggle_equalizer = E -equalizer_refresh = e -equalizer_prev = K -equalizer_next = k - -# External commands: -mark_start = ' -mark_end = " -exec_command1 = F1 -exec_command2 = F2 -exec_command3 = F3 -exec_command4 = F4 -exec_command5 = F5 -exec_command6 = F6 -exec_command7 = F7 -exec_command8 = F8 -exec_command9 = F9 -exec_command10 = F10 - -# The following commands are available but not assigned to any keys by -# default: -# -# toggle_percent Switch on/off play progress bar time percentage -# diff --git a/.moc/themes b/.moc/themes deleted file mode 160000 index 3578cd9..0000000 --- a/.moc/themes +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3578cd99a73e81a07749c1ed79fad998c6da0846 -- cgit v1.2.3 From d6393315048323c9006190202c3d1ed53d977bec Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 10 May 2024 09:06:08 +0300 Subject: Remove unused shells & scripts --- .scripts/waybar-wttr.py | 119 ------------------------------------------------ .shells/alias.sh | 44 ------------------ .shells/exports.sh | 27 ----------- 3 files changed, 190 deletions(-) delete mode 100755 .scripts/waybar-wttr.py delete mode 100644 .shells/alias.sh delete mode 100644 .shells/exports.sh diff --git a/.scripts/waybar-wttr.py b/.scripts/waybar-wttr.py deleted file mode 100755 index 08b49a6..0000000 --- a/.scripts/waybar-wttr.py +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/env python - -import json -import requests -from datetime import datetime - -WEATHER_CODES = { - '113': '☀️ ', - '116': '⛅ ', - '119': '☁️ ', - '122': '☁️ ', - '143': '☁️ ', - '176': '🌧️', - '179': '🌧️', - '182': '🌧️', - '185': '🌧️', - '200': '⛈️ ', - '227': '🌨️', - '230': '🌨️', - '248': '☁️ ', - '260': '☁️ ', - '263': '🌧️', - '266': '🌧️', - '281': '🌧️', - '284': '🌧️', - '293': '🌧️', - '296': '🌧️', - '299': '🌧️', - '302': '🌧️', - '305': '🌧️', - '308': '🌧️', - '311': '🌧️', - '314': '🌧️', - '317': '🌧️', - '320': '🌨️', - '323': '🌨️', - '326': '🌨️', - '329': '❄️ ', - '332': '❄️ ', - '335': '❄️ ', - '338': '❄️ ', - '350': '🌧️', - '353': '🌧️', - '356': '🌧️', - '359': '🌧️', - '362': '🌧️', - '365': '🌧️', - '368': '🌧️', - '371': '❄️', - '374': '🌨️', - '377': '🌨️', - '386': '🌨️', - '389': '🌨️', - '392': '🌧️', - '395': '❄️ ' -} - -data = {} - - -weather = requests.get("https://wttr.in/?format=j1").json() - - -def format_time(time): - return time.replace("00", "").zfill(2) - - -def format_temp(temp): - return (hour['FeelsLikeC']+"°").ljust(3) - - -def format_chances(hour): - chances = { - "chanceoffog": "Fog", - "chanceoffrost": "Frost", - "chanceofovercast": "Overcast", - "chanceofrain": "Rain", - "chanceofsnow": "Snow", - "chanceofsunshine": "Sunshine", - "chanceofthunder": "Thunder", - "chanceofwindy": "Wind" - } - - conditions = [] - for event in chances.keys(): - if int(hour[event]) > 0: - conditions.append(chances[event]+" "+hour[event]+"%") - return ", ".join(conditions) - -tempint = int(weather['current_condition'][0]['FeelsLikeC']) -extrachar = '' -if tempint > 0 and tempint < 10: - extrachar = '+' - - -data['text'] = ' '+WEATHER_CODES[weather['current_condition'][0]['weatherCode']] + \ - " "+extrachar+weather['current_condition'][0]['FeelsLikeC']+"°" - -data['tooltip'] = f"{weather['current_condition'][0]['weatherDesc'][0]['value']} {weather['current_condition'][0]['temp_C']}°\n" -data['tooltip'] += f"Feels like: {weather['current_condition'][0]['FeelsLikeC']}°\n" -data['tooltip'] += f"Wind: {weather['current_condition'][0]['windspeedKmph']}Km/h\n" -data['tooltip'] += f"Humidity: {weather['current_condition'][0]['humidity']}%\n" -for i, day in enumerate(weather['weather']): - data['tooltip'] += f"\n" - if i == 0: - data['tooltip'] += "Today, " - if i == 1: - data['tooltip'] += "Tomorrow, " - data['tooltip'] += f"{day['date']}\n" - data['tooltip'] += f"⬆️ {day['maxtempF']}° ⬇️ {day['mintempF']}° " - data['tooltip'] += f"🌅 {day['astronomy'][0]['sunrise']} 🌇 {day['astronomy'][0]['sunset']}\n" - for hour in day['hourly']: - if i == 0: - if int(format_time(hour['time'])) < datetime.now().hour-2: - continue - data['tooltip'] += f"{format_time(hour['time'])} {WEATHER_CODES[hour['weatherCode']]} {format_temp(hour['FeelsLikeC'])} {hour['weatherDesc'][0]['value']}, {format_chances(hour)}\n" - - -print(json.dumps(data)) diff --git a/.shells/alias.sh b/.shells/alias.sh deleted file mode 100644 index a7ace2e..0000000 --- a/.shells/alias.sh +++ /dev/null @@ -1,44 +0,0 @@ -alias grep='grep --color=auto' -alias anki='QTWEBENGINE_CHROMIUM_FLAGS="--disable-seccomp-filter-sandbox" anki' - -alias o="emacsclient -n" -alias clear='printf "\033c"' - -#git -alias ga='git add' -alias gaa='git add .' -alias gc='git commit -m' -alias gp='git push -u origin' -alias gpm='git push -u origin master' -alias gpd='git push -u origin developer' -alias gs='git status' -alias cpm='config push -u origin master' -alias ca='config add' -alias cs='config status' -alias cc='config commit -m' - -#pacman | yay -alias yeet='paru -Rsc' - -# weather -alias weather="curl wttr.in" - -alias ls='ls --color' -alias ll='ls -la --color' -alias sb='sudo systemctl start bluetooth' -alias mykeys='setxkbmap -option caps:escape' -alias logout='pkill -U $USER' -#alias neofetch='neofetch | lolcat' -alias b='bluetoothctl' -alias ba='bluetooth-autoconnect' -alias music='mocp' -alias ytd="yt-dlp" -alias c="pavucontrol" -alias r="ranger" -alias klight="brightnessctl --device='tpacpi::kbd_backlight' set 1" - -##yarn -alias sweb='BROWSER="firefox" yarn start' - -##flatpaks -alias fanki='flatpak run net.ankiweb.Anki' diff --git a/.shells/exports.sh b/.shells/exports.sh deleted file mode 100644 index aaf0f7d..0000000 --- a/.shells/exports.sh +++ /dev/null @@ -1,27 +0,0 @@ -# Export 'SHELL' to child processes. Programs such as 'screen' -# honor it and otherwise use /bin/sh. -export SHELL -export PATH -export PATH=/home/$USER/.local/bin:$PATH -export EDITOR="emacsclient" -export GIT_EDITOR="emacsclient" -export SBCL_HOME="/usr/lib/sbcl/" -export PATH=$PATH:~/.roswell/bin -export SBCL_HOME=/usr/local/lib/sbcl -export XDG_SESSION_TYPE=x11 -export OLLAMA_HOST=zeus:11434 - -## Python -export PYENV_ROOT="$HOME/.pyenv" -export PATH="$PYENV_ROOT/bin:$PATH" - -if [[ $- != *i* ]] -then - # We are being invoked from a non-interactive shell. If this - # is an SSH session (as in "ssh host command"), source - # /etc/profile so we get PATH and other essential variables. - [[ -n "$SSH_CLIENT" ]] && source /etc/profile - - # Don't do anything else. - return -fi -- cgit v1.2.3 From 149b1fe15343f0b3850760913e0f2542c6fb11c3 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 10 May 2024 09:07:30 +0300 Subject: Remove starship --- .config/starship.toml | 94 --------------------------------------------------- 1 file changed, 94 deletions(-) delete mode 100644 .config/starship.toml diff --git a/.config/starship.toml b/.config/starship.toml deleted file mode 100644 index e424a8c..0000000 --- a/.config/starship.toml +++ /dev/null @@ -1,94 +0,0 @@ -# Get editor completions based on the config schema -"$schema" = 'https://starship.rs/config-schema.json' -# Inserts a blank line between shell prompts -add_newline = true - -# Replace the '❯' symbol in the prompt with '➜' -[character] # The name of the module we are configuring is 'character' -success_symbol = '[λ](red)' # The 'success_symbol' segment is being set to '➜' with the color 'bold green' -error_symbol = "[✖](bold red) " - -[battery] -full_symbol = "🔋" -charging_symbol = "🔌" -discharging_symbol = "⚡" - -[[battery.display]] -threshold = 30 -style = "bold red" - -[cmd_duration] -min_time = 10_000 # Show command duration over 10,000 milliseconds (=10 sec) -format = " took [$duration]($style)" - -[directory] -truncation_length = 5 -format = "[$path](yellow)[$lock_symbol]($lock_style) " - -[git_branch] -format = " [$symbol$branch]($style) " -symbol = "[](bold red) " -style = "blue bold" - -[git_commit] -commit_hash_length = 8 -style = "bold white" - -[git_state] -format = '[\($state( $progress_current of $progress_total)\)]($style) ' - -[git_status] -conflicted = "⚔️ " -ahead = "🏎️ 💨 ×${count}" -behind = "🐢 ×${count}" -diverged = "🔱 🏎️ 💨 ×${ahead_count} 🐢 ×${behind_count}" -untracked = "  ×${count}" -stashed = "📦 " -modified = " ×${count}" -staged = "🗃️ ×${count}" -renamed = "📛 ×${count}" -deleted = "🗑️ ×${count}" -style = "bright-white" -format = "$all_status$ahead_behind" - -[hostname] -ssh_only = false -format = "<[$hostname]($style)>" -trim_at = "-" -style = "bold dimmed white" -disabled = true - -[julia] -format = "[$symbol$version]($style) " -symbol = "ஃ " -style = "bold green" - -[memory_usage] -format = "$symbol[${ram}( | ${swap})]($style) " -threshold = 70 -style = "bold dimmed white" -disabled = false - -[package] -disabled = true - -[python] -format = "[$symbol$version]($style) " -style = "bold green" - -[rust] -format = "[$symbol$version]($style) " -style = "bold green" - -[time] -time_format = "%T" -format = "🕙 $time($style) " -style = "bright-white" -disabled = true - -[username] -style_user = "bold dimmed blue" -show_always = false - -[nodejs] -format = "via [🤖 $version](bold green) " -- cgit v1.2.3 From bec6503f1224c6b03d954887a3ee50c49fa3115f Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 10 May 2024 09:08:39 +0300 Subject: Remove stow, moving to guix home --- .stow-local-ignore | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 .stow-local-ignore diff --git a/.stow-local-ignore b/.stow-local-ignore deleted file mode 100644 index 8794dd1..0000000 --- a/.stow-local-ignore +++ /dev/null @@ -1,29 +0,0 @@ -# Comments and blank lines are allowed. - -images - -vimium-options.json - -RCS -.+,v - -^scripts$ - -CVS -\.\#.+ # CVS conflict files / emacs lock files -\.cvsignore - -\.svn -_darcs -\.hg - -\.git$ -\.gitmodules.* -.*\.org$ - -.+~ # emacs backup files -\#.*\# # emacs autosave files - -^/README.* -^/LICENSE.* -^/COPYING \ No newline at end of file -- cgit v1.2.3 From 91e4e06f9080836c7095e7198e923ee4be768882 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 10 May 2024 09:09:25 +0300 Subject: emacs: Rewrite emacs configuration as one file --- .emacs.d/init.el | 883 ------------------------ .emacs.d/insert/python.template | 2 - .emacs.d/modules/thanos-commands.el | 295 -------- .emacs.d/modules/thanos-mu4e.el | 132 ---- .emacs.d/modules/thanos-pass.el | 91 --- emacs.el | 1280 +++++++++++++++++++++++++++++++++++ 6 files changed, 1280 insertions(+), 1403 deletions(-) delete mode 100644 .emacs.d/init.el delete mode 100644 .emacs.d/insert/python.template delete mode 100644 .emacs.d/modules/thanos-commands.el delete mode 100644 .emacs.d/modules/thanos-mu4e.el delete mode 100644 .emacs.d/modules/thanos-pass.el create mode 100644 emacs.el diff --git a/.emacs.d/init.el b/.emacs.d/init.el deleted file mode 100644 index 392a5ec..0000000 --- a/.emacs.d/init.el +++ /dev/null @@ -1,883 +0,0 @@ -;;; init.el --- Welcome to my Emacs configuration! -*- lexical-binding: t; -*- - -;; Copyright (C) 2023 Thanos Apollo - -;; Author: Thanos Apollo -;; Keywords: extensions - -;; 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 . - -;;; Commentary: -;; ╭━━━━┳╮╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━━━╮╱╱╱╱╱╭╮╭╮╱╱╱╱╱╱╱╱╭━━━╮ -;; ┃╭╮╭╮┃┃╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃╭━╮┃╱╱╱╱╱┃┃┃┃╱╱╱╱╱╱╱╱┃╭━━╯ -;; ╰╯┃┃╰┫╰━┳━━┳━╮╭━━┳━━╮┃┃╱┃┣━━┳━━┫┃┃┃╭━━╮╱╱╱╱┃╰━━┳╮╭┳━━┳━━┳━━╮ -;; ╱╱┃┃╱┃╭╮┃╭╮┃╭╮┫╭╮┃━━┫┃╰━╯┃╭╮┃╭╮┃┃┃┃┃╭╮┃╭━━╮┃╭━━┫╰╯┃╭╮┃╭━┫━━┫ -;; ╱╱┃┃╱┃┃┃┃╭╮┃┃┃┃╰╯┣━━┃┃╭━╮┃╰╯┃╰╯┃╰┫╰┫╰╯┃╰━━╯┃╰━━┫┃┃┃╭╮┃╰━╋━━┃ -;; ╱╱╰╯╱╰╯╰┻╯╰┻╯╰┻━━┻━━╯╰╯╱╰┫╭━┻━━┻━┻━┻━━╯╱╱╱╱╰━━━┻┻┻┻╯╰┻━━┻━━╯ -;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃┃ -;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰╯ -;;; Code: - -(setf user-full-name "Thanos Apollo" - user-mail-address "public@thanosapollo.org") - -(defvar is-zeus (equal (system-name) "zeus")) -(defvar is-hermes (equal (system-name) "hermes")) -(defvar is-phone (equal (system-name) "localhost")) - -(setf browse-url-browser-function 'browse-url-generic - browse-url-generic-program "firefox" - backup-directory-alist '((".*" . "~/.Trash")) - sentence-end-double-space t - default-input-method "bulgarian-phonetic" - ;; fix emacs hangs - gc-cons-threshold 5000000 - ispell-program-name (executable-find "hunspell")) - -(define-key global-map (kbd "M-") 'backward-kill-sexp) -(define-key global-map (kbd "C-c L") 'display-line-numbers-mode) -(define-key global-map (kbd "C-z") 'nil) -(define-key global-map (kbd "C-c r") 'rename-visited-file) - -(add-to-list 'load-path "~/.emacs.d/modules") - -(setf disabled-command-function nil ;; Enable all commands - url-privacy-level 'high) ;; Privacy level - -;; Calendar dates -(setf calendar-date-style 'european) - -(require 'dired) -(define-key dired-mode-map (kbd "b") 'dired-up-directory) -(define-key dired-mode-map (kbd "v") 'dired-watch-video) -(define-key dired-mode-map (kbd "z") 'wdired-change-to-wdired-mode) -(define-key dired-mode-map (kbd "C-c w") 'dired-set-wallpaper) -(define-key dired-mode-map (kbd "C-c d") 'dired-delete-files-except) -(define-key dired-mode-map (kbd "C-c r") 'dired-do-query-replace-regexp) - -;; font -(custom-set-faces - (if is-hermes '(default ((t (:inherit nil :height 120 :family "Jetbrains Mono")))) - '(default ((t (:inherit nil :height 130 :family "Jetbrains Mono")))))) - -(if is-zeus - (display-battery-mode 0) - (display-battery-mode 1)) - -(savehist-mode) -(save-place-mode 1) -(recentf-mode 1) -(electric-pair-mode 1) - -;; Autoinsert -(auto-insert-mode 1) - -(setq auto-insert-alist '((python-mode . "python.template")) - auto-insert-directory (locate-user-emacs-file "insert")) - -(add-to-list 'completion-styles 'initials t) - -(setf tab-always-indent 'complete) - -;; tramp -(setf tramp-default-method "ssh") - -;; xref -(setf xref-show-xrefs-function #'consult-xref - xref-show-definitions-function #'consult-xref) - -(add-hook 'emacs-lisp-mode-hook #'prettify-symbols-mode) -(add-hook 'lisp-mode-hook #'prettify-symbols-mode) - -;; Set and load custom.el -(setf custom-file (locate-user-emacs-file "custom.el")) -(load custom-file 'noerror) - -;; Enable use-package support for imenu -(setf use-package-enable-imenu-support t) - -;; Install straight.el -(defvar bootstrap-version) - -(let ((bootstrap-file - (expand-file-name - "straight/repos/straight.el/bootstrap.el" - (or (bound-and-true-p straight-base-dir) - user-emacs-directory))) - (bootstrap-version 7)) - (unless (file-exists-p bootstrap-file) - (with-current-buffer - (url-retrieve-synchronously - "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" - 'silent 'inhibit-cookies) - (goto-char (point-max)) - (eval-print-last-sexp))) - (load bootstrap-file nil 'nomessage)) - -(setq package-enable-at-startup nil) - -(require 'straight) - -(setf straight-use-package-by-default t) - -(setf straight-recipe-overrides - '((transmission :type git :host nil :repo "git@thanosapollo.org:/var/git/transmission.git") - (yeetube :type git :host nil :repo "git@thanosapollo.org:/var/git/yeetube.git") - (gnosis :type git :host nil :repo "git@thanosapollo.org:/var/git/gnosis.git") - (pcmpl-emerge :type git :host nil :repo "git@thanosapollo.org:/var/git/pcmpl-emerge.git") - (pcmpl-rc :type git :host nil :repo "git@thanosapollo.org:/var/git/pcmpl-rc.git"))) - -(defun theme-invisible-dividers (_theme) - "Make window dividers for THEME invisible." - (let ((bg (face-background 'default))) - (custom-set-faces - `(fringe ((t :background ,bg :foreground ,bg))) - `(window-divider ((t :background ,bg :foreground ,bg))) - `(window-divider-first-pixel ((t :background ,bg :foreground ,bg))) - `(window-divider-last-pixel ((t :background ,bg :foreground ,bg)))))) - -(add-hook 'enable-theme-functions #'theme-invisible-dividers) - -;;;; Theming ;;;; -(setf inhibit-startup-message t - initial-scratch-message nil) - -(blink-cursor-mode -1) -(global-visual-line-mode 0) - -(setf visible-bell nil - display-line-numbers-type 'relative) - -(column-number-mode) -(global-display-line-numbers-mode 1) - -;; Transparency -(add-to-list 'default-frame-alist '(alpha-background . 85)) - -;; theming -(global-hl-line-mode) - -(defun thanos/terminal-theming () - "Customize theming when laucning Emacs as TUI." - (unless (display-graphic-p (selected-frame)) - (set-face-background 'default "unspecified-bg" (selected-frame)) - (global-hl-line-mode 0))) - -(add-hook 'window-setup-hook 'thanos/terminal-theming) - -(when (equal is-phone nil) - (scroll-bar-mode -1) - (set-fringe-mode 10)) - -(tool-bar-mode -1) -(tooltip-mode -1) -(menu-bar-mode -1) - - -(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-log-done 'time - org-hide-emphasis-markers nil ;;change to t to hide emphasis markers - org-table-convert-region-max-lines 20000 - org-log-done 'time - org-todo-keywords '((sequence "TODO(t)" "SEMINAR(s)" "LECTURE(l)" "DONE(d)"))) - - (setf org-structure-template-alist - '(("e" . "src emacs-lisp") - ("p" . "src python") - ("l" . "src lisp") - ("b" . "src bash") - ("q" . "QUOTE"))) - :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)))) - -(defun org-insert-book () - "Insert org-link from ~/Library for book." - (interactive) - (let* ((book-path (read-file-name "Book: " "~/Library/"))) - (org-insert-link nil book-path (file-name-base book-path)))) - -(use-package org-modern - :ensure t - :config - (global-org-modern-mode) - (setf org-modern-table nil - org-modern-todo nil - org-modern-tag nil)) - -;; Create notes directory for org-roam -(unless (file-exists-p "~/Notes") - (make-directory "~/Notes")) - -(use-package org-roam - :defer t - :init - (define-prefix-command 'thanos/notes-map) - :config - (setf org-roam-directory "~/Notes" - org-roam-dailies-directory "daily/") - - (org-roam-db-autosync-enable) - - (setf org-roam-node-display-template - (concat "${title:50} "(propertize "${tags:30}" 'face 'org-tag))) - - (setf org-roam-db-node-include-function - (lambda () - (not (or (member "journal" (org-get-tags)) - (member "dailies" (org-get-tags)))))) - ;; Templates - (setf org-roam-capture-templates - '(("d" "default" plain - "%?" - :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+startup: overview\n") - :unnarrowed t) - ("p" "MUS" plain "* Goals\n\n%?\n\n* Tasks\n\n** TODO Add initial tasks\n\n* Dates\n\n" - :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: MUS") - :unnarrowed t)) - org-roam-dailies-capture-templates - '(("d" "default" entry - "* %?" - :target (file+head "%<%Y-%m-%d>.org" - "#+title: %<%Y-%m-%d>\n#+filetags: :journal:\n")) - ("j" "journal" plain - "\n* Daily Notes\n\n* Goals\n+ []\n\n* Extras %?" - :target (file+head "%<%Y-%m-%d>.org" - "#+title: %<%Y-%m-%d>\n#+filetags: :journal:\n")))) - (defun org-roam-ref-add-book () - "Insert org-link from Library." - (interactive) - (let ((book (format "file:%s" (read-file-name "Book: " (if is-zeus "/hdd/Library/" "~/Library/"))))) - book)) - - (defun org-roam-sync-notes () - "Sync org-oram notes" - (interactive) - (let ((git (executable-find "git")) - (default-directory org-roam-directory)) - (message "Synching org-roam notes %s" org-roam-directory) - (unless git - (error "Git not found, please install `git'")) - (unless (file-exists-p (expand-file-name ".git" gnosis-dir)) - (message "Creating git repository") - (vc-create-repo 'Git)) - (shell-command "git pull") - (shell-command (format "%s %s" git "add .")) - (shell-command (format "%s %s %s" git "commit -m" (shell-quote-argument "Update org-roam notes"))) - (vc-git-push nil)) - (funcall 'org-roam-db-sync)) - :bind (("C-c n" . thanos/notes-map) - :map thanos/notes-map - ("t" . org-roam-buffer-toggle) - ("f" . org-roam-node-find) - ("i" . org-roam-node-insert) - ("d" . org-roam-dailies-goto-today) - ("D" . org-roam-dailies-goto-date) - :map org-mode-map - ("C-c C-." . org-roam-tag-add) - ("C-c i" . org-id-get-create))) - -(use-package org-roam-ui - :defer t) - -(use-package modus-themes - :straight t - :config - (setf modus-themes-italic-constructs nil - modus-themes-bold-constructs nil - modus-themes-mixed-fonts nil - modus-themes-variable-pitch-ui nil - modus-themes-custom-auto-reload t - modus-themes-disable-other-themes t - modus-themes-prompts '(italic) - modus-themes-completions '((matches . (extrabold)) - (selection . (semibold italic text-also underline))) - 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) - ;; (bg-main "#1d2021") ;;grubox-hard - ;; (bg-main "#191919") ;; 1337 - ;; (bg-main "#1d1f21") ;; tomorrow night - (bg-main "#151515") ;; jazz - ;; (bg-main "#0C0C0C") ;; random black - ;; (bg-main "#171717") ;; badger - ;; (overline-heading-1 gold) - (fg-heading-1 red-warmer) - ;; (bg-heading-1 bg-blue-nuanced) - (bg-line-number-inactive unspecified) - (bg-line-number-active unspecified) - (bg-paren-match bg-magenta-intense) - (underline-paren-match fg-main) - (underline-err red-intense) - (underline-warning yellow-faint) - (underline-note cyan-faint) - (string "#86B187") - (border-mode-line-active unspecified) - (border-mode-line-inactive unspecified) - (bg-mode-line-active "#433F4f") ;; subtle lavender - (bg-mode-line-inactive "#1D1D1D") - ;; set fg from badger theme - (fg-mode-line-active "#F6F3E8") - (bg-hl-line bg-dim) - (cursor slate) - (prose-todo green-intense) - (prose-done bg-term-white) - (fg-prompt yellow-faint) - ,@modus-themes-preset-overrides-intense)) - ;; Headings - (setf modus-themes-headings - '((1 . (ultrabold 1.35)) - (2 . (semibold 1.2)) - (agenda-date . (1.3)) - (agenda-structure . (variable-pitch light 1.8)) - (t . (1.15)))) - ;; Load modus - (load-theme 'modus-vivendi t)) - -(use-package vertico - :ensure t - :config - (vertico-mode)) - -(use-package marginalia - :ensure t - :config - (marginalia-mode)) - -(use-package consult - :ensure t - :init (define-prefix-command 'thanos/search) - :bind (("C-x r d" . 'bookmark-delete) - ("C-x r C-r" . 'bookmark-rename) - ("C-x r C-j" . 'consult-register) - ("C-x r SPC" . 'consult-register-store) - ("C-x r b" . 'consult-bookmark) - ("C-c m" . 'consult-imenu) - ("C-x b" . 'consult-buffer) - ("M-y" . 'consult-yank-from-kill-ring) - ("C-s" . 'thanos/search) - :map thanos/search - ("f" . 'isearch-forward) - ("r" . 'isearch-backward) - ("s" . 'consult-line) - ("i" . 'change-inner) - ("C-f" . 'consult-find) - ("C-g" . 'consult-grep) - ("C-i" . 'consult-info) - ("C-l" . 'consult-locate) - :map project-prefix-map - ("b" . 'consult-project-buffer))) - -(use-package which-key - :ensure t - :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 - (setf elfeed-search-filter "@1-week-ago +unread -hackernoon" - browse-url-browser-function #'browse-url-default-browser) - ;; Feeds - (setf elfeed-feeds - '(("https://hackaday.com/blog/feed/" - hackaday linux) - ("https://thanosapollo.com/posts/index.xml" - thanos) - ("http://wikileaks.org/feed" - wikileaks) - ("https://hackernoon.com/feed" - hackernoon) - ("https://torrentfreak.com/feed" - torrentfreak piracy) - ("https://www.science.org/action/showFeed?type=etoc&feed=rss&jc=sciimmunol" - science) - ("https://rss-bridge.thanosapollo.org/?action=display&bridge=CssSelectorBridge&home_page=https%3A%2F%2Fwww.medscape.com%2Findex%2Flist_13470_0&url_selector=a.title&url_pattern=viewarticle%2F.*&content_selector=div.article__main-content&content_cleanup=&title_cleanup=+-+Index&limit=&format=Atom" medscape med) - ("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://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))) - :bind (("C-x f" . elfeed) - :map elfeed-search-mode-map - ("v" . 'elfeed-mpv) - ("U" . 'elfeed-update)) - :hook ((elfeed-search-mode . (lambda () (display-line-numbers-mode 0))))) - -;; Python -(use-package python-mode - :defer t - :config - (add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))) - -(use-package pyenv - :defer t) - -(use-package elpy - :ensure t - :init - (elpy-enable)) - -;; Clojure -(use-package cider - :defer t) - -(use-package clojure-mode - :defer t) - -(use-package rainbow-delimiters - :defer t - :hook ((emacs-lisp-mode . rainbow-delimiters-mode) - (lisp-mode . rainbow-delimiters-mode) - (clojure-mode . rainbow-delimiters-mode) - (scheme-mode . rainbow-delimiters-mode))) - -;; (use-package paredit -;; :ensure t -;; :hook ((emacs-lisp-mode . paredit-mode) -;; (lisp-mode . paredit-mode) -;; (clojure-mode . paredit-mode) -;; (scheme-mode . paredit-mode))) - -(use-package sly - :init (setf inferior-lisp-program "sbcl") - :defer t) - -(use-package helpful - :defer t - :bind (("C-h f" . 'helpful-callable) - ("C-h v" . 'helpful-variable) - ("C-h k" . 'helpful-key) - ("C-h x" . 'helpful-command) - ("C-h ." . 'helpful-at-point) - ("C-h F" . 'helpful-function) - ("C-h C-k" . 'helpful-kill-buffers) - ("C-h a" . 'apropos) - ("C-h C-m" . 'info-apropos))) - -(use-package password-store - :defer t) - -(use-package ox-hugo - :ensure t - :config - (setf org-hugo-section "post")) - -(use-package json-mode - :defer t - :config - (add-to-list 'auto-mode-alist '("\\.json'" . json-mode))) - -(defun project-magit () - "Run magit-status in the current project's root." - (interactive) - (magit-status-setup-buffer (project-root (project-current t)))) - -(use-package magit - :defer t - :config - (setf magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1) - :bind (:map project-prefix-map ("g" . 'project-magit))) - -(use-package corfu - :ensure t - :config - (global-corfu-mode) - (corfu-popupinfo-mode) - (setf corfu-auto t - corfu-auto-delay 0.1 - corfu-auto-prefix 2 - corfu-cycle t - corfu-popupinfo-delay 0.3 - corfu-quit-at-boundary 'separator - corfu-quit-no-match t - corfu-preselect 'first - corfu-preview-current t - corfu-echo-mode t) - (setf indent-tabs-mode nil)) - -(defun insert-brackets (&optional arg) - "Insert ARG brackets." - (interactive "P") - (insert-pair arg ?\[ ?\])) - -(global-set-key (kbd "C-x M-[") 'insert-brackets) - - -(use-package orderless - :init (add-to-list 'completion-styles 'initials t) - :ensure t - :config - (setf completion-category-overrides '((file (style basic partial-completion))) - completion-styles '(orderless) - completion-cycle-threshold 2)) - -(use-package pdf-tools - :ensure t - :config - (pdf-tools-install) - (add-to-list 'auto-mode-alist '("\\.pdf\\'" . 'pdf-view-mode)) - :hook - ((pdf-view-mode . (lambda () (display-line-numbers-mode 0))))) - -(use-package markdown-mode - :defer t - :config - (setq markdown-header-scaling t - markdown-command "multimarkdown") - (add-to-list 'auto-mode-alist '("\\.md\\'" . gfm-mode)) - :hook ((markdown-mode . flyspell-mode))) - -(use-package org-auto-tangle - :defer t) - -(use-package org-present - :defer t) - -(use-package expand-region - :defer t) - -(use-package change-inner - :after expand-region - :bind ((:map thanos/search ("i" . 'change-inner)))) - -(use-package nov - :defer t - :config - (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))) - -(use-package eshell-syntax-highlighting - :defer t) - -(use-package emojify - :ensure t - :hook (erc-mode . emojify-mode) - :commands emojify-mode) - -(use-package flycheck-package - :ensure t - :after flycheck) - -(use-package flycheck - :ensure t - :config - (setf flycheck-emacs-lisp-load-path 'inherit) - (global-flycheck-mode) - :hook ((emacs-lisp-mode . (lambda () (flycheck-mode) (flycheck-package-setup))))) - -;; Shells -;; (use-package vterm -;; :defer t -;; :bind (("C-c v" . vterm) -;; :map vterm-mode-map -;; ("M-&" . 'async-shell-command) -;; ("C-c C-y" . 'vterm-copy-mode)) -;; :hook ((vterm-mode . (lambda () (display-line-numbers-mode -1))))) - -(use-package shell - :defer t - :bind (("C-c v" . shell)) - :hook ((shell-mode . (lambda () (display-line-numbers-mode -1))))) - -(defvar thanos/aliases - '((g . magit) - (gl . magit-log) - (gc . magit-clone) - (d . dired) - (o . find-file) - (oo . find-file-other-window) - (ll . (lambda () (eshell/ls '-lha))) - (eshell/clear . eshell/clear-scrollback))) - -(defun thanos/set-eshell-aliases (aliases) - "Set ALIASES as eshell aliases." - (mapc (lambda (alias) - (defalias (car alias) (cdr alias))) - aliases)) - -(use-package eshell - :config - (setf eshell-highlight-prompt t) - (eshell-syntax-highlighting-global-mode 1) - :bind (("C-c e" . eshell)) - :hook ((eshell-mode . (lambda () - (thanos/set-eshell-aliases thanos/aliases) - (display-line-numbers-mode -1))))) - -(use-package eat - :after 'eshell - :config - (add-hook 'eshell-load-hook #'eat-eshell-mode) - (setf eat-term-name "xterm-256color")) - -(use-package eshell-git-prompt - :straight '(eshell-git-prompt :type git - :host nil - :repo "https://git.thanosapollo.org/eshell-git-prompt") - :config - (eshell-git-prompt-use-theme 'multiline)) - -;; Chat -(use-package telega - :defer t - :hook ((telega-root-mode . (lambda () - (emojify-mode) - (display-line-numbers-mode -1))) - (telega-chat-mode . (lambda () - (emojify-mode) - (display-line-numbers-mode -1)))) - :config - (setf telega-completing-read-function #'completing-read) - :bind (("C-x T" . 'telega))) - -(use-package erc - :defer t - :config - (unless (expand-file-name "erc" user-emacs-directory) - (make-directory (expand-file-name "erc" user-emacs-directory))) - (setf erc-modules - '(sasl netsplit fill button match track completion readonly - networks ring autojoin noncommands irccontrols move-to-prompt stamp - menu list log notifications) - erc-log-channels-directory (expand-file-name "erc" user-emacs-directory)) - :bind (("C-c E" . 'erc-libera) - :map erc-mode-map - ("C-c RET" . 'erc-cmd-QUERY))) - -(use-package erc-image - :ensure t - :after erc - :config - (setq erc-image-inline-rescale 300) - (add-to-list 'erc-modules 'image)) - -(use-package transmission - :defer t) - -(use-package sudo-edit - :defer t - :config - (setf sudo-edit-local-method "doas")) - -(use-package dabbrev - :defer t - :config - (setf dabbrev-ignored-buffer-regexps '("\\.\\(?:pdf\\|jpe?g\\|png\\)\\'"))) - -(use-package xref - :defer t - :config - (setf xref-show-xrefs-function #'consult-xref - xref-show-definitions-function #'consult-xref)) - -(use-package moc-player - :defer t - :straight '(moc-player :local-repo "~/Dev/emacs-lisp/moc-player") - :init (define-prefix-command 'thanos/mocp) - :bind (("C-z" . thanos/mocp) - :map thanos/mocp - ("SPC" . 'mocp-toggle-pause) - ("n" . 'mocp-next) - ("p" . 'mocp-previous))) - -;; My packages -(when (or is-zeus is-hermes) - (use-package yeetube - :init (define-prefix-command 'thanos/yeetube-map) - :straight (yeetube :local-repo "~/Dev/emacs-lisp/yeetube") - :ensure t - :config - (setf yeetube-results-limit 20 - yeetube-mpv-disable-video t - yeetube-display-thumbnails t - yeetube-play-function #'yeetube-mpv-play) - :bind (("C-c y" . 'thanos/yeetube-map) - :map thanos/yeetube-map - ("s" . 'yeetube-search) - ("b" . 'yeetube-play-saved-video) - ("d" . 'yeetube-download-videos) - ("C-d" . 'yeetube-download-vimeo-videos) - ("p" . 'yeetube-mpv-toggle-pause) - ("v" . 'yeetube-mpv-toggle-video) - ("V" . 'yeetube-mpv-toggle-no-video-flag) - ("C-p" . 'yeetube-mpv-toggle-video) - ("k" . 'yeetube-remove-saved-video))) - - (use-package gnosis - :straight (gnosis :local-repo "~/Dev/emacs-lisp/gnosis") - :ensure t - :init (define-prefix-command 'thanos/gnosis-map) - :config - (setf gnosis-vc-auto-push (when (or is-hermes - is-zeus) - t) - gnosis-mcq-display-choices nil - gnosis-image-width (if is-zeus 300 150) - gnosis-image-height (if is-zeus 300 150)) - (gnosis-modeline-mode) - :bind (("C-r" . thanos/gnosis-map) - :map thanos/gnosis-map - ("r" . 'gnosis-review) - ("a" . 'gnosis-add-note) - ("C-d" . 'gnosis-dashboard) - ("d" . 'gnosis-add-deck) - ("t" . 'gnosis-test-start))) - - ;; Run vc-pull on startup - (gnosis-vc-pull) - - (use-package pcmpl-emerge - :defer t - :straight (pcmpl-emerge :local-repo "~/Dev/emacs-lisp/pcmpl-emerge")) - - (use-package pcmpl-rc - :straight (pcmpl-rc :local-repo "~/Dev/emacs-lisp/pcmpl-rc") - :defer t) - - (use-package pcmpl-tailscale - :straight (pcmpl-tailscale :local-repo "~/Dev/emacs-lisp/pcmpl-taiscale") - :defer t)) - -;; Emacs dev - -(use-package package-lint - :defer t) - -;; AI tools -(use-package gptel - :defer t - :config - (setf gptel-api-key (password-store-get-field "openai/openai@thanosapollo.org" "api") - gptel-default-mode 'org-mode) - (setq-default gptel-model "zephyr:latest" - gptel-backend (gptel-make-ollama "Ollama" - :host "zeus:11434" - :stream t - :models '("llama2:latest" "zephyr:latest" "codellama:latest" - "mistral:latest" "mixtral:latest" "neural-chat:latest" - "dolphin-mixtral:latest")) - gptel-directives '((default . "You are a large language model living in Emacs and a helpful assistant. Respond concisely.") - (programming . "You are a large language model and a careful programmer. Provide code and only code as output without any additional text, prompt or note.") - (epictetus . "You are Epictetus, the stoic philosopher from Nicopolis. Respond concisely as Epictetus.") - (med . "You are a medical professor within the Emacs. Respond concisely.") - (code-review . "You are an expert programmer within Emacs reviewing code. Respond concisely") - (writer . "You are an expert writer and FOSS enthusiast. Improve only the article sections provided as a hacker, do not add extra paragraphs."))) - :bind (("C-c g" . 'gptel-send) - :map gptel-mode-map - ("C-c h" . 'gptel-menu))) - -(use-package copilot - :straight (copilot :host github :repo "zerolfx/copilot.el" :files ("dist" "*.el")) - :bind (:map copilot-mode-map - ("M-TAB" . 'copilot-accept-completion-by-line) - ("C-M-" . 'copilot-accept-completion-by-word) - ("C-M-n" . 'copilot-next-completion) - ("C-M-p" . 'copilot-previous-completion))) - - -;; Password-store -(require 'password-store) -(defun thanos/pass-launcher () - "Launch Emacs as a front-end for pass." - (interactive) - (unwind-protect - (with-selected-frame - (make-frame '((name . "thanos/pass-launcher") - (fullscreen . 0) - (undecorated . t) - (minibuffer . only) - (width . 70) - (height . 15))) - (let* ((choice (completing-read "Choose an action: " - '("AUTO" "COPY PASS" "COPY USERNAME" "EDIT" "GENERATE"))) - (action (pcase choice - ("AUTO" #'(lambda (entry) (let ((user (password-store-get-field entry "user")) - (pass (password-store-get entry))) - (start-process-shell-command - "xdotool" nil - (format "sleep 0.3 && xdotool getactivewindow type %s && xdotool key Tab && xdotool getactivewindow type %s" - (shell-quote-argument (if user user "thanosapollo")) - (shell-quote-argument pass)))))) - ("COPY PASS" #'password-store-copy) - ("COPY USERNAME" #'(lambda (entry) (password-store-copy-field entry "user"))) - ("EDIT" #'password-store-edit) - ("GENERATE" #'password-store-generate)))) - (funcall action (completing-read "Search: " (password-store-list))) - (delete-frame))))) - -(defun smtp-get-pass () - "Get password for smtp." - (interactive) - (password-store-copy-field "fastmail.com/thanosapollo@fastmail.com" "smtp")) - - -(use-package password-store - :init (define-prefix-command 'thanos/pass) - :defer t - :config - (setf password-store-password-length (+ 20 (random 20))) - :bind (("C-c p" . 'thanos/pass) - :map thanos/pass - ("i" . 'password-store-insert) - ("e" . 'password-store-edit) - ("g" . 'password-store-generate) - ("c" . 'password-store-copy) - ("s" . 'smtp-get-pass))) - -(use-package package-lint - :defer t) - -(use-package consult-mu - :straight (consult-mu :type git :host github :repo "armindarvish/consult-mu" :files (:defaults "extras/*.el")) - :after (mu4e consult) - :bind (:map mu4e-main-mode-map - ("M-s" . 'consult-mu) - :map mu4e-view-mode-map - ("M-s" . 'consult-mu) - :map mu4e-headers-mode-map - ("M-s" . 'consult-mu))) - -(require 'thanos-commands) ;; Misc commands -(when (or is-zeus is-hermes) - (require 'thanos-mu4e)) - -;;; init.el ends here diff --git a/.emacs.d/insert/python.template b/.emacs.d/insert/python.template deleted file mode 100644 index 63f77b6..0000000 --- a/.emacs.d/insert/python.template +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env python3 - diff --git a/.emacs.d/modules/thanos-commands.el b/.emacs.d/modules/thanos-commands.el deleted file mode 100644 index af9603f..0000000 --- a/.emacs.d/modules/thanos-commands.el +++ /dev/null @@ -1,295 +0,0 @@ -;;; thanos-commands.el --- custom commands/functions -*- lexical-binding: t; -*- - -;; Copyright (C) 2023 Thanos Apollo - -;; Author: Thanos Apollo -;; 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 . - -;;; Commentary: -;; ╭━━━━┳╮╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━━━╮╱╱╱╱╱╭╮╭╮╱╱╱╱╱╱╱╱╭━━━╮ -;; ┃╭╮╭╮┃┃╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃╭━╮┃╱╱╱╱╱┃┃┃┃╱╱╱╱╱╱╱╱┃╭━━╯ -;; ╰╯┃┃╰┫╰━┳━━┳━╮╭━━┳━━╮┃┃╱┃┣━━┳━━┫┃┃┃╭━━╮╱╱╱╱┃╰━━┳╮╭┳━━┳━━┳━━╮ -;; ╱╱┃┃╱┃╭╮┃╭╮┃╭╮┫╭╮┃━━┫┃╰━╯┃╭╮┃╭╮┃┃┃┃┃╭╮┃╭━━╮┃╭━━┫╰╯┃╭╮┃╭━┫━━┫ -;; ╱╱┃┃╱┃┃┃┃╭╮┃┃┃┃╰╯┣━━┃┃╭━╮┃╰╯┃╰╯┃╰┫╰┫╰╯┃╰━━╯┃╰━━┫┃┃┃╭╮┃╰━╋━━┃ -;; ╱╱╰╯╱╰╯╰┻╯╰┻╯╰┻━━┻━━╯╰╯╱╰┫╭━┻━━┻━┻━┻━━╯╱╱╱╱╰━━━┻┻┻┻╯╰┻━━┻━━╯ -;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃┃ -;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰╯ -;;; Code: - -;; VM -(defvar vm-directory "~/Virtual/") - -(defun vm-create-image () - "Create qcow2 image." - (interactive) - (let ((name (format "%s%s.qcow2" vm-directory (read-string "Name: "))) - (size (format "%s" (read-string "Size(G): ")))) - (shell-command - (format "qemu-img create -f qcow2 %s %sG" name size)))) - - -(defun vm-run () - "Spawn Virtual Machine." - (interactive) - (let ((memory (format "%sG" (read-string "Memory(G): "))) - (cores (read-string "Cores: ")) - (image (read-file-name "Image: " vm-directory)) - (iso (if (y-or-n-p "Load iso? ") - (read-file-name "ISO: ") - nil))) - (async-shell-command - (format "qemu-system-x86_64 -enable-kvm -m %s -smp %s -hda %s -vga virtio -device virtio-serial-pci -netdev user,id=vmnic,hostfwd=tcp::2222-:22 -device e1000,netdev=vmnic %s" - memory cores image (if iso (concat "-cdrom " iso) ""))))) - -;; MISC - -(defun thanos/run-in-background (command) - "Run COMMAND in the background." - (let ((command-parts (split-string command "[ ]+"))) - (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts))))) - -(defun thanos/emacs-keys () - "Swap caps with ctrl." - (interactive) - (start-process-shell-command - "setxkbmap" nil "setxkbmap us -option ctrl:swapcaps")) - -(defun thanos/center-buffer () - (interactive) - (set-fringe-mode - (/ (- (frame-pixel-width) - (* 150 (frame-char-width))) - 2))) - -(defun thanos/git-clone (repository) - "Clone git REPOSITORY." - (interactive (list (read-string "repo: "))) - (call-process-shell-command - (concat "git clone " (shell-quote-argument repository)) nil 0)) - -;; CREATE - -(defun create-text-scratch () - "Create a scratch buffer." - (interactive) - (switch-to-buffer (get-buffer-create "*Text Scratch*")) - (org-mode)) - -(defun create-scratch () - "Create scratch buffer." - (interactive) - (switch-to-buffer (get-buffer-create "*scratch*")) - (emacs-lisp-mode)) - -(defvar-keymap thanos/create-map - :doc "Create custom buffers" - "t" #'create-text-scratch - "e" #'create-scratch) - -;; THEMING -(defvar wallpapers-dir "~/wallpapers/") - -(defun thanos/load-theme (&optional theme) - "Disable current theme and load a new THEME." - (interactive) - (let ((theme (or theme (intern (completing-read "Theme: " (custom-available-themes)))))) - (disable-theme (car custom-enabled-themes)) - (load-theme theme t))) - -(defun thanos/wallpaper-set (image) - "Set IMAGE as wallpaper, using feh." - (let ((command (if is-zeus "xwallpaper --output DisplayPort-1 --stretch" "feh --bg-scale"))) - (call-process-shell-command (concat command " " 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))) - -(defvar-keymap thanos/applications-map - :doc "Thanos commonly used programs" - "t" #'thanos/load-theme - "w" #'thanos/wallpaper-select - "C-c" thanos/create-map) - -(define-key global-map (kbd "C-c a") thanos/applications-map) - - -(defun dired-watch-video () - "Watch play file with mpv." - (interactive) - (call-process-shell-command - (format "mpv \"%s\"" (dired-get-filename)) nil 0)) - -(defun dired-set-wallpaper () - "Set NAME as wallpaper using feh." - (interactive) - (let ((command (if is-zeus "xwallpaper --output DisplayPort-1 --stretch" "feh --bg-scale"))) - (call-process-shell-command - (format "%s %s" command (dired-get-filename)) nil 0))) - -(defun dired-delete-files-except () - "Delete all files inside directory except match." - (interactive) - (let* ((directory (read-directory-name "Select directory: ")) - (files (directory-files directory t)) - (except-match (read-string "Except the ones that have: "))) - (dolist (file files) - (unless (or (string= "." (substring file -1)) - (string= ".." (substring file -2)) - (string-match except-match file)) - (dired-delete-file file t))))) - -(defun dired-delete-file-match () - "Delete all files inside directory except match." - (interactive) - (let* ((directory (read-directory-name "Select directory: ")) - (files (directory-files directory t)) - (match (read-string "Delete files that match: "))) - (dolist (file files) - (when (string-match-p match file) - (dired-delete-file file t))))) - -(defun dired-rename-capitalize-file () - "Capitalize the base name of the file at point in a Dired buffer." - (interactive) - (let* ((file (dired-get-file-for-visit)) - (new-file (capitalize (file-name-nondirectory file)))) - (if (string-prefix-p "." file) - (message "Skipping file starting with '.'") - (progn - (rename-file file (concat (file-name-directory file) new-file)) - (revert-buffer) - (message "Renamed %s to %s" file new-file))))) - -(defun thanos/0x0-upload-file () - "Update file to 0x0.st" - (interactive) - (async-shell-command (format "curl -F'file=@%s' https://0x0.st" (dired-get-filename)))) - -;; yeetube -(defun yeetube-download-videos-ffmpeg () - "Download videos using ffmpeg." - (interactive) - (let ((url "") - (name "") - (download-counter 1) - (stored-contents nil)) - ;; Read links and names until "q" is entered - (while (not (string= url "q")) - (setf url (read-string "Enter URL (q to quit): ")) - (unless (string= url "q") - (setf name (read-string (format "Custom name (download counter: %d) " download-counter))) - (push (cons url name) stored-contents) - (setf download-counter (1+ download-counter)))) - ;; Process the collected links and names - (dolist (pair stored-contents) - (let ((url (car pair)) - (name (cdr pair))) - (async-shell-command - (format - "ffmpeg -protocol_whitelist file,crypto,data,https,tls,tcp -stats -i '%s' -codec copy '%s.mp4'" - url name)))))) - -(defun yeetube-download-vimeo-videos () - "Download videos from vimeo services." - (interactive) - (let ((url "") - (name "") - (download-counter 1)) - (while (not (string= url "q")) - (setf url (read-string "Enter URL (q to quit): ")) - (unless (string= url "q") - (setf name (read-string (format "Custom name (download counter: %d) " download-counter))) - (setf download-counter (1+ download-counter)) - (call-process-shell-command - (format - "yt-dlp '%s' -o '%s'" - (replace-regexp-in-string "\\.json" ".m3u8" url) name) - nil 0))))) - -;; Input methods -(defvar thanos/input-methods - '("greek" "bulgarian-phonetic" "nil") - "List of input methods to toggle.") - -(defvar thanos/input-methods-index 0 - "Index of the next input method in `thanos/input-methods' to use.") - -(defun thanos/toggle-input-method () - "Switch to the next input method in `thanos/input-methods'." - (interactive) - (setf thanos/input-methods-index - (mod (1+ thanos/input-methods-index) (length thanos/input-methods))) - (let ((input-method (nth thanos/input-methods-index thanos/input-methods))) - (set-input-method (if (string= "nil" input-method) nil input-method)))) - -(defun thanos/toggle-input-method () - "Switch to the next input method in `thanos/input-methods'." - (interactive) - (setf thanos/input-methods-index - (mod (1+ thanos/input-methods-index) (length thanos/input-methods))) - (let ((input-method (nth thanos/input-methods-index thanos/input-methods))) - (set-input-method (if (string= "nil" input-method) nil input-method)))) - -(defun erc-libera () - "Login to liberachat with erc." - (interactive) - (erc :server (password-store-get-field "znc/admin" "server") - :port (password-store-get-field "znc/admin" "port") - :user (password-store-get-field "znc/admin" "user") - :password (password-store-get "znc/admin"))) - - -(defun thanos/iimage-mode-buffer (arg) - "Display images if ARG is non-nil, undisplay them otherwise." - (let ((image-path (cons default-directory iimage-mode-image-search-path)) - (edges (window-inside-pixel-edges (get-buffer-window))) - file) - (with-silent-modifications - (save-excursion - (dolist (pair iimage-mode-image-regex-alist) - (goto-char (point-min)) - (while (re-search-forward (car pair) nil t) - (when (and (setq file (match-string (cdr pair))) - (setq file (locate-file file image-path))) - (if arg - (add-text-properties - (match-beginning 0) (match-end 0) - `(display - ,(create-image file nil nil - :max-width 120 - :max-height 120) - keymap ,image-map - modification-hooks - (iimage-modification-hook))) - (remove-list-of-text-properties - (match-beginning 0) (match-end 0) - '(display modification-hooks)))))))))) - -(define-minor-mode thanos/iimage-mode nil - :group 'iimage :lighter " iImg" - (thanos/iimage-mode-buffer thanos/iimage-mode)) - -(provide 'thanos-commands) -;;; thanos-commands.el ends here diff --git a/.emacs.d/modules/thanos-mu4e.el b/.emacs.d/modules/thanos-mu4e.el deleted file mode 100644 index 77b2856..0000000 --- a/.emacs.d/modules/thanos-mu4e.el +++ /dev/null @@ -1,132 +0,0 @@ -;;; thanos-mu4e.el --- mu4e configuration -*- lexical-binding: t; -*- - -;; Copyright (C) 2023 Thanos Apollo - -;; Author: Thanos Apollo -;; Keywords: extensions - -;; 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 . - -;;; Commentary: -;; ╭━━━━┳╮╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━━━╮╱╱╱╱╱╭╮╭╮╱╱╱╱╱╱╱╱╭━━━╮ -;; ┃╭╮╭╮┃┃╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃╭━╮┃╱╱╱╱╱┃┃┃┃╱╱╱╱╱╱╱╱┃╭━━╯ -;; ╰╯┃┃╰┫╰━┳━━┳━╮╭━━┳━━╮┃┃╱┃┣━━┳━━┫┃┃┃╭━━╮╱╱╱╱┃╰━━┳╮╭┳━━┳━━┳━━╮ -;; ╱╱┃┃╱┃╭╮┃╭╮┃╭╮┫╭╮┃━━┫┃╰━╯┃╭╮┃╭╮┃┃┃┃┃╭╮┃╭━━╮┃╭━━┫╰╯┃╭╮┃╭━┫━━┫ -;; ╱╱┃┃╱┃┃┃┃╭╮┃┃┃┃╰╯┣━━┃┃╭━╮┃╰╯┃╰╯┃╰┫╰┫╰╯┃╰━━╯┃╰━━┫┃┃┃╭╮┃╰━╋━━┃ -;; ╱╱╰╯╱╰╯╰┻╯╰┻╯╰┻━━┻━━╯╰╯╱╰┫╭━┻━━┻━┻━┻━━╯╱╱╱╱╰━━━┻┻┻┻╯╰┻━━┻━━╯ -;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃┃ -;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰╯ -;;; Code: - -(require 'smtpmail) -(require 'server) - -(add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e/") -(require 'mu4e) - -(setf mu4e-get-mail-command "mbsync -a") - -(when (and is-zeus (server-running-p)) - (setf mu4e-update-interval (* 10 60))) - -(defun set-mu4e-context (context-name full-name mail-address signature) - "Return a mu4e context named CONTEXT-NAME with :match-func matching - folder name CONTEXT-NAME in Maildir. The context's `user-mail-address', - `user-full-name' and `mu4e-compose-signature'`smtpmail-smpt-server' is set to MAIL-ADDRESS - FULL-NAME SIGNATURE and SERVER respectively. - Special folders are set to context specific folders." - (let ((dir-name (concat "/" context-name))) - (make-mu4e-context - :name context-name - ;; we match based on the maildir of the message - :match-func - `(lambda (msg) - (when msg - (string-match-p - ,(concat "^" dir-name) - (mu4e-message-field msg :maildir)))) - :vars - `((user-mail-address . ,mail-address) - (user-full-name . ,full-name) - (mu4e-sent-folder . ,(concat dir-name "/Sent")) - (mu4e-drafts-folder . ,(concat dir-name "/Drafts")) - (mu4e-trash-folder . ,(concat dir-name "/Trash")) - (mu4e-trash-folder . ,(concat dir-name "/Starred")) - (mu4e-refile-folder . ,(concat dir-name "/Archive")) - (mu4e-compose-signature . ,signature))))) -;;Fixing duplicate UID errors when using mbsync and mu4e -(setf mu4e-change-filenames-when-moving t) - -(setf mu4e-maildir-shortcuts - '(("/Fastmail/Inbox" . ?i) - ("/Drafts" . ?d) - ("/Sent" . ?s) - ("/Fastmail/Emacs/dev" . ?e) - ("/MUSofia/[Gmail]/All Mail" . ?u) - ("/Fastmail/Gentoo" . ?g))) - -(setf mu4e-contexts - (list - (make-mu4e-context - :name "Public" - :match-func - (lambda (msg) - (when msg - (string-prefix-p "/Fastmail" (mu4e-message-field msg :maildir)))) - :vars '((user-mail-address . "public@thanosapollo.org") - (user-full-name . "Thanos Apollo") - (smtpmail-smtp-server . "smtp.fastmail.com") - (smtpmail-smtp-service . 465) - (smtpmail-stream-type . ssl) - (mu4e-drafts-folder . "/Drafts") - (mu4e-sent-folder . "/Sent") - (mu4e-refile-folder . "/Archive") - (mu4e-trash-folder . "/Trash"))) - (make-mu4e-context - :name "MUSofia" - :match-func - (lambda (msg) - (when msg - (string-prefix-p "/MUSofia" (mu4e-message-field msg :maildir)))) - :vars '((user-mail-address . "104111@students.mu-sofia.bg") - (user-full-name . "Thanos Apollo") - (smtpmail-smtp-server . "smtp.gmail.com") - (smtpmail-smtp-service . 465) - (smtpmail-stream-type . ssl))))) - -(setf message-send-mail-function 'smtpmail-send-it - mu4e-compose-signature "\nThanos Apollo\n \nhttps://thanosapollo.org\n -62B7 58D0 F671 9938 BC09 CECA 339F 736C 3A72 0928\n" - mu4e-compose-context-policy 'ask) - -(setf mu4e-view-actions - (delete-dups - (append - '(("gapply git patches" . mu4e-action-git-apply-patch) - ("mgit am patch" . mu4e-action-git-apply-mbox) - ("bb4 am patch" . mu4e-action-git-apply-b4) - ("ssetup reword list with b4" . mu4e-action-setup-reword-b4) - ("crun checkpatch script" . my-mu4e-action-run-check-patch) - ("MCheck if merged" . my-mu4e-action-check-if-merged))))) - -(add-hook 'mu4e-main-mode-hook #'(lambda () - (display-line-numbers-mode -1) - (auto-save-mode -1))) -;; Sign messages -(add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime) - -(define-key global-map (kbd "C-x m") 'mu4e) - -(provide 'thanos-mu4e) -;;; thanos-mu4e.el ends here diff --git a/.emacs.d/modules/thanos-pass.el b/.emacs.d/modules/thanos-pass.el deleted file mode 100644 index 0e996f6..0000000 --- a/.emacs.d/modules/thanos-pass.el +++ /dev/null @@ -1,91 +0,0 @@ -;;; thanos-pass.el --- Pass configuration -*- lexical-binding: t; -*- - -;; Copyright (C) 2023 Thanos Apollo - -;; Author: Thanos Apollo - -;; 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 . - -;;; Commentary: -;; ╭━━━━┳╮╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━━━╮╱╱╱╱╱╭╮╭╮╱╱╱╱╱╱╱╱╭━━━╮ -;; ┃╭╮╭╮┃┃╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃╭━╮┃╱╱╱╱╱┃┃┃┃╱╱╱╱╱╱╱╱┃╭━━╯ -;; ╰╯┃┃╰┫╰━┳━━┳━╮╭━━┳━━╮┃┃╱┃┣━━┳━━┫┃┃┃╭━━╮╱╱╱╱┃╰━━┳╮╭┳━━┳━━┳━━╮ -;; ╱╱┃┃╱┃╭╮┃╭╮┃╭╮┫╭╮┃━━┫┃╰━╯┃╭╮┃╭╮┃┃┃┃┃╭╮┃╭━━╮┃╭━━┫╰╯┃╭╮┃╭━┫━━┫ -;; ╱╱┃┃╱┃┃┃┃╭╮┃┃┃┃╰╯┣━━┃┃╭━╮┃╰╯┃╰╯┃╰┫╰┫╰╯┃╰━━╯┃╰━━┫┃┃┃╭╮┃╰━╋━━┃ -;; ╱╱╰╯╱╰╯╰┻╯╰┻╯╰┻━━┻━━╯╰╯╱╰┫╭━┻━━┻━┻━┻━━╯╱╱╱╱╰━━━┻┻┻┻╯╰┻━━┻━━╯ -;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃┃ -;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰╯ -;;; Code: - -(require 'password-store) - -(setf password-store-password-length (+ 20 (random 20))) - -(defun thanos/pass-launcher () - "Launch Emacs as a front-end for pass." - (interactive) - (unwind-protect - (with-selected-frame - (make-frame '((name . "thanos/pass-launcher") - (fullscreen . 0) - (undecorated . t) - (minibuffer . only) - (width . 70) - (height . 15))) - (let* ((choice (completing-read "Choose an action: " - '("AUTO" "COPY PASS" "COPY USERNAME" "EDIT" "GENERATE"))) - (action (pcase choice - ("AUTO" #'(lambda (entry) (let ((user (password-store-get-field entry "user")) (pass (password-store-get entry))) - (start-process-shell-command - "xdotool" nil - (format "sleep 0.3 && xdotool getactivewindow type '%s' && xdotool getactivewindow key Tab && xdotool getactivewindow type '%s'" - (if user user 'thanosapollo) pass))))) - ("COPY PASS" #'password-store-copy) - ("COPY USERNAME" #'(lambda (entry) (password-store-copy-field entry "user"))) - ("EDIT" #'password-store-edit) - ("GENERATE" #'password-store-generate)))) - (funcall action (completing-read "Search: " (password-store-list))) - (delete-frame))))) - -(defun smtp-get-pass () - "Get password for smtp." - (interactive) - (password-store-copy-field "fastmail.com/thanosapollo@fastmail.com" "smtp")) - -(define-prefix-command 'thanos/pass) -(global-set-key (kbd "C-c p") 'thanos/pass) -(define-key thanos/pass (kbd "i") 'password-store-insert) -(define-key thanos/pass (kbd "e") 'password-store-edit) -(define-key thanos/pass (kbd "g") 'password-store-generate) -(define-key thanos/pass (kbd "c") 'password-store-copy) -(define-key thanos/pass (kbd "s") 'smtp-get-pass) - -(defun thanos/app-launcher () - "Launch Emacs as an Application Launcher." - (interactive) - (let ((ivy-height 100)) - (unwind-protect - (with-selected-frame - (make-frame '((name . "thanos/emacs-launcher") - (minibuffer . only) - (fullscreen . 0) - (undecorated . t) - (internal-border-width . 10) - (width . 80) - (height . 11))) - (counsel-linux-app) - (delete-frame))))) - -(provide 'thanos-pass) -;;; thanos-pass.el ends here diff --git a/emacs.el b/emacs.el new file mode 100644 index 0000000..f9df16d --- /dev/null +++ b/emacs.el @@ -0,0 +1,1280 @@ +;;; emacs.el --- Welcome to my Emacs configuration! -*- lexical-binding: t; -*- + +;; Copyright (C) 2023 Thanos Apollo + +;; Author: Thanos Apollo + +;; 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 . + +;;; Commentary: +;; ╭━━━━┳╮╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━━━╮╱╱╱╱╱╭╮╭╮╱╱╱╱╱╱╱╱╭━━━╮ +;; ┃╭╮╭╮┃┃╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃╭━╮┃╱╱╱╱╱┃┃┃┃╱╱╱╱╱╱╱╱┃╭━━╯ +;; ╰╯┃┃╰┫╰━┳━━┳━╮╭━━┳━━╮┃┃╱┃┣━━┳━━┫┃┃┃╭━━╮╱╱╱╱┃╰━━┳╮╭┳━━┳━━┳━━╮ +;; ╱╱┃┃╱┃╭╮┃╭╮┃╭╮┫╭╮┃━━┫┃╰━╯┃╭╮┃╭╮┃┃┃┃┃╭╮┃╭━━╮┃╭━━┫╰╯┃╭╮┃╭━┫━━┫ +;; ╱╱┃┃╱┃┃┃┃╭╮┃┃┃┃╰╯┣━━┃┃╭━╮┃╰╯┃╰╯┃╰┫╰┫╰╯┃╰━━╯┃╰━━┫┃┃┃╭╮┃╰━╋━━┃ +;; ╱╱╰╯╱╰╯╰┻╯╰┻╯╰┻━━┻━━╯╰╯╱╰┫╭━┻━━┻━┻━┻━━╯╱╱╱╱╰━━━┻┻┻┻╯╰┻━━┻━━╯ +;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃┃ +;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰╯ +;;; Code: + +(setf user-full-name "Thanos Apollo" + user-mail-address "public@thanosapollo.org") + +(defvar is-zeus (equal (system-name) "zeus")) +(defvar is-hermes (equal (system-name) "hermes")) +(defvar is-phone (equal (system-name) "localhost")) + +;; Autoinsert +(auto-insert-mode 1) + +(setq auto-insert-alist '((python-mode . "python.template")) + auto-insert-directory (locate-user-emacs-file "insert")) + +(add-to-list 'completion-styles 'initials t) + +(setf tab-always-indent 'complete) + +;; xref +(setf xref-show-xrefs-function #'consult-xref + xref-show-definitions-function #'consult-xref) + +;; Set and load custom.el +(setf custom-file (locate-user-emacs-file "custom.el")) +(load custom-file 'noerror) + +;; Enable use-package support for imenu +(setf use-package-enable-imenu-support t) + +;; Install straight.el +(defvar bootstrap-version) + +(let ((bootstrap-file + (expand-file-name + "straight/repos/straight.el/bootstrap.el" + (or (bound-and-true-p straight-base-dir) + user-emacs-directory))) + (bootstrap-version 7)) + (unless (file-exists-p bootstrap-file) + (with-current-buffer + (url-retrieve-synchronously + "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" + 'silent 'inhibit-cookies) + (goto-char (point-max)) + (eval-print-last-sexp))) + (load bootstrap-file nil 'nomessage)) + +(setq package-enable-at-startup nil) + +(require 'straight) + +(setf straight-use-package-by-default t) + +(setf straight-recipe-overrides + '((transmission :type git :host nil :repo "git@thanosapollo.org:/var/git/transmission.git") + ;; (yeetube :type git :host nil :repo "git@thanosapollo.org:/var/git/yeetube.git") + (gnosis :type git :host nil :repo "git@thanosapollo.org:/var/git/gnosis.git") + (pcmpl-emerge :type git :host nil :repo "git@thanosapollo.org:/var/git/pcmpl-emerge.git") + (pcmpl-rc :type git :host nil :repo "git@thanosapollo.org:/var/git/pcmpl-rc.git"))) + +(use-package emacs + :straight nil + :ensure t + :config + + (setf browse-url-browser-function 'browse-url-generic + browse-url-generic-program "icecat" + backup-directory-alist '((".*" . "~/.Trash")) + sentence-end-double-space t + default-input-method "bulgarian-phonetic" + gc-cons-threshold 5000000 + disabled-command-function nil ;; Enable all commands + url-privacy-level 'high + calendar-date-style 'european) + (if is-zeus + (display-battery-mode 0) + (display-battery-mode 1)) + + ;; use ssh for tramp, faster for small files + (setf tramp-default-method "ssh") + + (savehist-mode) + (save-place-mode 1) + (recentf-mode 1) + (electric-pair-mode 1) + :bind (("M-" . 'backward-kill-sexp) + ("C-c L" . 'display-line-numbers-mode) + ("C-z" . nil) + ("C-c r" . 'rename-visited-file)) + :hook ((emacs-lisp-mode . prettify-symbols-mode) + (lisp-mode . prettify-symbols-mode))) + +(use-package dired + :straight nil + :ensure nil + :config + (defun dired-watch-video () + "Watch play file with mpv." + (interactive) + (call-process-shell-command + (format "mpv \"%s\"" (dired-get-filename)) nil 0)) + + (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))) + + (defun dired-delete-files-except () + "Delete all files inside directory except match." + (interactive) + (let* ((directory (read-directory-name "Select directory: ")) + (files (directory-files directory t)) + (except-match (read-string "Except the ones that have: "))) + (dolist (file files) + (unless (or (string= "." (substring file -1)) + (string= ".." (substring file -2)) + (string-match except-match file)) + (dired-delete-file file t))))) + + (defun dired-delete-file-match () + "Delete all files inside directory except match." + (interactive) + (let* ((directory (read-directory-name "Select directory: ")) + (files (directory-files directory t)) + (match (read-string "Delete files that match: "))) + (dolist (file files) + (when (string-match-p match file) + (dired-delete-file file t))))) + + (defun dired-rename-capitalize-file () + "Capitalize the base name of the file at point in a Dired buffer." + (interactive) + (let* ((file (dired-get-file-for-visit)) + (new-file (capitalize (file-name-nondirectory file)))) + (if (string-prefix-p "." file) + (message "Skipping file starting with '.'") + (progn + (rename-file file (concat (file-name-directory file) new-file)) + (revert-buffer) + (message "Renamed %s to %s" file new-file))))) + :bind ((:map + dired-mode-map + ("b" . 'dired-up-directory) + ("v" . 'dired-watch-video) + ("z" . 'wdired-change-to-wdired-mode) + ("C-c w" . 'dired-set-wallpaper) + ("C-c d" . 'dired-delete-files-except) + ("C-c r" . 'dired-do-query-replace-regexp)))) + +(defun theme-invisible-dividers (_theme) + "Make window dividers for THEME invisible." + (let ((bg (face-background 'default))) + (custom-set-faces + `(fringe ((t :background ,bg :foreground ,bg))) + `(window-divider ((t :background ,bg :foreground ,bg))) + `(window-divider-first-pixel ((t :background ,bg :foreground ,bg))) + `(window-divider-last-pixel ((t :background ,bg :foreground ,bg)))))) + +(add-hook 'enable-theme-functions #'theme-invisible-dividers) + +;;;; Theming ;;;; +(setf inhibit-startup-message t + initial-scratch-message nil) + +(blink-cursor-mode -1) +(global-visual-line-mode 0) + +(setf visible-bell nil + display-line-numbers-type 'relative) + +(column-number-mode) +(global-display-line-numbers-mode 1) + +;; Transparency +(add-to-list 'default-frame-alist '(alpha-background . 85)) + +;; theming +;; (global-hl-line-mode) +(global-visual-line-mode) + +(defun thanos/terminal-theming () + "Customize theming when laucning Emacs as TUI." + (unless (display-graphic-p (selected-frame)) + (set-face-background 'default "unspecified-bg" (selected-frame)) + (global-hl-line-mode 0))) + +(add-hook 'window-setup-hook 'thanos/terminal-theming) + +(when (equal is-phone nil) + (scroll-bar-mode -1) + (set-fringe-mode 10)) + +(tool-bar-mode -1) +(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-log-done 'time + org-hide-emphasis-markers nil ;;change to t to hide emphasis markers + org-table-convert-region-max-lines 20000 + org-log-done 'time + org-todo-keywords '((sequence "TODO(t)" "SEMINAR(s)" "LECTURE(l)" "DONE(d)"))) + + (setf org-structure-template-alist + '(("e" . "src emacs-lisp") + ("p" . "src python") + ("l" . "src lisp") + ("b" . "src bash") + ("q" . "QUOTE"))) + + :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)))) + +(defun org-insert-book () + "Insert org-link from ~/Library for book." + (interactive) + (let* ((book-path (read-file-name "Book: " "~/Library/"))) + (org-insert-link nil book-path (file-name-base book-path)))) + +(use-package org-modern + :ensure t + :config + (setf org-modern-table nil + org-modern-todo nil + org-modern-tag nil) + :hook ((org-mode . org-modern-mode))) + +;; Create notes directory for org-roam +(unless (file-exists-p "~/Notes") + (make-directory "~/Notes")) + +(use-package org-roam + :straight nil + :defer t + :init + (define-prefix-command 'thanos/notes-map) + :config + (setf org-roam-directory "~/Notes" + org-roam-dailies-directory "daily/") + + (org-roam-db-autosync-enable) + + (setf org-roam-node-display-template + (concat "${title:50} "(propertize "${tags:30}" 'face 'org-tag))) + + (setf org-roam-db-node-include-function + (lambda () + (not (or (member "journal" (org-get-tags)) + (member "dailies" (org-get-tags)))))) + ;; Templates + (setf org-roam-capture-templates + '(("d" "default" plain + "%?" + :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+startup: overview\n") + :unnarrowed t) + ("p" "MUS" plain "* Goals\n\n%?\n\n* Tasks\n\n** TODO Add initial tasks\n\n* Dates\n\n" + :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: MUS") + :unnarrowed t)) + org-roam-dailies-capture-templates + '(("d" "default" entry + "* %?" + :target (file+head "%<%Y-%m-%d>.org" + "#+title: %<%Y-%m-%d>\n#+filetags: :journal:\n")) + ("j" "journal" plain + "\n* Daily Notes\n\n* Goals\n+ []\n\n* Extras %?" + :target (file+head "%<%Y-%m-%d>.org" + "#+title: %<%Y-%m-%d>\n#+filetags: :journal:\n")))) + + (defun org-roam-ref-add-book () + "Insert org-link from Library." + (interactive) + (let ((book (format "file:%s" (read-file-name "Book: " (if is-zeus "/hdd/Library/" "~/Library/"))))) + book)) + + (defun org-roam-sync-notes () + "Sync org-oram notes" + (interactive) + (let ((git (executable-find "git")) + (default-directory org-roam-directory)) + (message "Synching org-roam notes %s" org-roam-directory) + (unless git + (error "Git not found, please install `git'")) + (unless (file-exists-p (expand-file-name ".git" gnosis-dir)) + (message "Creating git repository") + (vc-create-repo 'Git)) + (shell-command "git pull") + (shell-command (format "%s %s" git "add .")) + (shell-command (format "%s %s %s" git "commit -m" (shell-quote-argument "Update org-roam notes"))) + (vc-git-push nil)) + (funcall 'org-roam-db-sync)) + + :bind (("C-c n" . thanos/notes-map) + :map thanos/notes-map + ("t" . org-roam-buffer-toggle) + ("f" . org-roam-node-find) + ("i" . org-roam-node-insert) + ("d" . org-roam-dailies-goto-today) + ("D" . org-roam-dailies-goto-date) + :map org-mode-map + ("C-c C-." . org-roam-tag-add) + ("C-c i" . org-id-get-create))) + +(use-package org-roam-ui + :defer t) + +;; (use-package jabber +;; :defer t) + +(use-package modus-themes + :straight t + :config + (setf modus-themes-italic-constructs nil + modus-themes-bold-constructs nil + modus-themes-mixed-fonts nil + modus-themes-variable-pitch-ui nil + modus-themes-custom-auto-reload t + modus-themes-disable-other-themes t + modus-themes-prompts '(italic) + modus-themes-completions '((matches . (extrabold)) + (selection . (semibold italic text-also underline))) + 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) + ;; (bg-main "#1d2021") ;;grubox-hard + ;; (bg-main "#191919") ;; 1337 + ;; (bg-main "#1d1f21") ;; tomorrow night + ;; (bg-main "#151515") ;; jazz + (bg-main "#0C0C0C") ;; random black + ;; (bg-main "#171717") ;; badger + ;; (overline-heading-1 gold) + (fg-heading-1 red-warmer) + ;; (bg-heading-1 bg-blue-nuanced) + (bg-line-number-inactive unspecified) + (bg-line-number-active unspecified) + (bg-paren-match bg-magenta-intense) + (underline-paren-match fg-main) + (underline-err red-intense) + (underline-warning yellow-faint) + (underline-note cyan-faint) + (string "#86B187") + (border-mode-line-active unspecified) + (border-mode-line-inactive unspecified) + (bg-mode-line-active "#433F4f") ;; subtle lavender + (bg-mode-line-inactive "#1D1D1D") + ;; set fg from badger theme + (fg-mode-line-active "#F6F3E8") + (bg-hl-line bg-dim) + (cursor slate) + (prose-todo green-intense) + (prose-done bg-term-white) + (fg-prompt yellow-faint) + ,@modus-themes-preset-overrides-intense)) + ;; Headings + (setf modus-themes-headings + '((1 . (ultrabold 1.35)) + (2 . (semibold 1.2)) + (agenda-date . (1.3)) + (agenda-structure . (variable-pitch light 1.8)) + (t . (1.15)))) + ;; Load modus + (load-theme 'modus-vivendi t)) + +(use-package vertico + :ensure t + :config + (vertico-mode)) + +(use-package marginalia + :ensure t + :config + (marginalia-mode)) + +(use-package consult + :straight nil + :ensure t + :init (define-prefix-command 'thanos/search) + :bind (("C-x r d" . 'bookmark-delete) + ("C-x r C-r" . 'bookmark-rename) + ("C-x r C-j" . 'consult-register) + ("C-x r SPC" . 'consult-register-store) + ("C-x r b" . 'consult-bookmark) + ("C-c m" . 'consult-imenu) + ("C-x b" . 'consult-buffer) + ("M-y" . 'consult-yank-from-kill-ring) + ("C-s" . 'thanos/search) + :map thanos/search + ("f" . 'isearch-forward) + ("r" . 'isearch-backward) + ("s" . 'consult-line) + ("i" . 'change-inner) + ("C-f" . 'consult-find) + ("C-g" . 'consult-grep) + ("C-i" . 'consult-info) + ("C-l" . 'consult-locate) + :map project-prefix-map + ("b" . 'consult-project-buffer))) + +(use-package which-key + :ensure t + :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 + (setf elfeed-search-filter "@1-week-ago +unread -hackernoon" + browse-url-browser-function #'browse-url-default-browser) + ;; Feeds + (setf elfeed-feeds + '(("https://hackaday.com/blog/feed/" + hackaday linux) + ("https://thanosapollo.org/index.xml" + thanos) + ("http://wikileaks.org/feed" + wikileaks) + ("https://hackernoon.com/feed" + hackernoon) + ("https://torrentfreak.com/feed" + torrentfreak piracy) + ("https://www.science.org/action/showFeed?type=etoc&feed=rss&jc=sciimmunol" + science) + ("https://rss-bridge.thanosapollo.org/?action=display&bridge=CssSelectorBridge&home_page=https%3A%2F%2Fwww.medscape.com%2Findex%2Flist_13470_0&url_selector=a.title&url_pattern=viewarticle%2F.*&content_selector=div.article__main-content&content_cleanup=&title_cleanup=+-+Index&limit=&format=Atom" medscape med) + ("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://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))) + :bind (("C-x f" . elfeed) + :map elfeed-search-mode-map + ("v" . 'elfeed-mpv) + ("U" . 'elfeed-update)) + :hook ((elfeed-search-mode . (lambda () (display-line-numbers-mode 0))))) + +;; Python +(use-package python-mode + :defer t + :config + (add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))) + +(use-package pyenv + :defer t) + +(use-package elpy + :straight nil + :ensure nil + :init + (elpy-enable)) + +;; Clojure +(use-package cider + :defer t) + +(use-package clojure-mode + :defer t) + +(use-package rainbow-delimiters + :defer t + :hook ((emacs-lisp-mode . rainbow-delimiters-mode) + (lisp-mode . rainbow-delimiters-mode) + (clojure-mode . rainbow-delimiters-mode) + (scheme-mode . rainbow-delimiters-mode))) + +;; (use-package paredit +;; :ensure t +;; :hook ((emacs-lisp-mode . paredit-mode) +;; (lisp-mode . paredit-mode) +;; (clojure-mode . paredit-mode) +;; (scheme-mode . paredit-mode))) + +(use-package sly + :init (setf inferior-lisp-program "sbcl") + :defer t) + +(use-package helpful + :defer t + :bind (("C-h f" . 'helpful-callable) + ("C-h v" . 'helpful-variable) + ("C-h k" . 'helpful-key) + ("C-h x" . 'helpful-command) + ("C-h ." . 'helpful-at-point) + ("C-h F" . 'helpful-function) + ("C-h C-k" . 'helpful-kill-buffers) + ("C-h a" . 'apropos) + ("C-h C-m" . 'info-apropos))) + +(use-package ox-hugo + :ensure t + :config + (setf org-hugo-section "post")) + +(use-package json-mode + :defer t + :config + (add-to-list 'auto-mode-alist '("\\.json'" . json-mode))) + +(defun project-magit () + "Run magit-status in the current project's root." + (interactive) + (magit-status-setup-buffer (project-root (project-current t)))) + +(use-package magit + :defer t + :config + (setf magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1) + :bind (:map project-prefix-map ("g" . 'project-magit))) + +(use-package corfu + :ensure t + :config + (global-corfu-mode) + (corfu-popupinfo-mode) + (setf corfu-auto t + corfu-auto-delay 0.1 + corfu-auto-prefix 2 + corfu-cycle t + corfu-popupinfo-delay 0.3 + corfu-quit-at-boundary 'separator + corfu-quit-no-match t + corfu-preselect 'first + corfu-preview-current t + corfu-echo-mode t) + (setf indent-tabs-mode nil)) + +(defun insert-brackets (&optional arg) + "Insert ARG brackets." + (interactive "P") + (insert-pair arg ?\[ ?\])) + +(global-set-key (kbd "C-x M-[") 'insert-brackets) + + +(use-package orderless + :init (add-to-list 'completion-styles 'initials t) + :ensure t + :config + (setf completion-category-overrides '((file (style basic partial-completion))) + completion-styles '(orderless) + completion-cycle-threshold 2)) + +(use-package pdf-tools + :straight nil + :ensure nil + :config + (add-to-list 'auto-mode-alist '("\\.pdf\\'" . pdf-view-mode)) + :hook + ((pdf-view-mode . (lambda () + (display-line-numbers-mode 0) + ;; Guix package emacs-pdf-tools does not enable + ;; minor modes automatically + (pdf-tools-enable-minor-modes))))) + +(use-package markdown-mode + :defer t + :config + (setq markdown-header-scaling t + markdown-command "multimarkdown") + (add-to-list 'auto-mode-alist '("\\.md\\'" . gfm-mode)) + :hook ((markdown-mode . flyspell-mode))) + +(use-package org-auto-tangle + :defer t) + +(use-package org-present + :defer t) + +(use-package expand-region + :defer t) + +(use-package change-inner + :after expand-region + :bind ((:map thanos/search ("i" . 'change-inner)))) + +(use-package nov + :straight nil + :defer t + :config + (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))) + +(use-package eshell-syntax-highlighting + :defer t) + +(use-package emojify + :ensure t + :hook (erc-mode . emojify-mode) + :commands emojify-mode) + +(use-package flycheck-package + :ensure t + :after flycheck) + +(use-package flycheck + :ensure t + :config + (setf flycheck-emacs-lisp-load-path 'inherit) + (global-flycheck-mode) + :hook ((emacs-lisp-mode . (lambda () (flycheck-mode) (flycheck-package-setup))))) + +;; Shells +(use-package vterm + :straight nil + :ensure nil + :bind (("C-c v" . vterm) + :map vterm-mode-map + ("M-&" . 'async-shell-command) + ("C-c C-y" . 'vterm-copy-mode)) + :hook + ((vterm-mode . (lambda () (display-line-numbers-mode -1))))) + +(use-package shell + :defer t + :bind (("C-c V" . shell) + :map shell-mode-map + ("C-l" . 'comint-clear-buffer)) + :hook ((shell-mode . (lambda () (display-line-numbers-mode -1))))) + +(defvar thanos/aliases + '((g . magit) + (gl . magit-log) + (gc . magit-clone) + (d . dired) + (o . find-file) + (oo . find-file-other-window) + (ll . (lambda () (eshell/ls '-lha))) + (eshell/clear . eshell/clear-scrollback))) + +(defun thanos/set-eshell-aliases (aliases) + "Set ALIASES as eshell aliases." + (mapc (lambda (alias) + (defalias (car alias) (cdr alias))) + aliases)) + +(use-package eshell + :config + (setf eshell-highlight-prompt t) + (eshell-syntax-highlighting-global-mode 1) + :bind (("C-c e" . eshell) + :map eshell-mode-map + ("C-l" . eshell/clear-scrollback)) + :hook ((eshell-mode . (lambda () + (thanos/set-eshell-aliases thanos/aliases) + (display-line-numbers-mode -1))))) + +(use-package eat + :after 'eshell + :config + (add-hook 'eshell-load-hook #'eat-eshell-mode) + (setf eat-term-name "xterm-256color")) + +(use-package eshell-git-prompt + :config + (defun eshell-git-prompt-multiline () + "Eshell Git prompt inspired by spaceship-prompt." + (let (separator hr dir git git-dirty time sign command) + (setq separator (with-face " | " 'eshell-git-prompt-multiline-secondary-face)) + (setq hr (with-face (concat "\n" (make-string (/ (window-total-width) 2) ?─) "\n") 'eshell-git-prompt-multiline-secondary-face)) + (setq dir + (concat + (with-face "" 'eshell-git-prompt-directory-face) + (concat (abbreviate-file-name (eshell/pwd))))) + (setq git + (concat (with-face "⎇" 'eshell-git-prompt-exit-success-face) + (concat (eshell-git-prompt--branch-name)))) + (setq git-dirty + (when (eshell-git-prompt--branch-name) + (if (eshell-git-prompt--collect-status) + (with-face " ✎" 'eshell-git-prompt-modified-face) + (with-face " ✔" 'eshell-git-prompt-exit-success-face)))) + (setq time (with-face (format-time-string "%I:%M:%S %p") 'eshell-git-prompt-multiline-secondary-face)) + (setq sign + (if (= (user-uid) 0) + (with-face "\n#" 'eshell-git-prompt-multiline-sign-face) + (with-face "\nλ" 'eshell-git-prompt-multiline-sign-face))) + (setq command (with-face " " 'eshell-git-prompt-multiline-command-face)) + + ;; Build prompt + (eshell-git-prompt---str-read-only + (concat hr dir separator git git-dirty separator time sign command)))) + + (eshell-git-prompt-use-theme 'multiline)) + +;; Chat +(use-package jabber + :defer t + :config + (defun jabber-buffers-formats (&optional buffer-formats) + "Return jabber BUFFER-FORMATS without the format specifiers. + +By default, returns all jabber related buffers format." + (let ((buffer-formats (or buffer-formats '(jabber-chat-buffer-format + jabber-browse-buffer-format + jabber-roster-buffer + jabber-groupchat-buffer-format + jabber-muc-private-buffer-format)))) + (cl-loop for var in buffer-formats + for str = (symbol-value var) + for formatted-str = (when (stringp str) + ;; Remove format specifier and + ;; the following 2 char, or 1 if + ;; there is not second. + (replace-regexp-in-string "%.?" "" str)) + collect formatted-str))) + + (defun jabber-switch-to-buffer () + "Prompt the user to select a buffer whose name matches a list of strings." + (interactive) + (let* ((string-list (jabber-buffers-formats)) + (buffers-matching-strings + (cl-loop for buf in (buffer-list) + when (cl-loop for str in string-list + thereis (string-match-p str (buffer-name buf))) + collect (buffer-name buf)))) + (if buffers-matching-strings + (switch-to-buffer + (completing-read "Select jabber buffer: " buffers-matching-strings))) + (error "No jabber buffer found"))) + :bind (:map jabber-global-keymap + ("C-b" . 'jabber-switch-to-buffer))) + +(use-package erc + :defer t + :config + (unless (expand-file-name "erc" user-emacs-directory) + (make-directory (expand-file-name "erc" user-emacs-directory))) + (setf erc-modules + '(sasl netsplit fill button match track completion readonly + networks ring autojoin noncommands irccontrols move-to-prompt stamp + menu list log notifications) + erc-log-channels-directory (expand-file-name "erc" user-emacs-directory)) + :bind (("C-c E" . 'erc-libera) + :map erc-mode-map + ("C-c RET" . 'erc-cmd-QUERY))) + +;; (use-package erc-image +;; :ensure t +;; :after erc +;; :config +;; (setq erc-image-inline-rescale 300) +;; (add-to-list 'erc-modules 'image)) + +(use-package transmission + :defer t) + +(use-package sudo-edit + :defer t + :config + (setf sudo-edit-local-method "sudo")) + +(use-package dabbrev + :defer t + :config + (setf dabbrev-ignored-buffer-regexps '("\\.\\(?:pdf\\|jpe?g\\|png\\)\\'"))) + +(use-package xref + :defer t + :config + (setf xref-show-xrefs-function #'consult-xref + xref-show-definitions-function #'consult-xref)) + +(use-package moc-player + :defer t + :straight '(moc-player :local-repo "~/Dev/emacs-lisp/moc-player") + :init (define-prefix-command 'thanos/mocp) + :bind (("C-z" . thanos/mocp) + :map thanos/mocp + ("SPC" . 'mocp-toggle-pause) + ("n" . 'mocp-next) + ("p" . 'mocp-previous))) + +;; My packages +(when (or is-zeus is-hermes) + (use-package yeetube + :init (define-prefix-command 'thanos/yeetube-map) + :straight nil + :ensure t + :config + (setf yeetube-results-limit 20 + yeetube-mpv-disable-video t + yeetube-display-thumbnails nil + yeetube-play-function #'yeetube-mpv-play) + + (defun yeetube-download-videos-ffmpeg () + "Download videos using ffmpeg." + (interactive) + (let ((url "") + (name "") + (download-counter 1) + (stored-contents nil)) + ;; Read links and names until "q" is entered + (while (not (string= url "q")) + (setf url (read-string "Enter URL (q to quit): ")) + (unless (string= url "q") + (setf name (read-string (format "Custom name (download counter: %d) " download-counter))) + (push (cons url name) stored-contents) + (setf download-counter (1+ download-counter)))) + ;; Process the collected links and names + (dolist (pair stored-contents) + (let ((url (car pair)) + (name (cdr pair))) + (async-shell-command + (format + "ffmpeg -protocol_whitelist file,crypto,data,https,tls,tcp -stats -i '%s' -codec copy '%s.mp4'" + url name)))))) + + (defun yeetube-download-vimeo-videos () + "Download videos from vimeo services." + (interactive) + (let ((url "") + (name "") + (download-counter 1)) + (while (not (string= url "q")) + (setf url (read-string "Enter URL (q to quit): ")) + (unless (string= url "q") + (setf name (read-string (format "Custom name (download counter: %d) " download-counter))) + (setf download-counter (1+ download-counter)) + (call-process-shell-command + (format + "yt-dlp '%s' -o '%s'" + (replace-regexp-in-string "\\.json" ".m3u8" url) name) + nil 0))))) + + :bind (("C-c y" . 'thanos/yeetube-map) + :map thanos/yeetube-map + ("s" . 'yeetube-search) + ("b" . 'yeetube-play-saved-video) + ("d" . 'yeetube-download-videos) + ("C-d" . 'yeetube-download-vimeo-videos) + ("p" . 'yeetube-mpv-toggle-pause) + ("v" . 'yeetube-mpv-toggle-video) + ("V" . 'yeetube-mpv-toggle-no-video-flag) + ("C-p" . 'yeetube-mpv-toggle-video) + ("k" . 'yeetube-remove-saved-video))) + + (use-package gnosis + :straight (gnosis :local-repo "~/Dev/emacs-lisp/gnosis") + :ensure t + :init (define-prefix-command 'thanos/gnosis-map) + :config + (setf gnosis-vc-auto-push t + gnosis-mcq-display-choices nil + gnosis-image-width nil + gnosis-image-height nil) + (gnosis-modeline-mode) + :bind (("C-r" . thanos/gnosis-map) + :map thanos/gnosis-map + ("r" . 'gnosis-review) + ("a" . 'gnosis-add-note) + ("C-d" . 'gnosis-dashboard) + ("d" . 'gnosis-add-deck) + ("t" . 'gnosis-test-start))) + + ;; Run vc-pull on startup + (gnosis-vc-pull) + + (use-package pcmpl-emerge + :defer t + :straight (pcmpl-emerge :local-repo "~/Dev/emacs-lisp/pcmpl-emerge")) + + (use-package pcmpl-rc + :straight (pcmpl-rc :local-repo "~/Dev/emacs-lisp/pcmpl-rc") + :defer t) + + (use-package pcmpl-tailscale + :straight (pcmpl-tailscale :local-repo "~/Dev/emacs-lisp/pcmpl-taiscale") + :defer t)) + +;; Emacs dev + +(use-package package-lint + :defer t) + +;; AI tools +(use-package gptel + :defer t + :config + (setf gptel-api-key (password-store-get-field "openai/openai@thanosapollo.org" "api") + gptel-default-mode 'org-mode) + (setq-default gptel-model "zephyr:latest" + gptel-backend (gptel-make-ollama "Ollama" + :host "zeus:11434" + :stream t + :models '("llama2:latest" "zephyr:latest" "codellama:latest" + "mistral:latest" "mixtral:latest" "neural-chat:latest" + "dolphin-mixtral:latest")) + gptel-directives '((default . "You are a large language model living in Emacs and a helpful assistant. Respond concisely.") + (programming . "You are a large language model and a careful programmer. Provide code and only code as output without any additional text, prompt or note.") + (epictetus . "You are Epictetus, the stoic philosopher from Nicopolis. Respond concisely as Epictetus.") + (med . "You are a medical professor within the Emacs. Respond concisely.") + (code-review . "You are an expert programmer within Emacs reviewing code. Respond concisely") + (writer . "You are an expert writer and FOSS enthusiast. Improve only the article sections provided as a hacker, do not add extra paragraphs."))) + :bind (("C-c g" . 'gptel-send) + :map gptel-mode-map + ("C-c h" . 'gptel-menu))) + +;; (use-package copilot +;; :straight (copilot :host github :repo "zerolfx/copilot.el" :files ("dist" "*.el")) +;; :bind (:map copilot-mode-map +;; ("M-TAB" . 'copilot-accept-completion-by-line) +;; ("C-M-" . 'copilot-accept-completion-by-word) +;; ("C-M-n" . 'copilot-next-completion) +;; ("C-M-p" . 'copilot-previous-completion))) + + +;; Password-store +(use-package password-store + :init (define-prefix-command 'thanos/pass) + :defer t + :config + (setf password-store-password-length (+ 20 (random 20))) + :bind (("C-c p" . 'thanos/pass) + :map thanos/pass + ("i" . 'password-store-insert) + ("e" . 'password-store-edit) + ("g" . 'password-store-generate) + ("c" . 'password-store-copy) + ("s" . 'smtp-get-pass))) + +(defun thanos/pass-launcher () + "Launch Emacs as a front-end for pass." + (interactive) + (unwind-protect + (with-selected-frame + (make-frame '((name . "thanos/pass-launcher") + (fullscreen . 0) + (undecorated . t) + (minibuffer . only) + (width . 70) + (height . 15))) + (let* ((choice (completing-read "Choose an action: " + '("AUTO" "COPY PASS" "COPY USERNAME" "EDIT" "GENERATE"))) + (action (pcase choice + ("AUTO" #'(lambda (entry) (let ((user (password-store-get-field entry "user")) + (pass (password-store-get entry))) + (start-process-shell-command + "wtype" nil + (format "sleep 0.3 && wtype %s -P tab %s" + (shell-quote-argument (if user user "thanosapollo")) + (shell-quote-argument pass)))))) + ("COPY PASS" #'password-store-copy) + ("COPY USERNAME" #'(lambda (entry) (password-store-copy-field entry "user"))) + ("EDIT" #'password-store-edit) + ("GENERATE" #'password-store-generate)))) + (funcall action (completing-read "Search: " (password-store-list))) + (delete-frame))))) + +(defun smtp-get-pass () + "Get password for smtp." + (interactive) + (password-store-copy-field "fastmail.com/thanosapollo@fastmail.com" "smtp")) + +(use-package package-lint + :defer t) + +(use-package consult-mu + :straight (consult-mu :type git :host github :repo "armindarvish/consult-mu" :files (:defaults "extras/*.el")) + :after (mu4e consult) + :bind (:map mu4e-main-mode-map + ("M-s" . 'consult-mu) + :map mu4e-view-mode-map + ("M-s" . 'consult-mu) + :map mu4e-headers-mode-map + ("M-s" . 'consult-mu))) + +;; Guix Setup +;; Yasnippet configuration +(with-eval-after-load 'yasnippet + (add-to-list 'yas-snippet-dirs "~/Dev/guile/guix/etc/snippets/yas")) +;; ;; Tempel configuration +;; (with-eval-after-load 'tempel +;; ;; Ensure tempel-path is a list -- it may also be a string. +;; (unless (listp 'tempel-path) +;; (setq tempel-path (list tempel-path))) +;; (add-to-list 'tempel-path "~/Dev/guile/guix/etc/snippets/tempel/*")) + +(use-package yaml-mode + :defer t) + +;(load-file "~/Dev/guile/guix/etc/copyright.el") + +(setq copyright-names-regexp + (format "%s <%s>" user-full-name user-mail-address)) + +(when (or is-zeus is-hermes) + (use-package mu4e + :straight nil + :ensure nil + :init + + :config + (require 'server) + (require 'mu4e) + + (setf mu4e-get-mail-command "mbsync -a") + + (when (and is-zeus (server-running-p)) + (setf mu4e-update-interval (* 10 60))) + + (defun set-mu4e-context (context-name full-name mail-address signature) + "Return a mu4e context named CONTEXT-NAME with :match-func matching + folder name CONTEXT-NAME in Maildir. The context's `user-mail-address', + `user-full-name' and `mu4e-compose-signature'`smtpmail-smpt-server' is set to MAIL-ADDRESS + FULL-NAME SIGNATURE and SERVER respectively. + Special folders are set to context specific folders." + (let ((dir-name (concat "/" context-name))) + (make-mu4e-context + :name context-name + ;; we match based on the maildir of the message + :match-func + `(lambda (msg) + (when msg + (string-match-p + ,(concat "^" dir-name) + (mu4e-message-field msg :maildir)))) + :vars + `((user-mail-address . ,mail-address) + (user-full-name . ,full-name) + (mu4e-sent-folder . ,(concat dir-name "/Sent")) + (mu4e-drafts-folder . ,(concat dir-name "/Drafts")) + (mu4e-trash-folder . ,(concat dir-name "/Trash")) + (mu4e-trash-folder . ,(concat dir-name "/Starred")) + (mu4e-refile-folder . ,(concat dir-name "/Archive")) + (mu4e-compose-signature . ,signature))))) + + ;;Fixing duplicate UID errors when using mbsync and mu4e + (setf mu4e-change-filenames-when-moving t + mu4e-maildir-shortcuts + '(("/Fastmail/Inbox" . ?i) + ("/Drafts" . ?d) + ("/Sent" . ?s) + ("/Fastmail/Emacs/dev" . ?e) + ("/MUSofia/[Gmail]/All Mail" . ?u) + ("/Fastmail/Gentoo" . ?g))) + + (setf mu4e-contexts + (list + (make-mu4e-context + :name "Public" + :match-func + (lambda (msg) + (when msg + (string-prefix-p "/Fastmail" (mu4e-message-field msg :maildir)))) + :vars '((user-mail-address . "public@thanosapollo.org") + (user-full-name . "Thanos Apollo") + (smtpmail-smtp-server . "smtp.fastmail.com") + (smtpmail-smtp-service . 465) + (smtpmail-stream-type . ssl) + (mu4e-drafts-folder . "/Drafts") + (mu4e-sent-folder . "/Sent") + (mu4e-refile-folder . "/Archive") + (mu4e-trash-folder . "/Trash"))) + (make-mu4e-context + :name "MUSofia" + :match-func + (lambda (msg) + (when msg + (string-prefix-p "/MUSofia" (mu4e-message-field msg :maildir)))) + :vars '((user-mail-address . "104111@students.mu-sofia.bg") + (user-full-name . "Thanos Apollo") + (smtpmail-smtp-server . "smtp.gmail.com") + (smtpmail-smtp-service . 465) + (smtpmail-stream-type . ssl))))) + + (setf message-send-mail-function 'smtpmail-send-it + mu4e-compose-signature "\nThanos Apollo\n \nhttps://thanosapollo.org\n +62B7 58D0 F671 9938 BC09 CECA 339F 736C 3A72 0928\n" + mu4e-compose-context-policy 'ask) + + (setf mu4e-view-actions + (delete-dups + (append + '(("gapply git patches" . mu4e-action-git-apply-patch) + ("mgit am patch" . mu4e-action-git-apply-mbox) + ("bb4 am patch" . mu4e-action-git-apply-b4) + ("ssetup reword list with b4" . mu4e-action-setup-reword-b4) + ("crun checkpatch script" . my-mu4e-action-run-check-patch) + ("MCheck if merged" . my-mu4e-action-check-if-merged))))) + + :bind (("C-x m" . 'mu4e)) + :hook + ;; Sign messages + ((message-send . 'mml-secure-message-sign-pgpmime) + ;; Disable line numbers & autosave + (mu4e-main-mode . (lambda () (display-line-numbers-mode -1) (auto-save-mode -1)))))) + +;;; Random commands ;;;; +;;;;;;;;;;;;;;;;;;;;;;;; + +;; Virtual machines +(defvar vm-directory "~/Virtual/") + +(defun vm-create-image () + "Create qcow2 image." + (interactive) + (let ((name (format "%s%s.qcow2" vm-directory (read-string "Name: "))) + (size (format "%s" (read-string "Size(G): ")))) + (shell-command + (format "qemu-img create -f qcow2 %s %sG" name size)))) + + +(defun vm-run () + "Spawn Virtual Machine." + (interactive) + (let ((memory (format "%sG" (read-string "Memory(G): "))) + (cores (read-string "Cores: ")) + (image (read-file-name "Image: " vm-directory)) + (iso (if (y-or-n-p "Load iso? ") + (read-file-name "ISO: ") + nil))) + (async-shell-command + (format "qemu-system-x86_64 -enable-kvm -m %s -smp %s -hda %s -vga virtio -device virtio-serial-pci -netdev user,id=vmnic,hostfwd=tcp::2222-:22 -device e1000,netdev=vmnic %s" + memory cores image (if iso (concat "-cdrom " iso) ""))))) + +;; misc +(defun thanos/run-in-background (command) + "Run COMMAND in the background." + (let ((command-parts (split-string command "[ ]+"))) + (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts))))) + +(defun create-text-scratch () + "Create a scratch buffer." + (interactive) + (switch-to-buffer (get-buffer-create "*Text Scratch*")) + (org-mode)) + +(defun create-scratch () + "Create scratch buffer." + (interactive) + (switch-to-buffer (get-buffer-create "*scratch*")) + (emacs-lisp-mode)) + +(defvar-keymap thanos/create-map + :doc "Create custom buffers" + "t" #'create-text-scratch + "e" #'create-scratch) + +;; Theming + +(defvar wallpapers-dir "~/wallpapers/") + +(defun thanos/load-theme (&optional theme) + "Disable current theme and load a new THEME." + (interactive) + (let ((theme (or theme (intern (completing-read "Theme: " (custom-available-themes)))))) + (disable-theme (car custom-enabled-themes)) + (load-theme theme t))) + +(defun thanos/wallpaper-set (image) + "Set IMAGE as wallpaper, using feh." + (let ((command (if is-zeus "swaybg -o '*' -i" "feh --bg-scale"))) + ;; Kill previous swaybg + (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) + 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))) + +(defvar-keymap thanos/applications-map + :doc "Thanos commonly used programs" + "t" #'thanos/load-theme + "w" #'thanos/wallpaper-select + "C-c" thanos/create-map) + +(define-key global-map (kbd "C-c a") thanos/applications-map) + +(defun thanos/iimage-mode-buffer (arg) + "Display images if ARG is non-nil, undisplay them otherwise." + (let ((image-path (cons default-directory iimage-mode-image-search-path)) + (edges (window-inside-pixel-edges (get-buffer-window))) + file) + (with-silent-modifications + (save-excursion + (dolist (pair iimage-mode-image-regex-alist) + (goto-char (point-min)) + (while (re-search-forward (car pair) nil t) + (when (and (setq file (match-string (cdr pair))) + (setq file (locate-file file image-path))) + (if arg + (add-text-properties + (match-beginning 0) (match-end 0) + `(display + ,(create-image file nil nil + :max-width 120 + :max-height 120) + keymap ,image-map + modification-hooks + (iimage-modification-hook))) + (remove-list-of-text-properties + (match-beginning 0) (match-end 0) + '(display modification-hooks)))))))))) + +(define-minor-mode thanos/iimage-mode nil + :group 'iimage :lighter " iImg" + (thanos/iimage-mode-buffer thanos/iimage-mode)) + +;; Font +(custom-set-faces + (if is-hermes '(default ((t (:inherit nil :height 120 :family "Jetbrains Mono")))) + '(default ((t (:inherit nil :height 130 :family "Jetbrains Mono"))))) + '(variable-pitch ((t (:inherit t :family "Iosevka Aile")))) + '(org-modern-symbol ((t (:inherit t :family "Iosevka Aile"))))) + +;; (set-face-attribute 'org-ellipsis nil :inherit 'default :box nil) + + +;;; emacs.el ends here -- cgit v1.2.3 From 457c21c9aa423004efdcfb24568c23f5f66fa402 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 10 May 2024 09:09:45 +0300 Subject: alacritty: Rewrite --- .config/alacritty/alacritty.yml | 3 --- alacritty.toml | 8 ++++++++ 2 files changed, 8 insertions(+), 3 deletions(-) delete mode 100644 .config/alacritty/alacritty.yml create mode 100644 alacritty.toml diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml deleted file mode 100644 index 24e666f..0000000 --- a/.config/alacritty/alacritty.yml +++ /dev/null @@ -1,3 +0,0 @@ -window: - opacity: 0.90 - diff --git a/alacritty.toml b/alacritty.toml new file mode 100644 index 0000000..327ef67 --- /dev/null +++ b/alacritty.toml @@ -0,0 +1,8 @@ +[window] +opacity = 0.9 + +[colors] +primary.background="#0C0C0C" + +[font] +normal={family="Jetbrains Mono", style="Regular"} -- cgit v1.2.3 From 9d258331dc840e17f26a1d1fadc31563c5b763d6 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 10 May 2024 09:10:06 +0300 Subject: Add sway & waybar config --- sway.config | 273 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ waybar-config | 123 +++++++++++++++++++++++++ waybar-style.css | 74 +++++++++++++++ 3 files changed, 470 insertions(+) create mode 100644 sway.config create mode 100644 waybar-config create mode 100644 waybar-style.css diff --git a/sway.config b/sway.config new file mode 100644 index 0000000..8eaa6d6 --- /dev/null +++ b/sway.config @@ -0,0 +1,273 @@ +## Mod key +set $mod Mod4 + +exec sudo /home/thanos/.local/bin/tailscaled +exec waybar +bindsym $mod+z exec waybar +bindsym $mod+o exec killall -SIGUSR1 waybar + +# Workspace switch +bindsym $mod+period workspace back_and_forth + +bindsym $mod+slash workspace next +bindsym $mod+comma workspace prev +## Setup monitors & wallpapers +output DP-2 pos 0 0 res 2560x1440 bg ~/wallpapers/colors-fantasy.jpg stretch +output HDMI-A-1 pos 2560 0 res 2560x1440 bg ~/wallpapers/colors-fantasy.jpg fill transform 270 + +default_border pixel 3 +default_floating_border pixel 3 +gaps inner 5 +gaps outer 0 +bindsym $mod+shift+g exec swaymsg gaps outer all set 0 && swaymsg gaps inner all set 5 +bindsym $mod+g exec swaymsg gaps outer all set 0 && swaymsg gaps inner all set 0 + +# Activate smart borders (always) +smart_borders on +#smart_gaps on + +# Always float certain windows # +#swaymsg -t get_tree | grep app_id + for_window [app_id="pop-up"] floating enable + for_window [app_id="thanos/pass-launcher"] floating enable + for_window [app_id="bubble"] floating enable + for_window [app_id="task_dialog"] floating enable + for_window [app_id="Preferences"] floating enable + for_window [app_id="dialog"] floating enable + for_window [app_id="menu"] floating enable + for_window [app_id="Organizer"] floating enable + for_window [app_id="About"] floating enable + for_window [app_id="toolbox"] floating enable + for_window [app_id="page-info"] floating enable + for_window [app_id="webconsole"] floating enable + for_window [app_id="Authy"] floating enable + for_window [app_id="termfloat"] floating enable + for_window [app_id="termfloat"] resize set height 540 + for_window [app_id="termfloat"] resize set width 960 + for_window [app_id="mpv"] floating enable + for_window [app_id="mpv"] resize set height 540 + for_window [app_id="mpv"] resize set width 960 + for_window [app_id="Nautilus"] floating enable + for_window [app_id="Nautilus"] resize set height 540 + for_window [app_id="Nautilus"] resize set width 960 + +# Sticky floating windows(sticky enable|disable|toggle) + for_window [app_id="danmufloat"] floating enable + for_window [app_id="danmufloat"] sticky enable + for_window [app_id="danmufloat"] resize set height 540 + for_window [app_id="danmufloat"] resize set width 960 + +# Program Opacity + for_window [app_id="telegram"] opacity 0.95 + for_window [app_id="danmufloat"] opacity 0.80 + # for_window [app_id="icalingua"] opacity 0.95 + # for_window [class="netease-cloud-music"] opacity 0.90 + +# Focus follows mouse +focus_follows_mouse yes + +# Autostart # + +#exec_always --no-startup-id dunst & + +## Keyboard setup + +# NOTE: for bg phonetic use ,bg(phonetic) + input "type:keyboard" { + xkb_layout us,gr + xkb_options grp:win_space_toggle + } + + +# set gtk+ theme +set $gnome-schema org.gnome.desktop.interface + +# Window colours: border background text + # client.unfocused #2e3440 #1f222d #888888 + # client.focused_inactive #2e3440 #1f222d #888888 + # client.placeholder #2e3440 #1f222d #888888 + # client.urgent #D08770 #D08770 #ffffff + # client.background #242424 +client.focused #2D2D2D #2D2D2D #ffffff #ffffff #c6c6c6 +client.focused_inactive #0f1212 #0f1212 #ffffff #0f1212 #0f1212 +client.unfocused #2D2D2D #000000 #c6c6c6 #000000 #000000 +client.urgent #0f1212 #FF5555 #F8F8F2 #FF5555 #FF5555 +client.placeholder #000000 #000000 #F8F8F2 #000000 #000000 + +# TODO Direction keys, like Emacs + set $left h + set $down j + set $up k + set $right l + +#----------------------------------# +# Your preferred terminal emulator # +#----------------------------------# + set $term emacsclient -c + +# Control volume,monitor brightness,media players # + bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% + bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% + bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle + bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle + bindsym XF86MonBrightnessUp exec light -A 5 + bindsym XF86MonBrightnessDown exec light -U 5 + bindsym XF86AudioPlay exec playerctl play-pause + bindsym XF86AudioNext exec playerctl next + bindsym XF86AudioPrev exec playerctl previous + +# Key bindings --# + bindsym $mod+Return exec $term + bindsym $mod+Shift+Return exec kitty --class="termfloat" + bindsym $mod+Shift+m exec kitty --class="musicfox" --hold sh -c "musicfox" + bindsym $mod+Shift+d exec kitty --class="danmufloat" --hold sh -c "cd /home/ruixi/Codelearning/go/src/bilibili_live_tui/ && export TERM=xterm-256color && ./main" + + bindsym $mod+Shift+x exec --no-startup-id ~/.config/sway/swaylock.sh + bindsym $mod+t exec --no-startup-id telegram-desktop + bindsym $mod+bracketleft exec --no-startup-id grimshot --notify save area ~/Pictures/$(date "+%Y-%m-%d"T"%H:%M:%S_no_watermark").png + bindsym $mod+bracketright exec --no-startup-id grimshot --notify copy area + bindsym $mod+a exec --no-startup-id ~/.config/sway/grimshot_watermark.sh + + + # Kill focused window + bindsym $mod+q kill + + # Start your launcher + bindsym $mod+r exec fuzzel + + # Reload the configuration file + bindsym $mod+Shift+r reload + + # Exit sway (logs you out of your Wayland session) + bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' + + # Drag floating windows by holding down $mod and left mouse button. + # Resize them with right mouse button + $mod. + # Despite the name, also works for non-floating windows. + # Change normal to inverse to use left mouse button for resizing and right + # mouse button for dragging. + floating_modifier $mod normal + +# Moving around: # + # Move your focus around + bindsym $mod+$left focus left + bindsym $mod+$down focus down + bindsym $mod+$up focus up + bindsym $mod+$right focus right + # Or use $mod+[up|down|left|right] + bindsym $mod+Left focus left + bindsym $mod+Down focus down + bindsym $mod+Up focus up + bindsym $mod+Right focus right + + # Move the focused window with the same, but add Shift + bindsym $mod+Shift+$left move left + bindsym $mod+Shift+$down move down + bindsym $mod+Shift+$up move up + bindsym $mod+Shift+$right move right + # Ditto, with arrow keys + bindsym $mod+Shift+Left move left + bindsym $mod+Shift+Down move down + bindsym $mod+Shift+Up move up + bindsym $mod+Shift+Right move right + +# Workspaces: + # Switch to workspace + bindsym $mod+1 workspace number 1 + bindsym $mod+2 workspace number 2 + bindsym $mod+3 workspace number 3 + bindsym $mod+4 workspace number 4 + bindsym $mod+5 workspace number 5 + bindsym $mod+6 workspace number 6 + bindsym $mod+7 workspace number 7 + bindsym $mod+8 workspace number 8 + bindsym $mod+9 workspace number 9 + bindsym $mod+0 workspace number 10 + # Move focused container to workspace + bindsym $mod+Shift+1 move container to workspace number 1 + bindsym $mod+Shift+2 move container to workspace number 2 + bindsym $mod+Shift+3 move container to workspace number 3 + bindsym $mod+Shift+4 move container to workspace number 4 + bindsym $mod+Shift+5 move container to workspace number 5 + bindsym $mod+Shift+6 move container to workspace number 6 + bindsym $mod+Shift+7 move container to workspace number 7 + bindsym $mod+Shift+8 move container to workspace number 8 + bindsym $mod+Shift+9 move container to workspace number 9 + bindsym $mod+Shift+0 move container to workspace number 10 + # move focused container to workspace(follow) + bindsym $mod+Ctrl+1 move container to workspace number 1, workspace 1 + bindsym $mod+Ctrl+2 move container to workspace number 2, workspace 2 + bindsym $mod+Ctrl+3 move container to workspace number 3, workspace 3 + bindsym $mod+Ctrl+4 move container to workspace number 4, workspace 4 + bindsym $mod+Ctrl+5 move container to workspace number 5, workspace 5 + bindsym $mod+Ctrl+6 move container to workspace number 6, workspace 6 + bindsym $mod+Ctrl+7 move container to workspace number 7, workspace 7 + bindsym $mod+Ctrl+8 move container to workspace number 8, workspace 8 + bindsym $mod+Ctrl+9 move container to workspace number 9, workspace 9 + bindsym $mod+Ctrl+0 move container to workspace number 10, workspace 10 + # Note: workspaces can have any name you want, not just numbers. + # We just use 1-10 as the default. +# Layout stuff: + # You can "split" the current object of your focus with + # $mod+semicolon or $mod+apostrophe, for horizontal and vertical splits + # respectively. + bindsym $mod+semicolon splitv + bindsym $mod+apostrophe splith + + # Switch the current container between different layout styles + bindsym $mod+s layout stacking + bindsym $mod+w exec emacsclient -e '(thanos/pass-launcher)' + bindsym $mod+e layout toggle split + + # Make the current focus fullscreen + bindsym $mod+f fullscreen + + # Toggle the current focus between tiling and floating mode + bindsym $mod+Shift+space floating toggle + + # Swap focus between the tiling area and the floating area + bindsym $mod+space focus mode_toggle + + # Move focus to the parent container + bindsym $mod+p focus parent + # Move focus the child container + bindsym $mod+c focus child + +# Scratchpad: # +## hide | show window(minus is "-" and plus is "+".) +bindsym $mod+minus move scratchpad +bindsym $mod+equal scratchpad show + +#----------------------# +# Resizing containers: # +#----------------------# +#bindsym $mod+r mode "resize" +mode "resize" { + # left will shrink the containers width + # right will grow the containers width + # up will shrink the containers height + # down will grow the containers height + bindsym $left resize shrink width 10px + bindsym $up resize grow height 10px + bindsym $down resize shrink height 10px + bindsym $right resize grow width 10px + + # Ditto, with arrow keys + bindsym Left resize shrink width 10px + bindsym Up resize grow height 10px + bindsym Down resize shrink height 10px + bindsym Right resize grow width 10px + + # Return to default mode + bindsym Return mode "default" + bindsym Escape mode "default" +} +## Better to resize window +bindsym Shift+Ctrl+h resize shrink width 5 px or 5 ppt +bindsym Shift+Ctrl+k resize grow height 5 px or 5 ppt +bindsym Shift+Ctrl+j resize shrink height 5 px or 5 ppt +bindsym Shift+Ctrl+l resize grow width 5 px or 5 ppt +bindsym Shift+Ctrl+Left resize shrink width 5 px or 5 ppt +bindsym Shift+Ctrl+Up resize grow height 5 px or 5 ppt +bindsym Shift+Ctrl+Down resize shrink height 5 px or 5 ppt +bindsym Shift+Ctrl+Right resize grow width 5 px or 5 ppt diff --git a/waybar-config b/waybar-config new file mode 100644 index 0000000..66599a9 --- /dev/null +++ b/waybar-config @@ -0,0 +1,123 @@ +// -*- mode: json -*- + +{ + "layer": "top", + "position": "top", + + "modules-left": [ + "sway/workspaces", + "custom/right-arrow-dark" + ], + "modules-center": [ + "custom/left-arrow-dark", + "clock#1", + "custom/left-arrow-light", + "custom/left-arrow-dark", + "clock#2", + "custom/right-arrow-dark", + "custom/right-arrow-light", + "clock#3", + "custom/right-arrow-dark" + ], + "modules-right": [ + "custom/left-arrow-dark", + "pulseaudio", + "custom/left-arrow-light", + "custom/left-arrow-dark", + "memory", + "custom/left-arrow-light", + "custom/left-arrow-dark", + "cpu", + "custom/left-arrow-light", + "custom/left-arrow-dark", + "battery", + "custom/left-arrow-light", + "custom/left-arrow-dark", + "disk", + "custom/left-arrow-light", + "custom/left-arrow-dark", + "tray" + ], + + "custom/left-arrow-dark": { + "format": "", + "tooltip": false + }, + "custom/left-arrow-light": { + "format": "", + "tooltip": false + }, + "custom/right-arrow-dark": { + "format": "", + "tooltip": false + }, + "custom/right-arrow-light": { + "format": "", + "tooltip": false + }, + + "sway/workspaces": { + "disable-scroll": true, + "format": "{name}" + }, + + "clock#1": { + "format": "{:%a}", + "tooltip": false + }, + "clock#2": { + "format": "{:%H:%M}", + "tooltip": false + }, + "clock#3": { + "format": "{:%Y-%m-%d}", + "tooltip": false + }, + + "pulseaudio": { + "format": "VOL: {volume:2}%", + "format-bluetooth": "{icon} {volume}%", + "format-muted": "MUTE", + "format-icons": { + "headphones": "", + "default": [ + "", + "" + ] + }, + "scroll-step": 5, + "on-click": "pamixer -t", + "on-click-right": "pavucontrol" + }, + "memory": { + "interval": 5, + "format": "Mem {}%" + }, + "cpu": { + "interval": 5, + "format": "CPU {usage:2}%" + }, + "battery": { + "states": { + "good": 95, + "warning": 30, + "critical": 15 + }, + "format": "{icon} {capacity}%", + "format-icons": [ + "", + "", + "", + "", + "" + ] + }, + "disk": { + "interval": 5, + "format": "Disk {percentage_used:2}%", + "path": "/" + }, + "tray": { + "icon-size": 10 + } +} diff --git a/waybar-style.css b/waybar-style.css new file mode 100644 index 0000000..4c6cbf0 --- /dev/null +++ b/waybar-style.css @@ -0,0 +1,74 @@ +* { + font-size: 15px; + font-family: monospace; +} + +window#waybar { + background: #292b2e; + color: #fdf6e3; +} + +#custom-right-arrow-dark, +#custom-left-arrow-dark { + color: #1a1a1a; +} +#custom-right-arrow-light, +#custom-left-arrow-light { + color: #292b2e; + background: #1a1a1a; +} + +#workspaces, +#clock.1, +#clock.2, +#clock.3, +#pulseaudio, +#memory, +#cpu, +#battery, +#disk, +#tray { + background: #1a1a1a; +} + +#workspaces button { + padding: 0 2px; + color: #fdf6e3; +} +#workspaces button.focused { + color: #268bd2; +} +#workspaces button:hover { + box-shadow: inherit; + text-shadow: inherit; +} +#workspaces button:hover { + background: #1a1a1a; + border: #1a1a1a; + padding: 0 3px; +} + +#pulseaudio { + color: #268bd2; +} +#memory { + color: #2aa198; +} +#cpu { + color: #6c71c4; +} +#battery { + color: #859900; +} +#disk { + color: #b58900; +} + +#clock, +#pulseaudio, +#memory, +#cpu, +#battery, +#disk { + padding: 0 10px; +} -- cgit v1.2.3 From 25d09ddb7a3ddbdf49cb62168a8ab5514651fe5a Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 10 May 2024 09:11:37 +0300 Subject: Add guix configuration --- .config/guix/channels.scm | 14 +++++++ guix/home.scm | 81 ++++++++++++++++++++++++++++++++++++++++ guix/services/tailscale.scm | 66 ++++++++++++++++++++++++++++++++ guix/system.scm | 91 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 252 insertions(+) create mode 100644 .config/guix/channels.scm create mode 100644 guix/home.scm create mode 100644 guix/services/tailscale.scm create mode 100644 guix/system.scm diff --git a/.config/guix/channels.scm b/.config/guix/channels.scm new file mode 100644 index 0000000..66b4a77 --- /dev/null +++ b/.config/guix/channels.scm @@ -0,0 +1,14 @@ +(cons* (channel + (name 'nonguix) + (url "https://gitlab.com/nonguix/nonguix") + ;; Enable signature verification: + (introduction + (make-channel-introduction + "897c1a470da759236cc11798f4e0a5f7d4d59fbc" + (openpgp-fingerprint + "2A39 3FFF 68F4 EF7A 3D29 12AF 6F51 20A0 22FB B2D5")))) + (channel + (name 'thanos-channel) + (url (string-append "file://" (getenv "HOME") + "/Dev/guile/guix-channel/"))) + %default-channels) diff --git a/guix/home.scm b/guix/home.scm new file mode 100644 index 0000000..b11fc4f --- /dev/null +++ b/guix/home.scm @@ -0,0 +1,81 @@ +;; This "home-environment" file can be passed to 'guix home reconfigure' +;; to reproduce the content of your profile. This is "symbolic": it only +;; specifies package names. To reproduce the exact same profile, you also +;; need to capture the channels being used, as returned by "guix describe". +;; See the "Replicating Guix" section in the manual. + +(use-modules (gnu packages) + (gnu packages gnupg) + (gnu services) + (guix gexp) + (gnu system) + (gnu home) + (gnu home services) + (gnu home services dotfiles) + (gnu home services shells) + (gnu home services desktop) + (gnu home services gnupg)) + +(home-environment + ;; Below is the list of packages that will show up in your + ;; Home profile, under ~/.guix-home/profile. + ;; (packages + ;; (append (map specification->package + ;; '("emacs-pgtk" "aspell-dict-el")))) + ;; Below is the list of Home services. To search for available + ;; services, run 'guix home search KEYWORD' in a terminal. + (services + (list (service home-bash-service-type + (home-bash-configuration + (guix-defaults? #f) + (aliases '(("fanki" . "flatpak run net.ankiweb.Anki") + ("ga" . "git add") + ("gaa" . "git add .") + ("gc" . "git commit -m") + ("gp" . "git push -u origin") + ("gpd" . "git push -u origin developer") + ("gpm" . "git push -u origin master") + ("grep" . "grep --color=auto") + ("gs" . "git status") + ("klight" . "brightnessctl --device='\\''tpacpi::kbd_backlight'\\'' set 1") + ("ll" . "ls -lah --color") + ("logout" . "pkill -U $USER") + ("ls" . "ls --color") + ("o" . "emacsclient -n") + ("weather" . "curl wttr.in") + ("ytd" . "yt-dlp") + ("gx" . "guix"))) + (bashrc (list (local-file "/home/thanos/dotfiles/bash-base.sh" #:recursive? #t))))) + ;; TODO: Rewrite this mess + (service home-xdg-configuration-files-service-type + `(("emacs/init.el" ,(local-file "../emacs.el")) + ("alacritty/alacritty.toml" ,(local-file "../alacritty.toml")) + ("sway/config" ,(local-file "../sway.config")) + ("waybar/config" ,(local-file "../waybar-config")) + ("waybar/style.css" ,(local-file "../waybar-style.css")))) + (service home-dotfiles-service-type + (home-dotfiles-configuration + (directories '("/home/thanos/dotfiles/")) + (excluded '(".*~" ".*\\.swp" "\\.git" "\\.gitignore" ".*emacs.el" "sway\\*" "waybar-config" + "alacritty.toml" "vimium-options.json" "waybar-style.css" + ".*bash" "README" "LICENSE" ".*\\.scm" "sway.config" ".stow-local-ignore")))) + ;; Env variables + (simple-service 'profile-service-type + home-environment-variables-service-type + '(("VISUAL" . "emacsclient") + ("EDITOR" . "emacsclient") + ("GTK_THEME" . "Adwaita-dark") + ("XDG_CURRENT_DESKTOP" . "sway") + ("XDG_SESSION_TYPE" . "wayland") + ("PATH" . "/home/$USER/.local/bin:$PATH") + ("XDG_DATA_DIRS" . "$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share"))) + ;; GPG Configuration + (service home-gpg-agent-service-type + (home-gpg-agent-configuration + (pinentry-program + (file-append pinentry-gtk2 "/bin/pinentry-gtk-2")) + (ssh-support? #t) + (default-cache-ttl 28800) + (max-cache-ttl 28800) + (default-cache-ttl-ssh 28800) + (max-cache-ttl-ssh 28800)))))) diff --git a/guix/services/tailscale.scm b/guix/services/tailscale.scm new file mode 100644 index 0000000..0632a41 --- /dev/null +++ b/guix/services/tailscale.scm @@ -0,0 +1,66 @@ +;; Under construction + +(define-module (services tailscale) + #:use-module (gnu services) + #:use-module (gnu services shepherd) + #:use-module (gnu services configuration) + #:use-module (guix records) + #:use-module (guix gexp) + #:use-module (ice-9 match) + #:use-module (packages tailscale) + #:use-module (gnu packages linux) + #:export (tailscaled-service-type tailscaled-configuration)) + +;; TODO: https://tailscale.com/kb/1188/linux-dns/#dhcp-dhclient-overwriting-etcresolvconf + +(define-record-type* + tailscaled-configuration make-tailscaled-configuration + tailscaled-configuration? + (tailscale tailscaled-configuration-tailscale + (default tailscale)) + (listen-port tailscaled-configuration-listen-port + (default "41641")) + (state-file tailscaled-configuration-state-file + (default "tailscaled.state"))) + +(define (tailscaled-activation config) + "Run tailscaled --cleanup" + #~(begin + (system* #$(file-append tailscale "/usr/bin/tailscaled") "--cleanup"))) + +(define (tailscaled-shepherd-service config) + "Return a for Tailscaled with CONFIG" + (let ((tailscale + (tailscaled-configuration-tailscale config)) + (listen-port + (tailscaled-configuration-listen-port config)) + (state-file + (tailscaled-configuration-state-file config)) + (environment #~(list (string-append + "PATH=" ; iptables is required for tailscale to work + (string-append #$iptables "/sbin") + ":" + (string-append #$iptables "/bin"))))) + (list + (shepherd-service + (provision '(tailscaled)) + (requirement '(networking)) ;; services this depends on + (start #~(make-forkexec-constructor + (list #$(file-append tailscale "/usr/bin/tailscaled") + "-state" #$state-file + ;"-port" #$listen-port + "-verbose" "10") + #:environment-variables #$environment + #:log-file "/var/log/tailscaled.log")) + (stop #~(make-kill-destructor)))))) + +(define tailscaled-service-type + (service-type + (name 'tailscaled) + (extensions + (list (service-extension shepherd-root-service-type + tailscaled-shepherd-service) + (service-extension activation-service-type + tailscaled-activation))) + (default-value (tailscaled-configuration)) + (description "Launch tailscaled."))) diff --git a/guix/system.scm b/guix/system.scm new file mode 100644 index 0000000..2d38409 --- /dev/null +++ b/guix/system.scm @@ -0,0 +1,91 @@ +;; TODO: Use this as a base module and seperate each system/machine +(use-modules (gnu) + (gnu services) + (gnu home services desktop) + (gnu home services desktop) + (gnu home services gnupg) + (nongnu packages linux) + (nongnu system linux-initrd)) + +(use-service-modules cups desktop networking ssh xorg docker guix admin pm docker) + +(operating-system + (locale "en_US.utf8") + (timezone "Europe/Athens") + (keyboard-layout (keyboard-layout "us")) + (host-name "zeus") + + ;; TODO: Use the full linux kernel only on the desktop + (kernel linux) + (initrd microcode-initrd) + (firmware (list linux-firmware)) + + ;; The list of user accounts ('root' is implicit). + (users (cons* (user-account + (name "thanos") + (comment "Thanos Apollo") + (group "users") + (home-directory "/home/thanos") + (supplementary-groups '("wheel" "netdev" "audio" "video" "docker"))) + %base-user-accounts)) + + ;; Packages installed system-wide. + (packages + (append (map specification->package + '("sway" "swaylock" "swaylock-effects" "swaybg" "flatpak" + "waybar" "mu" "gnupg" "pinentry" "password-store" "isync" "python" + "sbcl" "font-jetbrains-mono" "docker" "docker-cli" "icecat" "git")) + %base-packages)) + + ;; Below is the list of system services. To search for available + ;; services, run 'guix system search KEYWORD' in a terminal. + (services + (append (list (service gnome-desktop-service-type) + (service docker-service-type) + + (service openssh-service-type + (openssh-configuration + (permit-root-login 'prohibit-password))) + ;; ;; TODO: Fix swaylock + ;; (service screen-locker-service-type + ;; (screen-locker-configuration + ;; (name "swaylock") + ;; (program (file-append swaylock "/bin/swaylock")) + ;; (using-pam? #t) + ;; (using-setuid? #f))) + + (service tor-service-type) + (service cups-service-type) + (set-xorg-configuration + (xorg-configuration (keyboard-layout keyboard-layout)))) + %desktop-services)) + (bootloader (bootloader-configuration + (bootloader grub-efi-bootloader) + (targets (list "/boot/efi")) + (keyboard-layout keyboard-layout))) + (swap-devices (list (swap-space + (target (uuid + "10551e45-7810-4171-a4b2-87372ae5bdb4"))))) + + ;; run 'lsblk -f' to get UUIDs. + (file-systems (cons* (file-system + (mount-point "/hdd") + (device (uuid "b0fddf60-47ff-469f-b135-8f6b58812c99" + 'xfs)) + (type "xfs")) + (file-system + (mount-point "/home") + (device (uuid "4efbc805-e89b-46b8-b895-b1ce807698c8" + 'ext4)) + (type "ext4")) + (file-system + (mount-point "/") + (device (uuid + "e350994d-4c98-4d04-9867-29c9fc779026" + 'ext4)) + (type "ext4")) + (file-system + (mount-point "/boot/efi") + (device (uuid "F2A9-FB50" + 'fat32)) + (type "vfat")) %base-file-systems))) -- cgit v1.2.3 From dece750fa404c7dc55e1da4926e80d818117d986 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 10 May 2024 09:11:57 +0300 Subject: Remove old bashrc configuration of shells is now done via guix home --- .bashrc | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 .bashrc diff --git a/.bashrc b/.bashrc deleted file mode 100644 index cd1b64e..0000000 --- a/.bashrc +++ /dev/null @@ -1,36 +0,0 @@ -source ~/.shells/alias.sh -source ~/.shells/exports.sh -source /etc/profile - - -if [ -e /etc/profile.env ] ; then - . /etc/profile.env -fi - -## Get completions -for sh in /etc/bash/bashrc.d/* ; do - [[ -r ${sh} ]] && source "${sh}" -done - -## Prompt -if ${use_color} ; then - PS1='PS1_CMD1=$(git branch 2>/dev/null | grep '"'"'"'"'"'"'"'"'*'"'"'"'"'"'"'"'"' | colrm 1 2)'; PS1='\n\[\e[38;5;153;2;3m\]\h\n\[\e[0;38;5;226m\]\w \[\e[38;5;63;1m\]${PS1_CMD1}\n\[\e[0;38;5;198m\]λ \[\e[0m\]' -else - PS1+='\u@\h \w \$ ' -fi - -## doas > sudo -complete -cf doas -complete -cf sudo -export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.local/lib/mojo -export PATH=$PATH:~/.modular/pkg/packages.modular.com_mojo/bin/ -export PATH=$PATH:~/.modular/pkg/packages.modular.com_mojo/bin/ - -# Python -eval "$(pyenv init -)" -eval "$(pyenv virtualenv-init -)" -if command -v pyenv 1>/dev/null 2>&1; then - eval "$(pyenv init -)" -fi -export PYENV_ROOT="$HOME/.pyenv" -export PATH="$PYENV_ROOT/bin:$PATH" -- cgit v1.2.3 From 8da13bdc7e58a312b1926bcebdd98d928c4aee4d Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 10 May 2024 09:12:13 +0300 Subject: nyxt: Update search engines --- .config/nyxt/default-search.lisp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.config/nyxt/default-search.lisp b/.config/nyxt/default-search.lisp index 356850e..8f286df 100644 --- a/.config/nyxt/default-search.lisp +++ b/.config/nyxt/default-search.lisp @@ -4,7 +4,8 @@ '("g" "https://google.com/search?q=~a" "https://google.com") '("gh" "https://github.com/search?q=~a" "https://github.com") '("aa" "https://annas-archive.org/search?q=~a" "https://annas-archive.org/") - '("duck" "https://duckduckgo.com/?q=~a" "https://duckduckgo.com/")) + '("duck" "https://duckduckgo.com/?q=~a" "https://duckduckgo.com/") + '("thanos" "https://search.thanosapollo.org/search?q=~a" "https://search.thanosapollo.org")) "List of search engines.") (define-configuration context-buffer -- cgit v1.2.3 From 8af43613be025f0d84e66da28251c3c04a67b2ce Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 10 May 2024 09:12:30 +0300 Subject: Add bash-base --- bash-base.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 bash-base.sh diff --git a/bash-base.sh b/bash-base.sh new file mode 100644 index 0000000..def52ec --- /dev/null +++ b/bash-base.sh @@ -0,0 +1,17 @@ +# source ~/.shells/alias.sh +# source ~/.shells/exports.sh +# source /etc/profile +source ~/.profile + + +GUIX_PROFILE="$HOME/.guix-profile" +. "$GUIX_PROFILE/etc/profile" + +## Prompt +if ${use_color} ; then + PS1='$(git branch --show-current 2>/dev/null)'; PS1='\n\[\e[38;5;102;2;3m\]\u\[\e[0m\]@\[\e[38;5;153;2;3m\]\h\n\[\e[0;38;5;226m\]\w \[\e[38;5;75;3m\]${PS1_CMD1}\n\[\e[0;38;5;198m\]λ \[\e[0m\]' +else + PS1+='\u@\h \w \$ ' +fi + +## complete -cf sudo -- cgit v1.2.3 From b7469543d2fc584dcadf8a64f4e0281756932c0b Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 10 May 2024 21:16:23 +0300 Subject: Move files at .config --- .config/alacritty/alacritty.toml | 8 + .config/emacs/init.el | 1275 +++++++++++++++++++++++++++++++++++++ .config/sway/config | 273 ++++++++ .config/waybar/config | 123 ++++ .config/waybar/style.css | 74 +++ alacritty.toml | 8 - emacs.el | 1280 -------------------------------------- sway.config | 273 -------- waybar-config | 123 ---- waybar-style.css | 74 --- 10 files changed, 1753 insertions(+), 1758 deletions(-) create mode 100644 .config/alacritty/alacritty.toml create mode 100644 .config/emacs/init.el create mode 100644 .config/sway/config create mode 100644 .config/waybar/config create mode 100644 .config/waybar/style.css delete mode 100644 alacritty.toml delete mode 100644 emacs.el delete mode 100644 sway.config delete mode 100644 waybar-config delete mode 100644 waybar-style.css diff --git a/.config/alacritty/alacritty.toml b/.config/alacritty/alacritty.toml new file mode 100644 index 0000000..327ef67 --- /dev/null +++ b/.config/alacritty/alacritty.toml @@ -0,0 +1,8 @@ +[window] +opacity = 0.9 + +[colors] +primary.background="#0C0C0C" + +[font] +normal={family="Jetbrains Mono", style="Regular"} diff --git a/.config/emacs/init.el b/.config/emacs/init.el new file mode 100644 index 0000000..a80febc --- /dev/null +++ b/.config/emacs/init.el @@ -0,0 +1,1275 @@ +;;; init.el --- Emacs configuration -*- lexical-binding: t; -*- + +;; Copyright (C) 2023 Thanos Apollo + +;; Author: Thanos Apollo + +;; 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 . + +;;; Commentary: +;; ╭━━━━┳╮╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━━━╮╱╱╱╱╱╭╮╭╮╱╱╱╱╱╱╱╱╭━━━╮ +;; ┃╭╮╭╮┃┃╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃╭━╮┃╱╱╱╱╱┃┃┃┃╱╱╱╱╱╱╱╱┃╭━━╯ +;; ╰╯┃┃╰┫╰━┳━━┳━╮╭━━┳━━╮┃┃╱┃┣━━┳━━┫┃┃┃╭━━╮╱╱╱╱┃╰━━┳╮╭┳━━┳━━┳━━╮ +;; ╱╱┃┃╱┃╭╮┃╭╮┃╭╮┫╭╮┃━━┫┃╰━╯┃╭╮┃╭╮┃┃┃┃┃╭╮┃╭━━╮┃╭━━┫╰╯┃╭╮┃╭━┫━━┫ +;; ╱╱┃┃╱┃┃┃┃╭╮┃┃┃┃╰╯┣━━┃┃╭━╮┃╰╯┃╰╯┃╰┫╰┫╰╯┃╰━━╯┃╰━━┫┃┃┃╭╮┃╰━╋━━┃ +;; ╱╱╰╯╱╰╯╰┻╯╰┻╯╰┻━━┻━━╯╰╯╱╰┫╭━┻━━┻━┻━┻━━╯╱╱╱╱╰━━━┻┻┻┻╯╰┻━━┻━━╯ +;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃┃ +;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰╯ +;;; Code: + +(setf user-full-name "Thanos Apollo" + user-mail-address "public@thanosapollo.org") + +(defvar is-zeus (equal (system-name) "zeus")) +(defvar is-hermes (equal (system-name) "hermes")) +(defvar is-phone (equal (system-name) "localhost")) + +;; Autoinsert +(auto-insert-mode 1) + +(setq auto-insert-alist '((python-mode . "python.template")) + auto-insert-directory (locate-user-emacs-file "insert")) + +(add-to-list 'completion-styles 'initials t) + +(setf tab-always-indent 'complete) + +;; xref +(setf xref-show-xrefs-function #'consult-xref + xref-show-definitions-function #'consult-xref) + +;; Set and load custom.el +(setf custom-file (locate-user-emacs-file "custom.el")) +(load custom-file 'noerror) + +;; Enable use-package support for imenu +(setf use-package-enable-imenu-support t) + +;; Install straight.el +(defvar bootstrap-version) + +(let ((bootstrap-file + (expand-file-name + "straight/repos/straight.el/bootstrap.el" + (or (bound-and-true-p straight-base-dir) + user-emacs-directory))) + (bootstrap-version 7)) + (unless (file-exists-p bootstrap-file) + (with-current-buffer + (url-retrieve-synchronously + "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" + 'silent 'inhibit-cookies) + (goto-char (point-max)) + (eval-print-last-sexp))) + (load bootstrap-file nil 'nomessage)) + +(setq package-enable-at-startup nil) + +(require 'straight) + +(setf straight-use-package-by-default t) + +(setf straight-recipe-overrides + '((transmission :type git :host nil :repo "git@thanosapollo.org:/var/git/transmission.git") + ;; (yeetube :type git :host nil :repo "git@thanosapollo.org:/var/git/yeetube.git") + (gnosis :type git :host nil :repo "git@thanosapollo.org:/var/git/gnosis.git") + (pcmpl-emerge :type git :host nil :repo "git@thanosapollo.org:/var/git/pcmpl-emerge.git") + (pcmpl-rc :type git :host nil :repo "git@thanosapollo.org:/var/git/pcmpl-rc.git"))) + +(use-package emacs + :straight nil + :ensure t + :config + + (setf browse-url-browser-function 'browse-url-generic + browse-url-generic-program "icecat" + backup-directory-alist '((".*" . "~/.Trash")) + sentence-end-double-space t + default-input-method "bulgarian-phonetic" + gc-cons-threshold 5000000 + disabled-command-function nil ;; Enable all commands + url-privacy-level 'high + calendar-date-style 'european) + (if is-zeus + (display-battery-mode 0) + (display-battery-mode 1)) + + ;; use ssh for tramp, faster for small files + (setf tramp-default-method "ssh") + + (savehist-mode) + (save-place-mode 1) + (recentf-mode 1) + (electric-pair-mode 1) + :bind (("M-" . 'backward-kill-sexp) + ("C-c L" . 'display-line-numbers-mode) + ("C-z" . nil) + ("C-c r" . 'rename-visited-file)) + :hook ((emacs-lisp-mode . prettify-symbols-mode) + (lisp-mode . prettify-symbols-mode))) + +(use-package dired + :straight nil + :ensure nil + :config + (defun dired-watch-video () + "Watch play file with mpv." + (interactive) + (call-process-shell-command + (format "mpv \"%s\"" (dired-get-filename)) nil 0)) + + (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))) + + (defun dired-delete-files-except () + "Delete all files inside directory except match." + (interactive) + (let* ((directory (read-directory-name "Select directory: ")) + (files (directory-files directory t)) + (except-match (read-string "Except the ones that have: "))) + (dolist (file files) + (unless (or (string= "." (substring file -1)) + (string= ".." (substring file -2)) + (string-match except-match file)) + (dired-delete-file file t))))) + + (defun dired-delete-file-match () + "Delete all files inside directory except match." + (interactive) + (let* ((directory (read-directory-name "Select directory: ")) + (files (directory-files directory t)) + (match (read-string "Delete files that match: "))) + (dolist (file files) + (when (string-match-p match file) + (dired-delete-file file t))))) + + (defun dired-rename-capitalize-file () + "Capitalize the base name of the file at point in a Dired buffer." + (interactive) + (let* ((file (dired-get-file-for-visit)) + (new-file (capitalize (file-name-nondirectory file)))) + (if (string-prefix-p "." file) + (message "Skipping file starting with '.'") + (progn + (rename-file file (concat (file-name-directory file) new-file)) + (revert-buffer) + (message "Renamed %s to %s" file new-file))))) + :bind ((:map + dired-mode-map + ("b" . 'dired-up-directory) + ("v" . 'dired-watch-video) + ("z" . 'wdired-change-to-wdired-mode) + ("C-c w" . 'dired-set-wallpaper) + ("C-c d" . 'dired-delete-files-except) + ("C-c r" . 'dired-do-query-replace-regexp)))) + +(defun theme-invisible-dividers (_theme) + "Make window dividers for THEME invisible." + (let ((bg (face-background 'default))) + (custom-set-faces + `(fringe ((t :background ,bg :foreground ,bg))) + `(window-divider ((t :background ,bg :foreground ,bg))) + `(window-divider-first-pixel ((t :background ,bg :foreground ,bg))) + `(window-divider-last-pixel ((t :background ,bg :foreground ,bg)))))) + +(add-hook 'enable-theme-functions #'theme-invisible-dividers) + +;;;; Theming ;;;; +(setf inhibit-startup-message t + initial-scratch-message nil) + +(blink-cursor-mode -1) +(global-visual-line-mode 0) + +(setf visible-bell nil + display-line-numbers-type 'relative) + +(column-number-mode) +(global-display-line-numbers-mode 1) + +;; Transparency +(add-to-list 'default-frame-alist '(alpha-background . 85)) + +;; theming +;; (global-hl-line-mode) +(global-visual-line-mode) + +(defun thanos/terminal-theming () + "Customize theming when laucning Emacs as TUI." + (unless (display-graphic-p (selected-frame)) + (set-face-background 'default "unspecified-bg" (selected-frame)) + (global-hl-line-mode 0))) + +(add-hook 'window-setup-hook 'thanos/terminal-theming) + +(when (equal is-phone nil) + (scroll-bar-mode -1) + (set-fringe-mode 10)) + +(tool-bar-mode -1) +(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-log-done 'time + org-hide-emphasis-markers nil ;;change to t to hide emphasis markers + org-table-convert-region-max-lines 20000 + org-log-done 'time + org-todo-keywords '((sequence "TODO(t)" "SEMINAR(s)" "LECTURE(l)" "DONE(d)"))) + + (setf org-structure-template-alist + '(("e" . "src emacs-lisp") + ("p" . "src python") + ("l" . "src lisp") + ("b" . "src bash") + ("q" . "QUOTE"))) + + :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)))) + +(defun org-insert-book () + "Insert org-link from ~/Library for book." + (interactive) + (let* ((book-path (read-file-name "Book: " "~/Library/"))) + (org-insert-link nil book-path (file-name-base book-path)))) + +(use-package org-modern + :ensure t + :config + (setf org-modern-table nil + org-modern-todo nil + org-modern-tag nil) + :hook ((org-mode . org-modern-mode))) + +;; Create notes directory for org-roam +(unless (file-exists-p "~/Notes") + (make-directory "~/Notes")) + +(use-package org-roam + :defer t + :init + (define-prefix-command 'thanos/notes-map) + :config + (setf org-roam-directory "~/Notes" + org-roam-dailies-directory "daily/") + + (org-roam-db-autosync-enable) + + (setf org-roam-node-display-template + (concat "${title:50} "(propertize "${tags:30}" 'face 'org-tag))) + + (setf org-roam-db-node-include-function + (lambda () + (not (or (member "journal" (org-get-tags)) + (member "dailies" (org-get-tags)))))) + ;; Templates + (setf org-roam-capture-templates + '(("d" "default" plain + "%?" + :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+startup: overview\n") + :unnarrowed t) + ("p" "MUS" plain "* Goals\n\n%?\n\n* Tasks\n\n** TODO Add initial tasks\n\n* Dates\n\n" + :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: MUS") + :unnarrowed t)) + org-roam-dailies-capture-templates + '(("d" "default" entry + "* %?" + :target (file+head "%<%Y-%m-%d>.org" + "#+title: %<%Y-%m-%d>\n#+filetags: :journal:\n")) + ("j" "journal" plain + "\n* Daily Notes\n\n* Goals\n+ []\n\n* Extras %?" + :target (file+head "%<%Y-%m-%d>.org" + "#+title: %<%Y-%m-%d>\n#+filetags: :journal:\n")))) + + (defun org-roam-ref-add-book () + "Insert org-link from Library." + (interactive) + (let ((book (format "file:%s" (read-file-name "Book: " (if is-zeus "/hdd/Library/" "~/Library/"))))) + book)) + + (defun org-roam-sync-notes () + "Sync org-oram notes" + (interactive) + (let ((git (executable-find "git")) + (default-directory org-roam-directory)) + (message "Synching org-roam notes %s" org-roam-directory) + (unless git + (error "Git not found, please install `git'")) + (unless (file-exists-p (expand-file-name ".git" gnosis-dir)) + (message "Creating git repository") + (vc-create-repo 'Git)) + (shell-command "git pull") + (shell-command (format "%s %s" git "add .")) + (shell-command (format "%s %s %s" git "commit -m" (shell-quote-argument "Update org-roam notes"))) + (vc-git-push nil)) + (funcall 'org-roam-db-sync)) + + :bind (("C-c n" . thanos/notes-map) + :map thanos/notes-map + ("t" . org-roam-buffer-toggle) + ("f" . org-roam-node-find) + ("i" . org-roam-node-insert) + ("d" . org-roam-dailies-goto-today) + ("D" . org-roam-dailies-goto-date) + :map org-mode-map + ("C-c C-." . org-roam-tag-add) + ("C-c i" . org-id-get-create))) + +(use-package org-roam-ui + :defer t) + +;; (use-package jabber +;; :defer t) + +(use-package modus-themes + :straight t + :config + (setf modus-themes-italic-constructs nil + modus-themes-bold-constructs nil + modus-themes-mixed-fonts nil + modus-themes-variable-pitch-ui nil + modus-themes-custom-auto-reload t + modus-themes-disable-other-themes t + modus-themes-prompts '(italic) + modus-themes-completions '((matches . (extrabold)) + (selection . (semibold italic text-also underline))) + 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) + ;; (bg-main "#1d2021") ;;grubox-hard + ;; (bg-main "#191919") ;; 1337 + ;; (bg-main "#1d1f21") ;; tomorrow night + ;; (bg-main "#151515") ;; jazz + (bg-main "#0C0C0C") ;; random black + ;; (bg-main "#171717") ;; badger + ;; (overline-heading-1 gold) + (fg-heading-1 red-warmer) + ;; (bg-heading-1 bg-blue-nuanced) + (bg-line-number-inactive unspecified) + (bg-line-number-active unspecified) + (bg-paren-match bg-magenta-intense) + (underline-paren-match fg-main) + (underline-err red-intense) + (underline-warning yellow-faint) + (underline-note cyan-faint) + (string "#86B187") + (border-mode-line-active unspecified) + (border-mode-line-inactive unspecified) + (bg-mode-line-active "#433F4f") ;; subtle lavender + (bg-mode-line-inactive "#1D1D1D") + ;; set fg from badger theme + (fg-mode-line-active "#F6F3E8") + (bg-hl-line bg-dim) + (cursor slate) + (prose-todo green-intense) + (prose-done bg-term-white) + (fg-prompt yellow-faint) + ,@modus-themes-preset-overrides-intense)) + ;; Headings + (setf modus-themes-headings + '((1 . (ultrabold 1.35)) + (2 . (semibold 1.2)) + (agenda-date . (1.3)) + (agenda-structure . (variable-pitch light 1.8)) + (t . (1.15)))) + ;; Load modus + (load-theme 'modus-vivendi t)) + +(use-package vertico + :ensure t + :config + (vertico-mode)) + +(use-package marginalia + :ensure t + :config + (marginalia-mode)) + +(use-package consult + :ensure t + :init (define-prefix-command 'thanos/search) + :bind (("C-x r d" . 'bookmark-delete) + ("C-x r C-r" . 'bookmark-rename) + ("C-x r C-j" . 'consult-register) + ("C-x r SPC" . 'consult-register-store) + ("C-x r b" . 'consult-bookmark) + ("C-c m" . 'consult-imenu) + ("C-x b" . 'consult-buffer) + ("M-y" . 'consult-yank-from-kill-ring) + ("C-s" . 'thanos/search) + :map thanos/search + ("f" . 'isearch-forward) + ("r" . 'isearch-backward) + ("s" . 'consult-line) + ("i" . 'change-inner) + ("C-f" . 'consult-find) + ("C-g" . 'consult-grep) + ("C-i" . 'consult-info) + ("C-l" . 'consult-locate) + :map project-prefix-map + ("b" . 'consult-project-buffer))) + +(use-package which-key + :ensure t + :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 + (setf elfeed-search-filter "@1-week-ago +unread -hackernoon" + browse-url-browser-function #'browse-url-default-browser) + ;; Feeds + (setf elfeed-feeds + '(("https://hackaday.com/blog/feed/" + hackaday linux) + ("https://thanosapollo.org/index.xml" + thanos) + ("http://wikileaks.org/feed" + wikileaks) + ("https://hackernoon.com/feed" + hackernoon) + ("https://torrentfreak.com/feed" + torrentfreak piracy) + ("https://www.science.org/action/showFeed?type=etoc&feed=rss&jc=sciimmunol" + science) + ("https://rss-bridge.thanosapollo.org/?action=display&bridge=CssSelectorBridge&home_page=https%3A%2F%2Fwww.medscape.com%2Findex%2Flist_13470_0&url_selector=a.title&url_pattern=viewarticle%2F.*&content_selector=div.article__main-content&content_cleanup=&title_cleanup=+-+Index&limit=&format=Atom" medscape med) + ("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://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))) + :bind (("C-x f" . elfeed) + :map elfeed-search-mode-map + ("v" . 'elfeed-mpv) + ("U" . 'elfeed-update)) + :hook ((elfeed-search-mode . (lambda () (display-line-numbers-mode 0))))) + +;; Python +(use-package python-mode + :defer t + :config + (add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))) + +(use-package pyenv + :defer t) + +(use-package elpy + :straight nil + :ensure nil + :init + (elpy-enable)) + +;; Clojure +(use-package cider + :defer t) + +(use-package clojure-mode + :defer t) + +(use-package rainbow-delimiters + :defer t + :hook ((emacs-lisp-mode . rainbow-delimiters-mode) + (lisp-mode . rainbow-delimiters-mode) + (clojure-mode . rainbow-delimiters-mode) + (scheme-mode . rainbow-delimiters-mode))) + +;; (use-package paredit +;; :ensure t +;; :hook ((emacs-lisp-mode . paredit-mode) +;; (lisp-mode . paredit-mode) +;; (clojure-mode . paredit-mode) +;; (scheme-mode . paredit-mode))) + +(use-package sly + :init (setf inferior-lisp-program "sbcl") + :defer t) + +(use-package helpful + :defer t + :bind (("C-h f" . 'helpful-callable) + ("C-h v" . 'helpful-variable) + ("C-h k" . 'helpful-key) + ("C-h x" . 'helpful-command) + ("C-h ." . 'helpful-at-point) + ("C-h F" . 'helpful-function) + ("C-h C-k" . 'helpful-kill-buffers) + ("C-h a" . 'apropos) + ("C-h C-m" . 'info-apropos))) + +(use-package ox-hugo + :ensure t + :config + (setf org-hugo-section "post")) + +(use-package json-mode + :defer t + :config + (add-to-list 'auto-mode-alist '("\\.json'" . json-mode))) + +(defun project-magit () + "Run magit-status in the current project's root." + (interactive) + (magit-status-setup-buffer (project-root (project-current t)))) + +(use-package magit + :defer t + :config + (setf magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1) + :bind (:map project-prefix-map ("g" . 'project-magit))) + +(use-package corfu + :ensure t + :config + (global-corfu-mode) + (corfu-popupinfo-mode) + (setf corfu-auto t + corfu-auto-delay 0.1 + corfu-auto-prefix 2 + corfu-cycle t + corfu-popupinfo-delay 0.3 + corfu-quit-at-boundary 'separator + corfu-quit-no-match t + corfu-preselect 'first + corfu-preview-current t + corfu-echo-mode t) + (setf indent-tabs-mode nil)) + +(defun insert-brackets (&optional arg) + "Insert ARG brackets." + (interactive "P") + (insert-pair arg ?\[ ?\])) + +(global-set-key (kbd "C-x M-[") 'insert-brackets) + + +(use-package orderless + :init (add-to-list 'completion-styles 'initials t) + :ensure t + :config + (setf completion-category-overrides '((file (style basic partial-completion))) + completion-styles '(orderless) + completion-cycle-threshold 2)) + +(use-package pdf-tools + :straight nil + :ensure nil + :config + (add-to-list 'auto-mode-alist '("\\.pdf\\'" . pdf-view-mode)) + :hook + ((pdf-view-mode . (lambda () + (display-line-numbers-mode 0) + ;; Guix package emacs-pdf-tools does not enable + ;; minor modes automatically + (pdf-tools-enable-minor-modes))))) + +(use-package markdown-mode + :defer t + :config + (setq markdown-header-scaling t + markdown-command "multimarkdown") + (add-to-list 'auto-mode-alist '("\\.md\\'" . gfm-mode)) + :hook ((markdown-mode . flyspell-mode))) + +(use-package org-auto-tangle + :defer t) + +(use-package org-present + :defer t) + +(use-package expand-region + :defer t) + +(use-package change-inner + :after expand-region + :bind ((:map thanos/search ("i" . 'change-inner)))) + +(use-package nov + :straight nil + :defer t + :config + (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))) + +(use-package eshell-syntax-highlighting + :defer t) + +(use-package emojify + :ensure t + :hook (erc-mode . emojify-mode) + :commands emojify-mode) + +(use-package flycheck-package + :ensure t + :after flycheck) + +(use-package flycheck + :ensure t + :config + (setf flycheck-emacs-lisp-load-path 'inherit) + (global-flycheck-mode) + :hook ((emacs-lisp-mode . (lambda () (flycheck-mode) (flycheck-package-setup))))) + +;; Shells +(use-package vterm + :straight nil + :ensure nil + :bind (("C-c v" . vterm) + :map vterm-mode-map + ("M-&" . 'async-shell-command) + ("C-c C-y" . 'vterm-copy-mode)) + :hook + ((vterm-mode . (lambda () (display-line-numbers-mode -1))))) + +(use-package shell + :defer t + :bind (("C-c V" . shell) + :map shell-mode-map + ("C-l" . 'comint-clear-buffer)) + :hook ((shell-mode . (lambda () (display-line-numbers-mode -1))))) + +(defvar thanos/aliases + '((g . magit) + (gl . magit-log) + (gc . magit-clone) + (d . dired) + (o . find-file) + (oo . find-file-other-window) + (ll . (lambda () (eshell/ls '-lha))) + (eshell/clear . eshell/clear-scrollback))) + +(defun thanos/set-eshell-aliases (aliases) + "Set ALIASES as eshell aliases." + (mapc (lambda (alias) + (defalias (car alias) (cdr alias))) + aliases)) + +(use-package eshell + :config + (setf eshell-highlight-prompt t) + (eshell-syntax-highlighting-global-mode 1) + :bind (("C-c e" . eshell) + :map eshell-mode-map + ("C-l" . eshell/clear-scrollback)) + :hook ((eshell-mode . (lambda () + (thanos/set-eshell-aliases thanos/aliases) + (display-line-numbers-mode -1))))) + +(use-package eat + :after 'eshell + :config + (add-hook 'eshell-load-hook #'eat-eshell-mode) + (setf eat-term-name "xterm-256color")) + +(use-package eshell-git-prompt + :config + (defun eshell-git-prompt-multiline () + "Eshell Git prompt inspired by spaceship-prompt." + (let (separator hr dir git git-dirty time sign command) + (setq separator (with-face " | " 'eshell-git-prompt-multiline-secondary-face)) + (setq hr (with-face (concat "\n" (make-string (/ (window-total-width) 2) ?─) "\n") 'eshell-git-prompt-multiline-secondary-face)) + (setq dir + (concat + (with-face "" 'eshell-git-prompt-directory-face) + (concat (abbreviate-file-name (eshell/pwd))))) + (setq git + (concat (with-face "⎇" 'eshell-git-prompt-exit-success-face) + (concat (eshell-git-prompt--branch-name)))) + (setq git-dirty + (when (eshell-git-prompt--branch-name) + (if (eshell-git-prompt--collect-status) + (with-face " ✎" 'eshell-git-prompt-modified-face) + (with-face " ✔" 'eshell-git-prompt-exit-success-face)))) + (setq time (with-face (format-time-string "%I:%M:%S %p") 'eshell-git-prompt-multiline-secondary-face)) + (setq sign + (if (= (user-uid) 0) + (with-face "\n#" 'eshell-git-prompt-multiline-sign-face) + (with-face "\nλ" 'eshell-git-prompt-multiline-sign-face))) + (setq command (with-face " " 'eshell-git-prompt-multiline-command-face)) + + ;; Build prompt + (eshell-git-prompt---str-read-only + (concat hr dir separator git git-dirty separator time sign command)))) + + (eshell-git-prompt-use-theme 'multiline)) + +;; Chat +(use-package jabber + :defer t + :config + (defun jabber-buffers-formats (&optional buffer-formats) + "Return jabber BUFFER-FORMATS without the format specifiers. + +By default, returns all jabber related buffers format." + (let ((buffer-formats (or buffer-formats '(jabber-chat-buffer-format + jabber-browse-buffer-format + jabber-roster-buffer + jabber-groupchat-buffer-format + jabber-muc-private-buffer-format)))) + (cl-loop for var in buffer-formats + for str = (symbol-value var) + for formatted-str = (when (stringp str) + ;; Remove format specifier and + ;; the following 2 char, or 1 if + ;; there is not second. + (replace-regexp-in-string "%.?" "" str)) + collect formatted-str))) + + (defun jabber-switch-to-buffer () + "Prompt the user to select a buffer whose name matches a list of strings." + (interactive) + (let* ((string-list (jabber-buffers-formats)) + (buffers-matching-strings + (cl-loop for buf in (buffer-list) + when (cl-loop for str in string-list + thereis (string-match-p str (buffer-name buf))) + collect (buffer-name buf)))) + (if buffers-matching-strings + (switch-to-buffer + (completing-read "Select jabber buffer: " buffers-matching-strings))) + (error "No jabber buffer found"))) + :bind (:map jabber-global-keymap + ("C-b" . 'jabber-switch-to-buffer))) + +(use-package erc + :defer t + :config + (unless (expand-file-name "erc" user-emacs-directory) + (make-directory (expand-file-name "erc" user-emacs-directory))) + (setf erc-modules + '(sasl netsplit fill button match track completion readonly + networks ring autojoin noncommands irccontrols move-to-prompt stamp + menu list log notifications) + erc-log-channels-directory (expand-file-name "erc" user-emacs-directory)) + :bind (("C-c E" . 'erc-libera) + :map erc-mode-map + ("C-c RET" . 'erc-cmd-QUERY))) + +;; (use-package erc-image +;; :ensure t +;; :after erc +;; :config +;; (setq erc-image-inline-rescale 300) +;; (add-to-list 'erc-modules 'image)) + +(use-package transmission + :defer t) + +(use-package sudo-edit + :defer t + :config + (setf sudo-edit-local-method "sudo")) + +(use-package dabbrev + :defer t + :config + (setf dabbrev-ignored-buffer-regexps '("\\.\\(?:pdf\\|jpe?g\\|png\\)\\'"))) + +(use-package xref + :defer t + :config + (setf xref-show-xrefs-function #'consult-xref + xref-show-definitions-function #'consult-xref)) + +(use-package moc-player + :defer t + :straight '(moc-player :local-repo "~/Dev/emacs-lisp/moc-player") + :init (define-prefix-command 'thanos/mocp) + :bind (("C-z" . thanos/mocp) + :map thanos/mocp + ("SPC" . 'mocp-toggle-pause) + ("n" . 'mocp-next) + ("p" . 'mocp-previous))) + +;; My packages +(when (or is-zeus is-hermes) + (use-package yeetube + :init (define-prefix-command 'thanos/yeetube-map) + :straight nil + :ensure t + :config + (setf yeetube-results-limit 20 + yeetube-mpv-disable-video t + yeetube-display-thumbnails nil + yeetube-play-function #'yeetube-mpv-play) + + (defun yeetube-download-videos-ffmpeg () + "Download videos using ffmpeg." + (interactive) + (let ((url "") + (name "") + (download-counter 1) + (stored-contents nil)) + ;; Read links and names until "q" is entered + (while (not (string= url "q")) + (setf url (read-string "Enter URL (q to quit): ")) + (unless (string= url "q") + (setf name (read-string (format "Custom name (download counter: %d) " download-counter))) + (push (cons url name) stored-contents) + (setf download-counter (1+ download-counter)))) + ;; Process the collected links and names + (dolist (pair stored-contents) + (let ((url (car pair)) + (name (cdr pair))) + (async-shell-command + (format + "ffmpeg -protocol_whitelist file,crypto,data,https,tls,tcp -stats -i '%s' -codec copy '%s.mp4'" + url name)))))) + + (defun yeetube-download-vimeo-videos () + "Download videos from vimeo services." + (interactive) + (let ((url "") + (name "") + (download-counter 1)) + (while (not (string= url "q")) + (setf url (read-string "Enter URL (q to quit): ")) + (unless (string= url "q") + (setf name (read-string (format "Custom name (download counter: %d) " download-counter))) + (setf download-counter (1+ download-counter)) + (call-process-shell-command + (format + "yt-dlp '%s' -o '%s'" + (replace-regexp-in-string "\\.json" ".m3u8" url) name) + nil 0))))) + + :bind (("C-c y" . 'thanos/yeetube-map) + :map thanos/yeetube-map + ("s" . 'yeetube-search) + ("b" . 'yeetube-play-saved-video) + ("d" . 'yeetube-download-videos) + ("C-d" . 'yeetube-download-vimeo-videos) + ("p" . 'yeetube-mpv-toggle-pause) + ("v" . 'yeetube-mpv-toggle-video) + ("V" . 'yeetube-mpv-toggle-no-video-flag) + ("C-p" . 'yeetube-mpv-toggle-video) + ("k" . 'yeetube-remove-saved-video))) + + (use-package gnosis + :straight (gnosis :local-repo "~/Dev/emacs-lisp/gnosis") + :ensure t + :init (define-prefix-command 'thanos/gnosis-map) + :config + (setf gnosis-vc-auto-push t + gnosis-mcq-display-choices nil + gnosis-image-width nil + gnosis-image-height nil) + (gnosis-modeline-mode) + :bind (("C-r" . thanos/gnosis-map) + :map thanos/gnosis-map + ("r" . 'gnosis-review) + ("a" . 'gnosis-add-note) + ("C-d" . 'gnosis-dashboard) + ("d" . 'gnosis-add-deck) + ("t" . 'gnosis-test-start))) + + ;; Run vc-pull on startup + (gnosis-vc-pull) + + (use-package pcmpl-emerge + :defer t + :straight (pcmpl-emerge :local-repo "~/Dev/emacs-lisp/pcmpl-emerge")) + + (use-package pcmpl-rc + :straight (pcmpl-rc :local-repo "~/Dev/emacs-lisp/pcmpl-rc") + :defer t) + + (use-package pcmpl-tailscale + :straight (pcmpl-tailscale :local-repo "~/Dev/emacs-lisp/pcmpl-taiscale") + :defer t)) + +;; Emacs dev + +(use-package package-lint + :defer t) + +;; AI tools +(use-package gptel + :defer t + :config + (setf gptel-api-key (password-store-get-field "openai/openai@thanosapollo.org" "api") + gptel-default-mode 'org-mode) + (setq-default gptel-model "ChatGPT:gpt-4" + gptel-backend (gptel-make-ollama "Ollama" + :host "zeus:11434" + :stream t + :models '("llama2:latest" "zephyr:latest" "codellama:latest" + "mistral:latest" "mixtral:latest" "neural-chat:latest" + "dolphin-mixtral:latest")) + gptel-directives '((default . "You are a large language model living in Emacs and a helpful assistant. Respond concisely.") + (programming . "You are a large language model and a careful programmer. Provide code and only code as output without any additional text, prompt or note.") + (epictetus . "You are Epictetus, the stoic philosopher from Nicopolis. Respond concisely as Epictetus.") + (med . "You are a medical professor within the Emacs. Respond concisely.") + (code-review . "You are an expert programmer within Emacs reviewing code. Respond concisely") + (writer . "You are an expert writer and FOSS enthusiast. Improve only the article sections provided as a hacker, do not add extra paragraphs."))) + :bind (("C-c g" . 'gptel-send) + :map gptel-mode-map + ("C-c h" . 'gptel-menu))) + +;; (use-package copilot +;; :straight (copilot :host github :repo "zerolfx/copilot.el" :files ("dist" "*.el")) +;; :bind (:map copilot-mode-map +;; ("M-TAB" . 'copilot-accept-completion-by-line) +;; ("C-M-" . 'copilot-accept-completion-by-word) +;; ("C-M-n" . 'copilot-next-completion) +;; ("C-M-p" . 'copilot-previous-completion))) + + +;; Password-store +(use-package password-store + :init (define-prefix-command 'thanos/pass) + :defer t + :config + (setf password-store-password-length (+ 20 (random 20))) + :bind (("C-c p" . 'thanos/pass) + :map thanos/pass + ("i" . 'password-store-insert) + ("e" . 'password-store-edit) + ("g" . 'password-store-generate) + ("c" . 'password-store-copy) + ("s" . 'smtp-get-pass))) + +(defun thanos/pass-launcher () + "Launch Emacs as a front-end for pass." + (interactive) + (unwind-protect + (with-selected-frame + (make-frame '((name . "thanos/pass-launcher") + (fullscreen . 0) + (undecorated . t) + (minibuffer . only) + (width . 70) + (height . 15))) + (let* ((choice (completing-read "Choose an action: " + '("AUTO" "COPY PASS" "COPY USERNAME" "EDIT" "GENERATE"))) + (action (pcase choice + ("AUTO" #'(lambda (entry) (let ((user (password-store-get-field entry "user")) + (pass (password-store-get entry))) + (start-process-shell-command + "wtype" nil + (format "sleep 0.3 && wtype %s -P tab %s" + (shell-quote-argument (if user user "thanosapollo")) + (shell-quote-argument pass)))))) + ("COPY PASS" #'password-store-copy) + ("COPY USERNAME" #'(lambda (entry) (password-store-copy-field entry "user"))) + ("EDIT" #'password-store-edit) + ("GENERATE" #'password-store-generate)))) + (funcall action (completing-read "Search: " (password-store-list))) + (delete-frame))))) + +(defun smtp-get-pass () + "Get password for smtp." + (interactive) + (password-store-copy-field "fastmail.com/thanosapollo@fastmail.com" "smtp")) + +(use-package package-lint + :defer t) + +(use-package consult-mu + :straight (consult-mu :type git :host github :repo "armindarvish/consult-mu" :files (:defaults "extras/*.el")) + :after (mu4e consult) + :bind (:map mu4e-main-mode-map + ("M-s" . 'consult-mu) + :map mu4e-view-mode-map + ("M-s" . 'consult-mu) + :map mu4e-headers-mode-map + ("M-s" . 'consult-mu))) + +;; Guix Setup +;; Yasnippet configuration +(with-eval-after-load 'yasnippet + (add-to-list 'yas-snippet-dirs "~/Dev/guile/guix/etc/snippets/yas")) +;; ;; Tempel configuration +;; (with-eval-after-load 'tempel +;; ;; Ensure tempel-path is a list -- it may also be a string. +;; (unless (listp 'tempel-path) +;; (setq tempel-path (list tempel-path))) +;; (add-to-list 'tempel-path "~/Dev/guile/guix/etc/snippets/tempel/*")) + +(use-package yaml-mode + :defer t) + +;(load-file "~/Dev/guile/guix/etc/copyright.el") + +(setq copyright-names-regexp + (format "%s <%s>" user-full-name user-mail-address)) + +(when (or is-zeus is-hermes) + (use-package mu4e + :straight nil + :ensure nil + :init + + :config + (require 'server) + (require 'mu4e) + + (setf mu4e-get-mail-command "mbsync -a") + + (when (and is-zeus (server-running-p)) + (setf mu4e-update-interval (* 10 60))) + + (defun set-mu4e-context (context-name full-name mail-address signature) + "Return a mu4e context named CONTEXT-NAME with :match-func matching + folder name CONTEXT-NAME in Maildir. The context's `user-mail-address', + `user-full-name' and `mu4e-compose-signature'`smtpmail-smpt-server' is set to MAIL-ADDRESS + FULL-NAME SIGNATURE and SERVER respectively. + Special folders are set to context specific folders." + (let ((dir-name (concat "/" context-name))) + (make-mu4e-context + :name context-name + ;; we match based on the maildir of the message + :match-func + `(lambda (msg) + (when msg + (string-match-p + ,(concat "^" dir-name) + (mu4e-message-field msg :maildir)))) + :vars + `((user-mail-address . ,mail-address) + (user-full-name . ,full-name) + (mu4e-sent-folder . ,(concat dir-name "/Sent")) + (mu4e-drafts-folder . ,(concat dir-name "/Drafts")) + (mu4e-trash-folder . ,(concat dir-name "/Trash")) + (mu4e-trash-folder . ,(concat dir-name "/Starred")) + (mu4e-refile-folder . ,(concat dir-name "/Archive")) + (mu4e-compose-signature . ,signature))))) + + ;;Fixing duplicate UID errors when using mbsync and mu4e + (setf mu4e-change-filenames-when-moving t + mu4e-maildir-shortcuts + '(("/Fastmail/Inbox" . ?i) + ("/Drafts" . ?d) + ("/Sent" . ?s) + ("/Fastmail/Emacs/dev" . ?e) + ("/MUSofia/[Gmail]/All Mail" . ?u) + ("/Fastmail/Gentoo" . ?g))) + + (setf mu4e-contexts + (list + (make-mu4e-context + :name "Public" + :match-func + (lambda (msg) + (when msg + (string-prefix-p "/Fastmail" (mu4e-message-field msg :maildir)))) + :vars '((user-mail-address . "public@thanosapollo.org") + (user-full-name . "Thanos Apollo") + (smtpmail-smtp-server . "smtp.fastmail.com") + (smtpmail-smtp-service . 465) + (smtpmail-stream-type . ssl) + (mu4e-drafts-folder . "/Drafts") + (mu4e-sent-folder . "/Sent") + (mu4e-refile-folder . "/Archive") + (mu4e-trash-folder . "/Trash"))) + (make-mu4e-context + :name "MUSofia" + :match-func + (lambda (msg) + (when msg + (string-prefix-p "/MUSofia" (mu4e-message-field msg :maildir)))) + :vars '((user-mail-address . "104111@students.mu-sofia.bg") + (user-full-name . "Thanos Apollo") + (smtpmail-smtp-server . "smtp.gmail.com") + (smtpmail-smtp-service . 465) + (smtpmail-stream-type . ssl))))) + + (setf message-send-mail-function 'smtpmail-send-it + mu4e-compose-signature "\nThanos Apollo\n \nhttps://thanosapollo.org\n +62B7 58D0 F671 9938 BC09 CECA 339F 736C 3A72 0928\n" + mu4e-compose-context-policy 'ask) + + (setf mu4e-view-actions + (delete-dups + (append + '(("gapply git patches" . mu4e-action-git-apply-patch) + ("mgit am patch" . mu4e-action-git-apply-mbox) + ("bb4 am patch" . mu4e-action-git-apply-b4) + ("ssetup reword list with b4" . mu4e-action-setup-reword-b4) + ("crun checkpatch script" . my-mu4e-action-run-check-patch) + ("MCheck if merged" . my-mu4e-action-check-if-merged))))) + + :bind (("C-x m" . 'mu4e)) + :hook + ;; Sign messages + ((message-send . 'mml-secure-message-sign-pgpmime) + ;; Disable line numbers & autosave + (mu4e-main-mode . (lambda () (display-line-numbers-mode -1) (auto-save-mode -1)))))) + +;;; Random commands ;;;; +;;;;;;;;;;;;;;;;;;;;;;;; + +;; Virtual machines +(defvar vm-directory "~/Virtual/") + +(defun vm-create-image () + "Create qcow2 image." + (interactive) + (let ((name (format "%s%s.qcow2" vm-directory (read-string "Name: "))) + (size (format "%s" (read-string "Size(G): ")))) + (shell-command + (format "qemu-img create -f qcow2 %s %sG" name size)))) + + +(defun vm-run () + "Spawn Virtual Machine." + (interactive) + (let ((memory (format "%sG" (read-string "Memory(G): "))) + (cores (read-string "Cores: ")) + (image (read-file-name "Image: " vm-directory)) + (iso (if (y-or-n-p "Load iso? ") + (read-file-name "ISO: ") + nil))) + (async-shell-command + (format "qemu-system-x86_64 -enable-kvm -m %s -smp %s -hda %s -vga virtio -device virtio-serial-pci -netdev user,id=vmnic,hostfwd=tcp::2222-:22 -device e1000,netdev=vmnic %s" + memory cores image (if iso (concat "-cdrom " iso) ""))))) + +;; misc +(defun thanos/run-in-background (command) + "Run COMMAND in the background." + (let ((command-parts (split-string command "[ ]+"))) + (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts))))) + +(defun create-text-scratch () + "Create a scratch buffer." + (interactive) + (switch-to-buffer (get-buffer-create "*Text Scratch*")) + (org-mode)) + +(defun create-scratch () + "Create scratch buffer." + (interactive) + (switch-to-buffer (get-buffer-create "*scratch*")) + (emacs-lisp-mode)) + +(defvar-keymap thanos/create-map + :doc "Create custom buffers" + "t" #'create-text-scratch + "e" #'create-scratch) + +;; Theming + +(defvar wallpapers-dir "~/wallpapers/") + +(defun thanos/load-theme (&optional theme) + "Disable current theme and load a new THEME." + (interactive) + (let ((theme (or theme (intern (completing-read "Theme: " (custom-available-themes)))))) + (disable-theme (car custom-enabled-themes)) + (load-theme theme t))) + +(defun thanos/wallpaper-set (image) + "Set IMAGE as wallpaper, using feh." + (let ((command (if is-zeus "swaybg -o '*' -i" "feh --bg-scale"))) + ;; Kill previous swaybg + (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) + 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))) + +(defvar-keymap thanos/applications-map + :doc "Thanos commonly used programs" + "t" #'thanos/load-theme + "w" #'thanos/wallpaper-select + "C-c" thanos/create-map) + +(define-key global-map (kbd "C-c a") thanos/applications-map) + +(defun thanos/iimage-mode-buffer (arg) + "Display images if ARG is non-nil, undisplay them otherwise." + (let ((image-path (cons default-directory iimage-mode-image-search-path)) + (edges (window-inside-pixel-edges (get-buffer-window))) + file) + (with-silent-modifications + (save-excursion + (dolist (pair iimage-mode-image-regex-alist) + (goto-char (point-min)) + (while (re-search-forward (car pair) nil t) + (when (and (setq file (match-string (cdr pair))) + (setq file (locate-file file image-path))) + (if arg + (add-text-properties + (match-beginning 0) (match-end 0) + `(display + ,(create-image file nil nil + :max-width 120 + :max-height 120) + keymap ,image-map + modification-hooks + (iimage-modification-hook))) + (remove-list-of-text-properties + (match-beginning 0) (match-end 0) + '(display modification-hooks)))))))))) + +(define-minor-mode thanos/iimage-mode nil + :group 'iimage :lighter " iImg" + (thanos/iimage-mode-buffer thanos/iimage-mode)) + +;; Font +(custom-set-faces + (if is-hermes '(default ((t (:inherit nil :height 120 :family "Jetbrains Mono")))) + '(default ((t (:inherit nil :height 130 :family "Jetbrains Mono"))))) + '(variable-pitch ((t (:inherit t :family "Iosevka Aile")))) + '(org-modern-symbol ((t (:inherit t :family "Iosevka Aile"))))) + +;;; init.el ends here diff --git a/.config/sway/config b/.config/sway/config new file mode 100644 index 0000000..8eaa6d6 --- /dev/null +++ b/.config/sway/config @@ -0,0 +1,273 @@ +## Mod key +set $mod Mod4 + +exec sudo /home/thanos/.local/bin/tailscaled +exec waybar +bindsym $mod+z exec waybar +bindsym $mod+o exec killall -SIGUSR1 waybar + +# Workspace switch +bindsym $mod+period workspace back_and_forth + +bindsym $mod+slash workspace next +bindsym $mod+comma workspace prev +## Setup monitors & wallpapers +output DP-2 pos 0 0 res 2560x1440 bg ~/wallpapers/colors-fantasy.jpg stretch +output HDMI-A-1 pos 2560 0 res 2560x1440 bg ~/wallpapers/colors-fantasy.jpg fill transform 270 + +default_border pixel 3 +default_floating_border pixel 3 +gaps inner 5 +gaps outer 0 +bindsym $mod+shift+g exec swaymsg gaps outer all set 0 && swaymsg gaps inner all set 5 +bindsym $mod+g exec swaymsg gaps outer all set 0 && swaymsg gaps inner all set 0 + +# Activate smart borders (always) +smart_borders on +#smart_gaps on + +# Always float certain windows # +#swaymsg -t get_tree | grep app_id + for_window [app_id="pop-up"] floating enable + for_window [app_id="thanos/pass-launcher"] floating enable + for_window [app_id="bubble"] floating enable + for_window [app_id="task_dialog"] floating enable + for_window [app_id="Preferences"] floating enable + for_window [app_id="dialog"] floating enable + for_window [app_id="menu"] floating enable + for_window [app_id="Organizer"] floating enable + for_window [app_id="About"] floating enable + for_window [app_id="toolbox"] floating enable + for_window [app_id="page-info"] floating enable + for_window [app_id="webconsole"] floating enable + for_window [app_id="Authy"] floating enable + for_window [app_id="termfloat"] floating enable + for_window [app_id="termfloat"] resize set height 540 + for_window [app_id="termfloat"] resize set width 960 + for_window [app_id="mpv"] floating enable + for_window [app_id="mpv"] resize set height 540 + for_window [app_id="mpv"] resize set width 960 + for_window [app_id="Nautilus"] floating enable + for_window [app_id="Nautilus"] resize set height 540 + for_window [app_id="Nautilus"] resize set width 960 + +# Sticky floating windows(sticky enable|disable|toggle) + for_window [app_id="danmufloat"] floating enable + for_window [app_id="danmufloat"] sticky enable + for_window [app_id="danmufloat"] resize set height 540 + for_window [app_id="danmufloat"] resize set width 960 + +# Program Opacity + for_window [app_id="telegram"] opacity 0.95 + for_window [app_id="danmufloat"] opacity 0.80 + # for_window [app_id="icalingua"] opacity 0.95 + # for_window [class="netease-cloud-music"] opacity 0.90 + +# Focus follows mouse +focus_follows_mouse yes + +# Autostart # + +#exec_always --no-startup-id dunst & + +## Keyboard setup + +# NOTE: for bg phonetic use ,bg(phonetic) + input "type:keyboard" { + xkb_layout us,gr + xkb_options grp:win_space_toggle + } + + +# set gtk+ theme +set $gnome-schema org.gnome.desktop.interface + +# Window colours: border background text + # client.unfocused #2e3440 #1f222d #888888 + # client.focused_inactive #2e3440 #1f222d #888888 + # client.placeholder #2e3440 #1f222d #888888 + # client.urgent #D08770 #D08770 #ffffff + # client.background #242424 +client.focused #2D2D2D #2D2D2D #ffffff #ffffff #c6c6c6 +client.focused_inactive #0f1212 #0f1212 #ffffff #0f1212 #0f1212 +client.unfocused #2D2D2D #000000 #c6c6c6 #000000 #000000 +client.urgent #0f1212 #FF5555 #F8F8F2 #FF5555 #FF5555 +client.placeholder #000000 #000000 #F8F8F2 #000000 #000000 + +# TODO Direction keys, like Emacs + set $left h + set $down j + set $up k + set $right l + +#----------------------------------# +# Your preferred terminal emulator # +#----------------------------------# + set $term emacsclient -c + +# Control volume,monitor brightness,media players # + bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% + bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% + bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle + bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle + bindsym XF86MonBrightnessUp exec light -A 5 + bindsym XF86MonBrightnessDown exec light -U 5 + bindsym XF86AudioPlay exec playerctl play-pause + bindsym XF86AudioNext exec playerctl next + bindsym XF86AudioPrev exec playerctl previous + +# Key bindings --# + bindsym $mod+Return exec $term + bindsym $mod+Shift+Return exec kitty --class="termfloat" + bindsym $mod+Shift+m exec kitty --class="musicfox" --hold sh -c "musicfox" + bindsym $mod+Shift+d exec kitty --class="danmufloat" --hold sh -c "cd /home/ruixi/Codelearning/go/src/bilibili_live_tui/ && export TERM=xterm-256color && ./main" + + bindsym $mod+Shift+x exec --no-startup-id ~/.config/sway/swaylock.sh + bindsym $mod+t exec --no-startup-id telegram-desktop + bindsym $mod+bracketleft exec --no-startup-id grimshot --notify save area ~/Pictures/$(date "+%Y-%m-%d"T"%H:%M:%S_no_watermark").png + bindsym $mod+bracketright exec --no-startup-id grimshot --notify copy area + bindsym $mod+a exec --no-startup-id ~/.config/sway/grimshot_watermark.sh + + + # Kill focused window + bindsym $mod+q kill + + # Start your launcher + bindsym $mod+r exec fuzzel + + # Reload the configuration file + bindsym $mod+Shift+r reload + + # Exit sway (logs you out of your Wayland session) + bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' + + # Drag floating windows by holding down $mod and left mouse button. + # Resize them with right mouse button + $mod. + # Despite the name, also works for non-floating windows. + # Change normal to inverse to use left mouse button for resizing and right + # mouse button for dragging. + floating_modifier $mod normal + +# Moving around: # + # Move your focus around + bindsym $mod+$left focus left + bindsym $mod+$down focus down + bindsym $mod+$up focus up + bindsym $mod+$right focus right + # Or use $mod+[up|down|left|right] + bindsym $mod+Left focus left + bindsym $mod+Down focus down + bindsym $mod+Up focus up + bindsym $mod+Right focus right + + # Move the focused window with the same, but add Shift + bindsym $mod+Shift+$left move left + bindsym $mod+Shift+$down move down + bindsym $mod+Shift+$up move up + bindsym $mod+Shift+$right move right + # Ditto, with arrow keys + bindsym $mod+Shift+Left move left + bindsym $mod+Shift+Down move down + bindsym $mod+Shift+Up move up + bindsym $mod+Shift+Right move right + +# Workspaces: + # Switch to workspace + bindsym $mod+1 workspace number 1 + bindsym $mod+2 workspace number 2 + bindsym $mod+3 workspace number 3 + bindsym $mod+4 workspace number 4 + bindsym $mod+5 workspace number 5 + bindsym $mod+6 workspace number 6 + bindsym $mod+7 workspace number 7 + bindsym $mod+8 workspace number 8 + bindsym $mod+9 workspace number 9 + bindsym $mod+0 workspace number 10 + # Move focused container to workspace + bindsym $mod+Shift+1 move container to workspace number 1 + bindsym $mod+Shift+2 move container to workspace number 2 + bindsym $mod+Shift+3 move container to workspace number 3 + bindsym $mod+Shift+4 move container to workspace number 4 + bindsym $mod+Shift+5 move container to workspace number 5 + bindsym $mod+Shift+6 move container to workspace number 6 + bindsym $mod+Shift+7 move container to workspace number 7 + bindsym $mod+Shift+8 move container to workspace number 8 + bindsym $mod+Shift+9 move container to workspace number 9 + bindsym $mod+Shift+0 move container to workspace number 10 + # move focused container to workspace(follow) + bindsym $mod+Ctrl+1 move container to workspace number 1, workspace 1 + bindsym $mod+Ctrl+2 move container to workspace number 2, workspace 2 + bindsym $mod+Ctrl+3 move container to workspace number 3, workspace 3 + bindsym $mod+Ctrl+4 move container to workspace number 4, workspace 4 + bindsym $mod+Ctrl+5 move container to workspace number 5, workspace 5 + bindsym $mod+Ctrl+6 move container to workspace number 6, workspace 6 + bindsym $mod+Ctrl+7 move container to workspace number 7, workspace 7 + bindsym $mod+Ctrl+8 move container to workspace number 8, workspace 8 + bindsym $mod+Ctrl+9 move container to workspace number 9, workspace 9 + bindsym $mod+Ctrl+0 move container to workspace number 10, workspace 10 + # Note: workspaces can have any name you want, not just numbers. + # We just use 1-10 as the default. +# Layout stuff: + # You can "split" the current object of your focus with + # $mod+semicolon or $mod+apostrophe, for horizontal and vertical splits + # respectively. + bindsym $mod+semicolon splitv + bindsym $mod+apostrophe splith + + # Switch the current container between different layout styles + bindsym $mod+s layout stacking + bindsym $mod+w exec emacsclient -e '(thanos/pass-launcher)' + bindsym $mod+e layout toggle split + + # Make the current focus fullscreen + bindsym $mod+f fullscreen + + # Toggle the current focus between tiling and floating mode + bindsym $mod+Shift+space floating toggle + + # Swap focus between the tiling area and the floating area + bindsym $mod+space focus mode_toggle + + # Move focus to the parent container + bindsym $mod+p focus parent + # Move focus the child container + bindsym $mod+c focus child + +# Scratchpad: # +## hide | show window(minus is "-" and plus is "+".) +bindsym $mod+minus move scratchpad +bindsym $mod+equal scratchpad show + +#----------------------# +# Resizing containers: # +#----------------------# +#bindsym $mod+r mode "resize" +mode "resize" { + # left will shrink the containers width + # right will grow the containers width + # up will shrink the containers height + # down will grow the containers height + bindsym $left resize shrink width 10px + bindsym $up resize grow height 10px + bindsym $down resize shrink height 10px + bindsym $right resize grow width 10px + + # Ditto, with arrow keys + bindsym Left resize shrink width 10px + bindsym Up resize grow height 10px + bindsym Down resize shrink height 10px + bindsym Right resize grow width 10px + + # Return to default mode + bindsym Return mode "default" + bindsym Escape mode "default" +} +## Better to resize window +bindsym Shift+Ctrl+h resize shrink width 5 px or 5 ppt +bindsym Shift+Ctrl+k resize grow height 5 px or 5 ppt +bindsym Shift+Ctrl+j resize shrink height 5 px or 5 ppt +bindsym Shift+Ctrl+l resize grow width 5 px or 5 ppt +bindsym Shift+Ctrl+Left resize shrink width 5 px or 5 ppt +bindsym Shift+Ctrl+Up resize grow height 5 px or 5 ppt +bindsym Shift+Ctrl+Down resize shrink height 5 px or 5 ppt +bindsym Shift+Ctrl+Right resize grow width 5 px or 5 ppt diff --git a/.config/waybar/config b/.config/waybar/config new file mode 100644 index 0000000..66599a9 --- /dev/null +++ b/.config/waybar/config @@ -0,0 +1,123 @@ +// -*- mode: json -*- + +{ + "layer": "top", + "position": "top", + + "modules-left": [ + "sway/workspaces", + "custom/right-arrow-dark" + ], + "modules-center": [ + "custom/left-arrow-dark", + "clock#1", + "custom/left-arrow-light", + "custom/left-arrow-dark", + "clock#2", + "custom/right-arrow-dark", + "custom/right-arrow-light", + "clock#3", + "custom/right-arrow-dark" + ], + "modules-right": [ + "custom/left-arrow-dark", + "pulseaudio", + "custom/left-arrow-light", + "custom/left-arrow-dark", + "memory", + "custom/left-arrow-light", + "custom/left-arrow-dark", + "cpu", + "custom/left-arrow-light", + "custom/left-arrow-dark", + "battery", + "custom/left-arrow-light", + "custom/left-arrow-dark", + "disk", + "custom/left-arrow-light", + "custom/left-arrow-dark", + "tray" + ], + + "custom/left-arrow-dark": { + "format": "", + "tooltip": false + }, + "custom/left-arrow-light": { + "format": "", + "tooltip": false + }, + "custom/right-arrow-dark": { + "format": "", + "tooltip": false + }, + "custom/right-arrow-light": { + "format": "", + "tooltip": false + }, + + "sway/workspaces": { + "disable-scroll": true, + "format": "{name}" + }, + + "clock#1": { + "format": "{:%a}", + "tooltip": false + }, + "clock#2": { + "format": "{:%H:%M}", + "tooltip": false + }, + "clock#3": { + "format": "{:%Y-%m-%d}", + "tooltip": false + }, + + "pulseaudio": { + "format": "VOL: {volume:2}%", + "format-bluetooth": "{icon} {volume}%", + "format-muted": "MUTE", + "format-icons": { + "headphones": "", + "default": [ + "", + "" + ] + }, + "scroll-step": 5, + "on-click": "pamixer -t", + "on-click-right": "pavucontrol" + }, + "memory": { + "interval": 5, + "format": "Mem {}%" + }, + "cpu": { + "interval": 5, + "format": "CPU {usage:2}%" + }, + "battery": { + "states": { + "good": 95, + "warning": 30, + "critical": 15 + }, + "format": "{icon} {capacity}%", + "format-icons": [ + "", + "", + "", + "", + "" + ] + }, + "disk": { + "interval": 5, + "format": "Disk {percentage_used:2}%", + "path": "/" + }, + "tray": { + "icon-size": 10 + } +} diff --git a/.config/waybar/style.css b/.config/waybar/style.css new file mode 100644 index 0000000..4c6cbf0 --- /dev/null +++ b/.config/waybar/style.css @@ -0,0 +1,74 @@ +* { + font-size: 15px; + font-family: monospace; +} + +window#waybar { + background: #292b2e; + color: #fdf6e3; +} + +#custom-right-arrow-dark, +#custom-left-arrow-dark { + color: #1a1a1a; +} +#custom-right-arrow-light, +#custom-left-arrow-light { + color: #292b2e; + background: #1a1a1a; +} + +#workspaces, +#clock.1, +#clock.2, +#clock.3, +#pulseaudio, +#memory, +#cpu, +#battery, +#disk, +#tray { + background: #1a1a1a; +} + +#workspaces button { + padding: 0 2px; + color: #fdf6e3; +} +#workspaces button.focused { + color: #268bd2; +} +#workspaces button:hover { + box-shadow: inherit; + text-shadow: inherit; +} +#workspaces button:hover { + background: #1a1a1a; + border: #1a1a1a; + padding: 0 3px; +} + +#pulseaudio { + color: #268bd2; +} +#memory { + color: #2aa198; +} +#cpu { + color: #6c71c4; +} +#battery { + color: #859900; +} +#disk { + color: #b58900; +} + +#clock, +#pulseaudio, +#memory, +#cpu, +#battery, +#disk { + padding: 0 10px; +} diff --git a/alacritty.toml b/alacritty.toml deleted file mode 100644 index 327ef67..0000000 --- a/alacritty.toml +++ /dev/null @@ -1,8 +0,0 @@ -[window] -opacity = 0.9 - -[colors] -primary.background="#0C0C0C" - -[font] -normal={family="Jetbrains Mono", style="Regular"} diff --git a/emacs.el b/emacs.el deleted file mode 100644 index f9df16d..0000000 --- a/emacs.el +++ /dev/null @@ -1,1280 +0,0 @@ -;;; emacs.el --- Welcome to my Emacs configuration! -*- lexical-binding: t; -*- - -;; Copyright (C) 2023 Thanos Apollo - -;; Author: Thanos Apollo - -;; 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 . - -;;; Commentary: -;; ╭━━━━┳╮╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━━━╮╱╱╱╱╱╭╮╭╮╱╱╱╱╱╱╱╱╭━━━╮ -;; ┃╭╮╭╮┃┃╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃╭━╮┃╱╱╱╱╱┃┃┃┃╱╱╱╱╱╱╱╱┃╭━━╯ -;; ╰╯┃┃╰┫╰━┳━━┳━╮╭━━┳━━╮┃┃╱┃┣━━┳━━┫┃┃┃╭━━╮╱╱╱╱┃╰━━┳╮╭┳━━┳━━┳━━╮ -;; ╱╱┃┃╱┃╭╮┃╭╮┃╭╮┫╭╮┃━━┫┃╰━╯┃╭╮┃╭╮┃┃┃┃┃╭╮┃╭━━╮┃╭━━┫╰╯┃╭╮┃╭━┫━━┫ -;; ╱╱┃┃╱┃┃┃┃╭╮┃┃┃┃╰╯┣━━┃┃╭━╮┃╰╯┃╰╯┃╰┫╰┫╰╯┃╰━━╯┃╰━━┫┃┃┃╭╮┃╰━╋━━┃ -;; ╱╱╰╯╱╰╯╰┻╯╰┻╯╰┻━━┻━━╯╰╯╱╰┫╭━┻━━┻━┻━┻━━╯╱╱╱╱╰━━━┻┻┻┻╯╰┻━━┻━━╯ -;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃┃ -;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰╯ -;;; Code: - -(setf user-full-name "Thanos Apollo" - user-mail-address "public@thanosapollo.org") - -(defvar is-zeus (equal (system-name) "zeus")) -(defvar is-hermes (equal (system-name) "hermes")) -(defvar is-phone (equal (system-name) "localhost")) - -;; Autoinsert -(auto-insert-mode 1) - -(setq auto-insert-alist '((python-mode . "python.template")) - auto-insert-directory (locate-user-emacs-file "insert")) - -(add-to-list 'completion-styles 'initials t) - -(setf tab-always-indent 'complete) - -;; xref -(setf xref-show-xrefs-function #'consult-xref - xref-show-definitions-function #'consult-xref) - -;; Set and load custom.el -(setf custom-file (locate-user-emacs-file "custom.el")) -(load custom-file 'noerror) - -;; Enable use-package support for imenu -(setf use-package-enable-imenu-support t) - -;; Install straight.el -(defvar bootstrap-version) - -(let ((bootstrap-file - (expand-file-name - "straight/repos/straight.el/bootstrap.el" - (or (bound-and-true-p straight-base-dir) - user-emacs-directory))) - (bootstrap-version 7)) - (unless (file-exists-p bootstrap-file) - (with-current-buffer - (url-retrieve-synchronously - "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" - 'silent 'inhibit-cookies) - (goto-char (point-max)) - (eval-print-last-sexp))) - (load bootstrap-file nil 'nomessage)) - -(setq package-enable-at-startup nil) - -(require 'straight) - -(setf straight-use-package-by-default t) - -(setf straight-recipe-overrides - '((transmission :type git :host nil :repo "git@thanosapollo.org:/var/git/transmission.git") - ;; (yeetube :type git :host nil :repo "git@thanosapollo.org:/var/git/yeetube.git") - (gnosis :type git :host nil :repo "git@thanosapollo.org:/var/git/gnosis.git") - (pcmpl-emerge :type git :host nil :repo "git@thanosapollo.org:/var/git/pcmpl-emerge.git") - (pcmpl-rc :type git :host nil :repo "git@thanosapollo.org:/var/git/pcmpl-rc.git"))) - -(use-package emacs - :straight nil - :ensure t - :config - - (setf browse-url-browser-function 'browse-url-generic - browse-url-generic-program "icecat" - backup-directory-alist '((".*" . "~/.Trash")) - sentence-end-double-space t - default-input-method "bulgarian-phonetic" - gc-cons-threshold 5000000 - disabled-command-function nil ;; Enable all commands - url-privacy-level 'high - calendar-date-style 'european) - (if is-zeus - (display-battery-mode 0) - (display-battery-mode 1)) - - ;; use ssh for tramp, faster for small files - (setf tramp-default-method "ssh") - - (savehist-mode) - (save-place-mode 1) - (recentf-mode 1) - (electric-pair-mode 1) - :bind (("M-" . 'backward-kill-sexp) - ("C-c L" . 'display-line-numbers-mode) - ("C-z" . nil) - ("C-c r" . 'rename-visited-file)) - :hook ((emacs-lisp-mode . prettify-symbols-mode) - (lisp-mode . prettify-symbols-mode))) - -(use-package dired - :straight nil - :ensure nil - :config - (defun dired-watch-video () - "Watch play file with mpv." - (interactive) - (call-process-shell-command - (format "mpv \"%s\"" (dired-get-filename)) nil 0)) - - (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))) - - (defun dired-delete-files-except () - "Delete all files inside directory except match." - (interactive) - (let* ((directory (read-directory-name "Select directory: ")) - (files (directory-files directory t)) - (except-match (read-string "Except the ones that have: "))) - (dolist (file files) - (unless (or (string= "." (substring file -1)) - (string= ".." (substring file -2)) - (string-match except-match file)) - (dired-delete-file file t))))) - - (defun dired-delete-file-match () - "Delete all files inside directory except match." - (interactive) - (let* ((directory (read-directory-name "Select directory: ")) - (files (directory-files directory t)) - (match (read-string "Delete files that match: "))) - (dolist (file files) - (when (string-match-p match file) - (dired-delete-file file t))))) - - (defun dired-rename-capitalize-file () - "Capitalize the base name of the file at point in a Dired buffer." - (interactive) - (let* ((file (dired-get-file-for-visit)) - (new-file (capitalize (file-name-nondirectory file)))) - (if (string-prefix-p "." file) - (message "Skipping file starting with '.'") - (progn - (rename-file file (concat (file-name-directory file) new-file)) - (revert-buffer) - (message "Renamed %s to %s" file new-file))))) - :bind ((:map - dired-mode-map - ("b" . 'dired-up-directory) - ("v" . 'dired-watch-video) - ("z" . 'wdired-change-to-wdired-mode) - ("C-c w" . 'dired-set-wallpaper) - ("C-c d" . 'dired-delete-files-except) - ("C-c r" . 'dired-do-query-replace-regexp)))) - -(defun theme-invisible-dividers (_theme) - "Make window dividers for THEME invisible." - (let ((bg (face-background 'default))) - (custom-set-faces - `(fringe ((t :background ,bg :foreground ,bg))) - `(window-divider ((t :background ,bg :foreground ,bg))) - `(window-divider-first-pixel ((t :background ,bg :foreground ,bg))) - `(window-divider-last-pixel ((t :background ,bg :foreground ,bg)))))) - -(add-hook 'enable-theme-functions #'theme-invisible-dividers) - -;;;; Theming ;;;; -(setf inhibit-startup-message t - initial-scratch-message nil) - -(blink-cursor-mode -1) -(global-visual-line-mode 0) - -(setf visible-bell nil - display-line-numbers-type 'relative) - -(column-number-mode) -(global-display-line-numbers-mode 1) - -;; Transparency -(add-to-list 'default-frame-alist '(alpha-background . 85)) - -;; theming -;; (global-hl-line-mode) -(global-visual-line-mode) - -(defun thanos/terminal-theming () - "Customize theming when laucning Emacs as TUI." - (unless (display-graphic-p (selected-frame)) - (set-face-background 'default "unspecified-bg" (selected-frame)) - (global-hl-line-mode 0))) - -(add-hook 'window-setup-hook 'thanos/terminal-theming) - -(when (equal is-phone nil) - (scroll-bar-mode -1) - (set-fringe-mode 10)) - -(tool-bar-mode -1) -(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-log-done 'time - org-hide-emphasis-markers nil ;;change to t to hide emphasis markers - org-table-convert-region-max-lines 20000 - org-log-done 'time - org-todo-keywords '((sequence "TODO(t)" "SEMINAR(s)" "LECTURE(l)" "DONE(d)"))) - - (setf org-structure-template-alist - '(("e" . "src emacs-lisp") - ("p" . "src python") - ("l" . "src lisp") - ("b" . "src bash") - ("q" . "QUOTE"))) - - :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)))) - -(defun org-insert-book () - "Insert org-link from ~/Library for book." - (interactive) - (let* ((book-path (read-file-name "Book: " "~/Library/"))) - (org-insert-link nil book-path (file-name-base book-path)))) - -(use-package org-modern - :ensure t - :config - (setf org-modern-table nil - org-modern-todo nil - org-modern-tag nil) - :hook ((org-mode . org-modern-mode))) - -;; Create notes directory for org-roam -(unless (file-exists-p "~/Notes") - (make-directory "~/Notes")) - -(use-package org-roam - :straight nil - :defer t - :init - (define-prefix-command 'thanos/notes-map) - :config - (setf org-roam-directory "~/Notes" - org-roam-dailies-directory "daily/") - - (org-roam-db-autosync-enable) - - (setf org-roam-node-display-template - (concat "${title:50} "(propertize "${tags:30}" 'face 'org-tag))) - - (setf org-roam-db-node-include-function - (lambda () - (not (or (member "journal" (org-get-tags)) - (member "dailies" (org-get-tags)))))) - ;; Templates - (setf org-roam-capture-templates - '(("d" "default" plain - "%?" - :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+startup: overview\n") - :unnarrowed t) - ("p" "MUS" plain "* Goals\n\n%?\n\n* Tasks\n\n** TODO Add initial tasks\n\n* Dates\n\n" - :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: MUS") - :unnarrowed t)) - org-roam-dailies-capture-templates - '(("d" "default" entry - "* %?" - :target (file+head "%<%Y-%m-%d>.org" - "#+title: %<%Y-%m-%d>\n#+filetags: :journal:\n")) - ("j" "journal" plain - "\n* Daily Notes\n\n* Goals\n+ []\n\n* Extras %?" - :target (file+head "%<%Y-%m-%d>.org" - "#+title: %<%Y-%m-%d>\n#+filetags: :journal:\n")))) - - (defun org-roam-ref-add-book () - "Insert org-link from Library." - (interactive) - (let ((book (format "file:%s" (read-file-name "Book: " (if is-zeus "/hdd/Library/" "~/Library/"))))) - book)) - - (defun org-roam-sync-notes () - "Sync org-oram notes" - (interactive) - (let ((git (executable-find "git")) - (default-directory org-roam-directory)) - (message "Synching org-roam notes %s" org-roam-directory) - (unless git - (error "Git not found, please install `git'")) - (unless (file-exists-p (expand-file-name ".git" gnosis-dir)) - (message "Creating git repository") - (vc-create-repo 'Git)) - (shell-command "git pull") - (shell-command (format "%s %s" git "add .")) - (shell-command (format "%s %s %s" git "commit -m" (shell-quote-argument "Update org-roam notes"))) - (vc-git-push nil)) - (funcall 'org-roam-db-sync)) - - :bind (("C-c n" . thanos/notes-map) - :map thanos/notes-map - ("t" . org-roam-buffer-toggle) - ("f" . org-roam-node-find) - ("i" . org-roam-node-insert) - ("d" . org-roam-dailies-goto-today) - ("D" . org-roam-dailies-goto-date) - :map org-mode-map - ("C-c C-." . org-roam-tag-add) - ("C-c i" . org-id-get-create))) - -(use-package org-roam-ui - :defer t) - -;; (use-package jabber -;; :defer t) - -(use-package modus-themes - :straight t - :config - (setf modus-themes-italic-constructs nil - modus-themes-bold-constructs nil - modus-themes-mixed-fonts nil - modus-themes-variable-pitch-ui nil - modus-themes-custom-auto-reload t - modus-themes-disable-other-themes t - modus-themes-prompts '(italic) - modus-themes-completions '((matches . (extrabold)) - (selection . (semibold italic text-also underline))) - 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) - ;; (bg-main "#1d2021") ;;grubox-hard - ;; (bg-main "#191919") ;; 1337 - ;; (bg-main "#1d1f21") ;; tomorrow night - ;; (bg-main "#151515") ;; jazz - (bg-main "#0C0C0C") ;; random black - ;; (bg-main "#171717") ;; badger - ;; (overline-heading-1 gold) - (fg-heading-1 red-warmer) - ;; (bg-heading-1 bg-blue-nuanced) - (bg-line-number-inactive unspecified) - (bg-line-number-active unspecified) - (bg-paren-match bg-magenta-intense) - (underline-paren-match fg-main) - (underline-err red-intense) - (underline-warning yellow-faint) - (underline-note cyan-faint) - (string "#86B187") - (border-mode-line-active unspecified) - (border-mode-line-inactive unspecified) - (bg-mode-line-active "#433F4f") ;; subtle lavender - (bg-mode-line-inactive "#1D1D1D") - ;; set fg from badger theme - (fg-mode-line-active "#F6F3E8") - (bg-hl-line bg-dim) - (cursor slate) - (prose-todo green-intense) - (prose-done bg-term-white) - (fg-prompt yellow-faint) - ,@modus-themes-preset-overrides-intense)) - ;; Headings - (setf modus-themes-headings - '((1 . (ultrabold 1.35)) - (2 . (semibold 1.2)) - (agenda-date . (1.3)) - (agenda-structure . (variable-pitch light 1.8)) - (t . (1.15)))) - ;; Load modus - (load-theme 'modus-vivendi t)) - -(use-package vertico - :ensure t - :config - (vertico-mode)) - -(use-package marginalia - :ensure t - :config - (marginalia-mode)) - -(use-package consult - :straight nil - :ensure t - :init (define-prefix-command 'thanos/search) - :bind (("C-x r d" . 'bookmark-delete) - ("C-x r C-r" . 'bookmark-rename) - ("C-x r C-j" . 'consult-register) - ("C-x r SPC" . 'consult-register-store) - ("C-x r b" . 'consult-bookmark) - ("C-c m" . 'consult-imenu) - ("C-x b" . 'consult-buffer) - ("M-y" . 'consult-yank-from-kill-ring) - ("C-s" . 'thanos/search) - :map thanos/search - ("f" . 'isearch-forward) - ("r" . 'isearch-backward) - ("s" . 'consult-line) - ("i" . 'change-inner) - ("C-f" . 'consult-find) - ("C-g" . 'consult-grep) - ("C-i" . 'consult-info) - ("C-l" . 'consult-locate) - :map project-prefix-map - ("b" . 'consult-project-buffer))) - -(use-package which-key - :ensure t - :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 - (setf elfeed-search-filter "@1-week-ago +unread -hackernoon" - browse-url-browser-function #'browse-url-default-browser) - ;; Feeds - (setf elfeed-feeds - '(("https://hackaday.com/blog/feed/" - hackaday linux) - ("https://thanosapollo.org/index.xml" - thanos) - ("http://wikileaks.org/feed" - wikileaks) - ("https://hackernoon.com/feed" - hackernoon) - ("https://torrentfreak.com/feed" - torrentfreak piracy) - ("https://www.science.org/action/showFeed?type=etoc&feed=rss&jc=sciimmunol" - science) - ("https://rss-bridge.thanosapollo.org/?action=display&bridge=CssSelectorBridge&home_page=https%3A%2F%2Fwww.medscape.com%2Findex%2Flist_13470_0&url_selector=a.title&url_pattern=viewarticle%2F.*&content_selector=div.article__main-content&content_cleanup=&title_cleanup=+-+Index&limit=&format=Atom" medscape med) - ("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://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))) - :bind (("C-x f" . elfeed) - :map elfeed-search-mode-map - ("v" . 'elfeed-mpv) - ("U" . 'elfeed-update)) - :hook ((elfeed-search-mode . (lambda () (display-line-numbers-mode 0))))) - -;; Python -(use-package python-mode - :defer t - :config - (add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))) - -(use-package pyenv - :defer t) - -(use-package elpy - :straight nil - :ensure nil - :init - (elpy-enable)) - -;; Clojure -(use-package cider - :defer t) - -(use-package clojure-mode - :defer t) - -(use-package rainbow-delimiters - :defer t - :hook ((emacs-lisp-mode . rainbow-delimiters-mode) - (lisp-mode . rainbow-delimiters-mode) - (clojure-mode . rainbow-delimiters-mode) - (scheme-mode . rainbow-delimiters-mode))) - -;; (use-package paredit -;; :ensure t -;; :hook ((emacs-lisp-mode . paredit-mode) -;; (lisp-mode . paredit-mode) -;; (clojure-mode . paredit-mode) -;; (scheme-mode . paredit-mode))) - -(use-package sly - :init (setf inferior-lisp-program "sbcl") - :defer t) - -(use-package helpful - :defer t - :bind (("C-h f" . 'helpful-callable) - ("C-h v" . 'helpful-variable) - ("C-h k" . 'helpful-key) - ("C-h x" . 'helpful-command) - ("C-h ." . 'helpful-at-point) - ("C-h F" . 'helpful-function) - ("C-h C-k" . 'helpful-kill-buffers) - ("C-h a" . 'apropos) - ("C-h C-m" . 'info-apropos))) - -(use-package ox-hugo - :ensure t - :config - (setf org-hugo-section "post")) - -(use-package json-mode - :defer t - :config - (add-to-list 'auto-mode-alist '("\\.json'" . json-mode))) - -(defun project-magit () - "Run magit-status in the current project's root." - (interactive) - (magit-status-setup-buffer (project-root (project-current t)))) - -(use-package magit - :defer t - :config - (setf magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1) - :bind (:map project-prefix-map ("g" . 'project-magit))) - -(use-package corfu - :ensure t - :config - (global-corfu-mode) - (corfu-popupinfo-mode) - (setf corfu-auto t - corfu-auto-delay 0.1 - corfu-auto-prefix 2 - corfu-cycle t - corfu-popupinfo-delay 0.3 - corfu-quit-at-boundary 'separator - corfu-quit-no-match t - corfu-preselect 'first - corfu-preview-current t - corfu-echo-mode t) - (setf indent-tabs-mode nil)) - -(defun insert-brackets (&optional arg) - "Insert ARG brackets." - (interactive "P") - (insert-pair arg ?\[ ?\])) - -(global-set-key (kbd "C-x M-[") 'insert-brackets) - - -(use-package orderless - :init (add-to-list 'completion-styles 'initials t) - :ensure t - :config - (setf completion-category-overrides '((file (style basic partial-completion))) - completion-styles '(orderless) - completion-cycle-threshold 2)) - -(use-package pdf-tools - :straight nil - :ensure nil - :config - (add-to-list 'auto-mode-alist '("\\.pdf\\'" . pdf-view-mode)) - :hook - ((pdf-view-mode . (lambda () - (display-line-numbers-mode 0) - ;; Guix package emacs-pdf-tools does not enable - ;; minor modes automatically - (pdf-tools-enable-minor-modes))))) - -(use-package markdown-mode - :defer t - :config - (setq markdown-header-scaling t - markdown-command "multimarkdown") - (add-to-list 'auto-mode-alist '("\\.md\\'" . gfm-mode)) - :hook ((markdown-mode . flyspell-mode))) - -(use-package org-auto-tangle - :defer t) - -(use-package org-present - :defer t) - -(use-package expand-region - :defer t) - -(use-package change-inner - :after expand-region - :bind ((:map thanos/search ("i" . 'change-inner)))) - -(use-package nov - :straight nil - :defer t - :config - (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))) - -(use-package eshell-syntax-highlighting - :defer t) - -(use-package emojify - :ensure t - :hook (erc-mode . emojify-mode) - :commands emojify-mode) - -(use-package flycheck-package - :ensure t - :after flycheck) - -(use-package flycheck - :ensure t - :config - (setf flycheck-emacs-lisp-load-path 'inherit) - (global-flycheck-mode) - :hook ((emacs-lisp-mode . (lambda () (flycheck-mode) (flycheck-package-setup))))) - -;; Shells -(use-package vterm - :straight nil - :ensure nil - :bind (("C-c v" . vterm) - :map vterm-mode-map - ("M-&" . 'async-shell-command) - ("C-c C-y" . 'vterm-copy-mode)) - :hook - ((vterm-mode . (lambda () (display-line-numbers-mode -1))))) - -(use-package shell - :defer t - :bind (("C-c V" . shell) - :map shell-mode-map - ("C-l" . 'comint-clear-buffer)) - :hook ((shell-mode . (lambda () (display-line-numbers-mode -1))))) - -(defvar thanos/aliases - '((g . magit) - (gl . magit-log) - (gc . magit-clone) - (d . dired) - (o . find-file) - (oo . find-file-other-window) - (ll . (lambda () (eshell/ls '-lha))) - (eshell/clear . eshell/clear-scrollback))) - -(defun thanos/set-eshell-aliases (aliases) - "Set ALIASES as eshell aliases." - (mapc (lambda (alias) - (defalias (car alias) (cdr alias))) - aliases)) - -(use-package eshell - :config - (setf eshell-highlight-prompt t) - (eshell-syntax-highlighting-global-mode 1) - :bind (("C-c e" . eshell) - :map eshell-mode-map - ("C-l" . eshell/clear-scrollback)) - :hook ((eshell-mode . (lambda () - (thanos/set-eshell-aliases thanos/aliases) - (display-line-numbers-mode -1))))) - -(use-package eat - :after 'eshell - :config - (add-hook 'eshell-load-hook #'eat-eshell-mode) - (setf eat-term-name "xterm-256color")) - -(use-package eshell-git-prompt - :config - (defun eshell-git-prompt-multiline () - "Eshell Git prompt inspired by spaceship-prompt." - (let (separator hr dir git git-dirty time sign command) - (setq separator (with-face " | " 'eshell-git-prompt-multiline-secondary-face)) - (setq hr (with-face (concat "\n" (make-string (/ (window-total-width) 2) ?─) "\n") 'eshell-git-prompt-multiline-secondary-face)) - (setq dir - (concat - (with-face "" 'eshell-git-prompt-directory-face) - (concat (abbreviate-file-name (eshell/pwd))))) - (setq git - (concat (with-face "⎇" 'eshell-git-prompt-exit-success-face) - (concat (eshell-git-prompt--branch-name)))) - (setq git-dirty - (when (eshell-git-prompt--branch-name) - (if (eshell-git-prompt--collect-status) - (with-face " ✎" 'eshell-git-prompt-modified-face) - (with-face " ✔" 'eshell-git-prompt-exit-success-face)))) - (setq time (with-face (format-time-string "%I:%M:%S %p") 'eshell-git-prompt-multiline-secondary-face)) - (setq sign - (if (= (user-uid) 0) - (with-face "\n#" 'eshell-git-prompt-multiline-sign-face) - (with-face "\nλ" 'eshell-git-prompt-multiline-sign-face))) - (setq command (with-face " " 'eshell-git-prompt-multiline-command-face)) - - ;; Build prompt - (eshell-git-prompt---str-read-only - (concat hr dir separator git git-dirty separator time sign command)))) - - (eshell-git-prompt-use-theme 'multiline)) - -;; Chat -(use-package jabber - :defer t - :config - (defun jabber-buffers-formats (&optional buffer-formats) - "Return jabber BUFFER-FORMATS without the format specifiers. - -By default, returns all jabber related buffers format." - (let ((buffer-formats (or buffer-formats '(jabber-chat-buffer-format - jabber-browse-buffer-format - jabber-roster-buffer - jabber-groupchat-buffer-format - jabber-muc-private-buffer-format)))) - (cl-loop for var in buffer-formats - for str = (symbol-value var) - for formatted-str = (when (stringp str) - ;; Remove format specifier and - ;; the following 2 char, or 1 if - ;; there is not second. - (replace-regexp-in-string "%.?" "" str)) - collect formatted-str))) - - (defun jabber-switch-to-buffer () - "Prompt the user to select a buffer whose name matches a list of strings." - (interactive) - (let* ((string-list (jabber-buffers-formats)) - (buffers-matching-strings - (cl-loop for buf in (buffer-list) - when (cl-loop for str in string-list - thereis (string-match-p str (buffer-name buf))) - collect (buffer-name buf)))) - (if buffers-matching-strings - (switch-to-buffer - (completing-read "Select jabber buffer: " buffers-matching-strings))) - (error "No jabber buffer found"))) - :bind (:map jabber-global-keymap - ("C-b" . 'jabber-switch-to-buffer))) - -(use-package erc - :defer t - :config - (unless (expand-file-name "erc" user-emacs-directory) - (make-directory (expand-file-name "erc" user-emacs-directory))) - (setf erc-modules - '(sasl netsplit fill button match track completion readonly - networks ring autojoin noncommands irccontrols move-to-prompt stamp - menu list log notifications) - erc-log-channels-directory (expand-file-name "erc" user-emacs-directory)) - :bind (("C-c E" . 'erc-libera) - :map erc-mode-map - ("C-c RET" . 'erc-cmd-QUERY))) - -;; (use-package erc-image -;; :ensure t -;; :after erc -;; :config -;; (setq erc-image-inline-rescale 300) -;; (add-to-list 'erc-modules 'image)) - -(use-package transmission - :defer t) - -(use-package sudo-edit - :defer t - :config - (setf sudo-edit-local-method "sudo")) - -(use-package dabbrev - :defer t - :config - (setf dabbrev-ignored-buffer-regexps '("\\.\\(?:pdf\\|jpe?g\\|png\\)\\'"))) - -(use-package xref - :defer t - :config - (setf xref-show-xrefs-function #'consult-xref - xref-show-definitions-function #'consult-xref)) - -(use-package moc-player - :defer t - :straight '(moc-player :local-repo "~/Dev/emacs-lisp/moc-player") - :init (define-prefix-command 'thanos/mocp) - :bind (("C-z" . thanos/mocp) - :map thanos/mocp - ("SPC" . 'mocp-toggle-pause) - ("n" . 'mocp-next) - ("p" . 'mocp-previous))) - -;; My packages -(when (or is-zeus is-hermes) - (use-package yeetube - :init (define-prefix-command 'thanos/yeetube-map) - :straight nil - :ensure t - :config - (setf yeetube-results-limit 20 - yeetube-mpv-disable-video t - yeetube-display-thumbnails nil - yeetube-play-function #'yeetube-mpv-play) - - (defun yeetube-download-videos-ffmpeg () - "Download videos using ffmpeg." - (interactive) - (let ((url "") - (name "") - (download-counter 1) - (stored-contents nil)) - ;; Read links and names until "q" is entered - (while (not (string= url "q")) - (setf url (read-string "Enter URL (q to quit): ")) - (unless (string= url "q") - (setf name (read-string (format "Custom name (download counter: %d) " download-counter))) - (push (cons url name) stored-contents) - (setf download-counter (1+ download-counter)))) - ;; Process the collected links and names - (dolist (pair stored-contents) - (let ((url (car pair)) - (name (cdr pair))) - (async-shell-command - (format - "ffmpeg -protocol_whitelist file,crypto,data,https,tls,tcp -stats -i '%s' -codec copy '%s.mp4'" - url name)))))) - - (defun yeetube-download-vimeo-videos () - "Download videos from vimeo services." - (interactive) - (let ((url "") - (name "") - (download-counter 1)) - (while (not (string= url "q")) - (setf url (read-string "Enter URL (q to quit): ")) - (unless (string= url "q") - (setf name (read-string (format "Custom name (download counter: %d) " download-counter))) - (setf download-counter (1+ download-counter)) - (call-process-shell-command - (format - "yt-dlp '%s' -o '%s'" - (replace-regexp-in-string "\\.json" ".m3u8" url) name) - nil 0))))) - - :bind (("C-c y" . 'thanos/yeetube-map) - :map thanos/yeetube-map - ("s" . 'yeetube-search) - ("b" . 'yeetube-play-saved-video) - ("d" . 'yeetube-download-videos) - ("C-d" . 'yeetube-download-vimeo-videos) - ("p" . 'yeetube-mpv-toggle-pause) - ("v" . 'yeetube-mpv-toggle-video) - ("V" . 'yeetube-mpv-toggle-no-video-flag) - ("C-p" . 'yeetube-mpv-toggle-video) - ("k" . 'yeetube-remove-saved-video))) - - (use-package gnosis - :straight (gnosis :local-repo "~/Dev/emacs-lisp/gnosis") - :ensure t - :init (define-prefix-command 'thanos/gnosis-map) - :config - (setf gnosis-vc-auto-push t - gnosis-mcq-display-choices nil - gnosis-image-width nil - gnosis-image-height nil) - (gnosis-modeline-mode) - :bind (("C-r" . thanos/gnosis-map) - :map thanos/gnosis-map - ("r" . 'gnosis-review) - ("a" . 'gnosis-add-note) - ("C-d" . 'gnosis-dashboard) - ("d" . 'gnosis-add-deck) - ("t" . 'gnosis-test-start))) - - ;; Run vc-pull on startup - (gnosis-vc-pull) - - (use-package pcmpl-emerge - :defer t - :straight (pcmpl-emerge :local-repo "~/Dev/emacs-lisp/pcmpl-emerge")) - - (use-package pcmpl-rc - :straight (pcmpl-rc :local-repo "~/Dev/emacs-lisp/pcmpl-rc") - :defer t) - - (use-package pcmpl-tailscale - :straight (pcmpl-tailscale :local-repo "~/Dev/emacs-lisp/pcmpl-taiscale") - :defer t)) - -;; Emacs dev - -(use-package package-lint - :defer t) - -;; AI tools -(use-package gptel - :defer t - :config - (setf gptel-api-key (password-store-get-field "openai/openai@thanosapollo.org" "api") - gptel-default-mode 'org-mode) - (setq-default gptel-model "zephyr:latest" - gptel-backend (gptel-make-ollama "Ollama" - :host "zeus:11434" - :stream t - :models '("llama2:latest" "zephyr:latest" "codellama:latest" - "mistral:latest" "mixtral:latest" "neural-chat:latest" - "dolphin-mixtral:latest")) - gptel-directives '((default . "You are a large language model living in Emacs and a helpful assistant. Respond concisely.") - (programming . "You are a large language model and a careful programmer. Provide code and only code as output without any additional text, prompt or note.") - (epictetus . "You are Epictetus, the stoic philosopher from Nicopolis. Respond concisely as Epictetus.") - (med . "You are a medical professor within the Emacs. Respond concisely.") - (code-review . "You are an expert programmer within Emacs reviewing code. Respond concisely") - (writer . "You are an expert writer and FOSS enthusiast. Improve only the article sections provided as a hacker, do not add extra paragraphs."))) - :bind (("C-c g" . 'gptel-send) - :map gptel-mode-map - ("C-c h" . 'gptel-menu))) - -;; (use-package copilot -;; :straight (copilot :host github :repo "zerolfx/copilot.el" :files ("dist" "*.el")) -;; :bind (:map copilot-mode-map -;; ("M-TAB" . 'copilot-accept-completion-by-line) -;; ("C-M-" . 'copilot-accept-completion-by-word) -;; ("C-M-n" . 'copilot-next-completion) -;; ("C-M-p" . 'copilot-previous-completion))) - - -;; Password-store -(use-package password-store - :init (define-prefix-command 'thanos/pass) - :defer t - :config - (setf password-store-password-length (+ 20 (random 20))) - :bind (("C-c p" . 'thanos/pass) - :map thanos/pass - ("i" . 'password-store-insert) - ("e" . 'password-store-edit) - ("g" . 'password-store-generate) - ("c" . 'password-store-copy) - ("s" . 'smtp-get-pass))) - -(defun thanos/pass-launcher () - "Launch Emacs as a front-end for pass." - (interactive) - (unwind-protect - (with-selected-frame - (make-frame '((name . "thanos/pass-launcher") - (fullscreen . 0) - (undecorated . t) - (minibuffer . only) - (width . 70) - (height . 15))) - (let* ((choice (completing-read "Choose an action: " - '("AUTO" "COPY PASS" "COPY USERNAME" "EDIT" "GENERATE"))) - (action (pcase choice - ("AUTO" #'(lambda (entry) (let ((user (password-store-get-field entry "user")) - (pass (password-store-get entry))) - (start-process-shell-command - "wtype" nil - (format "sleep 0.3 && wtype %s -P tab %s" - (shell-quote-argument (if user user "thanosapollo")) - (shell-quote-argument pass)))))) - ("COPY PASS" #'password-store-copy) - ("COPY USERNAME" #'(lambda (entry) (password-store-copy-field entry "user"))) - ("EDIT" #'password-store-edit) - ("GENERATE" #'password-store-generate)))) - (funcall action (completing-read "Search: " (password-store-list))) - (delete-frame))))) - -(defun smtp-get-pass () - "Get password for smtp." - (interactive) - (password-store-copy-field "fastmail.com/thanosapollo@fastmail.com" "smtp")) - -(use-package package-lint - :defer t) - -(use-package consult-mu - :straight (consult-mu :type git :host github :repo "armindarvish/consult-mu" :files (:defaults "extras/*.el")) - :after (mu4e consult) - :bind (:map mu4e-main-mode-map - ("M-s" . 'consult-mu) - :map mu4e-view-mode-map - ("M-s" . 'consult-mu) - :map mu4e-headers-mode-map - ("M-s" . 'consult-mu))) - -;; Guix Setup -;; Yasnippet configuration -(with-eval-after-load 'yasnippet - (add-to-list 'yas-snippet-dirs "~/Dev/guile/guix/etc/snippets/yas")) -;; ;; Tempel configuration -;; (with-eval-after-load 'tempel -;; ;; Ensure tempel-path is a list -- it may also be a string. -;; (unless (listp 'tempel-path) -;; (setq tempel-path (list tempel-path))) -;; (add-to-list 'tempel-path "~/Dev/guile/guix/etc/snippets/tempel/*")) - -(use-package yaml-mode - :defer t) - -;(load-file "~/Dev/guile/guix/etc/copyright.el") - -(setq copyright-names-regexp - (format "%s <%s>" user-full-name user-mail-address)) - -(when (or is-zeus is-hermes) - (use-package mu4e - :straight nil - :ensure nil - :init - - :config - (require 'server) - (require 'mu4e) - - (setf mu4e-get-mail-command "mbsync -a") - - (when (and is-zeus (server-running-p)) - (setf mu4e-update-interval (* 10 60))) - - (defun set-mu4e-context (context-name full-name mail-address signature) - "Return a mu4e context named CONTEXT-NAME with :match-func matching - folder name CONTEXT-NAME in Maildir. The context's `user-mail-address', - `user-full-name' and `mu4e-compose-signature'`smtpmail-smpt-server' is set to MAIL-ADDRESS - FULL-NAME SIGNATURE and SERVER respectively. - Special folders are set to context specific folders." - (let ((dir-name (concat "/" context-name))) - (make-mu4e-context - :name context-name - ;; we match based on the maildir of the message - :match-func - `(lambda (msg) - (when msg - (string-match-p - ,(concat "^" dir-name) - (mu4e-message-field msg :maildir)))) - :vars - `((user-mail-address . ,mail-address) - (user-full-name . ,full-name) - (mu4e-sent-folder . ,(concat dir-name "/Sent")) - (mu4e-drafts-folder . ,(concat dir-name "/Drafts")) - (mu4e-trash-folder . ,(concat dir-name "/Trash")) - (mu4e-trash-folder . ,(concat dir-name "/Starred")) - (mu4e-refile-folder . ,(concat dir-name "/Archive")) - (mu4e-compose-signature . ,signature))))) - - ;;Fixing duplicate UID errors when using mbsync and mu4e - (setf mu4e-change-filenames-when-moving t - mu4e-maildir-shortcuts - '(("/Fastmail/Inbox" . ?i) - ("/Drafts" . ?d) - ("/Sent" . ?s) - ("/Fastmail/Emacs/dev" . ?e) - ("/MUSofia/[Gmail]/All Mail" . ?u) - ("/Fastmail/Gentoo" . ?g))) - - (setf mu4e-contexts - (list - (make-mu4e-context - :name "Public" - :match-func - (lambda (msg) - (when msg - (string-prefix-p "/Fastmail" (mu4e-message-field msg :maildir)))) - :vars '((user-mail-address . "public@thanosapollo.org") - (user-full-name . "Thanos Apollo") - (smtpmail-smtp-server . "smtp.fastmail.com") - (smtpmail-smtp-service . 465) - (smtpmail-stream-type . ssl) - (mu4e-drafts-folder . "/Drafts") - (mu4e-sent-folder . "/Sent") - (mu4e-refile-folder . "/Archive") - (mu4e-trash-folder . "/Trash"))) - (make-mu4e-context - :name "MUSofia" - :match-func - (lambda (msg) - (when msg - (string-prefix-p "/MUSofia" (mu4e-message-field msg :maildir)))) - :vars '((user-mail-address . "104111@students.mu-sofia.bg") - (user-full-name . "Thanos Apollo") - (smtpmail-smtp-server . "smtp.gmail.com") - (smtpmail-smtp-service . 465) - (smtpmail-stream-type . ssl))))) - - (setf message-send-mail-function 'smtpmail-send-it - mu4e-compose-signature "\nThanos Apollo\n \nhttps://thanosapollo.org\n -62B7 58D0 F671 9938 BC09 CECA 339F 736C 3A72 0928\n" - mu4e-compose-context-policy 'ask) - - (setf mu4e-view-actions - (delete-dups - (append - '(("gapply git patches" . mu4e-action-git-apply-patch) - ("mgit am patch" . mu4e-action-git-apply-mbox) - ("bb4 am patch" . mu4e-action-git-apply-b4) - ("ssetup reword list with b4" . mu4e-action-setup-reword-b4) - ("crun checkpatch script" . my-mu4e-action-run-check-patch) - ("MCheck if merged" . my-mu4e-action-check-if-merged))))) - - :bind (("C-x m" . 'mu4e)) - :hook - ;; Sign messages - ((message-send . 'mml-secure-message-sign-pgpmime) - ;; Disable line numbers & autosave - (mu4e-main-mode . (lambda () (display-line-numbers-mode -1) (auto-save-mode -1)))))) - -;;; Random commands ;;;; -;;;;;;;;;;;;;;;;;;;;;;;; - -;; Virtual machines -(defvar vm-directory "~/Virtual/") - -(defun vm-create-image () - "Create qcow2 image." - (interactive) - (let ((name (format "%s%s.qcow2" vm-directory (read-string "Name: "))) - (size (format "%s" (read-string "Size(G): ")))) - (shell-command - (format "qemu-img create -f qcow2 %s %sG" name size)))) - - -(defun vm-run () - "Spawn Virtual Machine." - (interactive) - (let ((memory (format "%sG" (read-string "Memory(G): "))) - (cores (read-string "Cores: ")) - (image (read-file-name "Image: " vm-directory)) - (iso (if (y-or-n-p "Load iso? ") - (read-file-name "ISO: ") - nil))) - (async-shell-command - (format "qemu-system-x86_64 -enable-kvm -m %s -smp %s -hda %s -vga virtio -device virtio-serial-pci -netdev user,id=vmnic,hostfwd=tcp::2222-:22 -device e1000,netdev=vmnic %s" - memory cores image (if iso (concat "-cdrom " iso) ""))))) - -;; misc -(defun thanos/run-in-background (command) - "Run COMMAND in the background." - (let ((command-parts (split-string command "[ ]+"))) - (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts))))) - -(defun create-text-scratch () - "Create a scratch buffer." - (interactive) - (switch-to-buffer (get-buffer-create "*Text Scratch*")) - (org-mode)) - -(defun create-scratch () - "Create scratch buffer." - (interactive) - (switch-to-buffer (get-buffer-create "*scratch*")) - (emacs-lisp-mode)) - -(defvar-keymap thanos/create-map - :doc "Create custom buffers" - "t" #'create-text-scratch - "e" #'create-scratch) - -;; Theming - -(defvar wallpapers-dir "~/wallpapers/") - -(defun thanos/load-theme (&optional theme) - "Disable current theme and load a new THEME." - (interactive) - (let ((theme (or theme (intern (completing-read "Theme: " (custom-available-themes)))))) - (disable-theme (car custom-enabled-themes)) - (load-theme theme t))) - -(defun thanos/wallpaper-set (image) - "Set IMAGE as wallpaper, using feh." - (let ((command (if is-zeus "swaybg -o '*' -i" "feh --bg-scale"))) - ;; Kill previous swaybg - (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) - 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))) - -(defvar-keymap thanos/applications-map - :doc "Thanos commonly used programs" - "t" #'thanos/load-theme - "w" #'thanos/wallpaper-select - "C-c" thanos/create-map) - -(define-key global-map (kbd "C-c a") thanos/applications-map) - -(defun thanos/iimage-mode-buffer (arg) - "Display images if ARG is non-nil, undisplay them otherwise." - (let ((image-path (cons default-directory iimage-mode-image-search-path)) - (edges (window-inside-pixel-edges (get-buffer-window))) - file) - (with-silent-modifications - (save-excursion - (dolist (pair iimage-mode-image-regex-alist) - (goto-char (point-min)) - (while (re-search-forward (car pair) nil t) - (when (and (setq file (match-string (cdr pair))) - (setq file (locate-file file image-path))) - (if arg - (add-text-properties - (match-beginning 0) (match-end 0) - `(display - ,(create-image file nil nil - :max-width 120 - :max-height 120) - keymap ,image-map - modification-hooks - (iimage-modification-hook))) - (remove-list-of-text-properties - (match-beginning 0) (match-end 0) - '(display modification-hooks)))))))))) - -(define-minor-mode thanos/iimage-mode nil - :group 'iimage :lighter " iImg" - (thanos/iimage-mode-buffer thanos/iimage-mode)) - -;; Font -(custom-set-faces - (if is-hermes '(default ((t (:inherit nil :height 120 :family "Jetbrains Mono")))) - '(default ((t (:inherit nil :height 130 :family "Jetbrains Mono"))))) - '(variable-pitch ((t (:inherit t :family "Iosevka Aile")))) - '(org-modern-symbol ((t (:inherit t :family "Iosevka Aile"))))) - -;; (set-face-attribute 'org-ellipsis nil :inherit 'default :box nil) - - -;;; emacs.el ends here diff --git a/sway.config b/sway.config deleted file mode 100644 index 8eaa6d6..0000000 --- a/sway.config +++ /dev/null @@ -1,273 +0,0 @@ -## Mod key -set $mod Mod4 - -exec sudo /home/thanos/.local/bin/tailscaled -exec waybar -bindsym $mod+z exec waybar -bindsym $mod+o exec killall -SIGUSR1 waybar - -# Workspace switch -bindsym $mod+period workspace back_and_forth - -bindsym $mod+slash workspace next -bindsym $mod+comma workspace prev -## Setup monitors & wallpapers -output DP-2 pos 0 0 res 2560x1440 bg ~/wallpapers/colors-fantasy.jpg stretch -output HDMI-A-1 pos 2560 0 res 2560x1440 bg ~/wallpapers/colors-fantasy.jpg fill transform 270 - -default_border pixel 3 -default_floating_border pixel 3 -gaps inner 5 -gaps outer 0 -bindsym $mod+shift+g exec swaymsg gaps outer all set 0 && swaymsg gaps inner all set 5 -bindsym $mod+g exec swaymsg gaps outer all set 0 && swaymsg gaps inner all set 0 - -# Activate smart borders (always) -smart_borders on -#smart_gaps on - -# Always float certain windows # -#swaymsg -t get_tree | grep app_id - for_window [app_id="pop-up"] floating enable - for_window [app_id="thanos/pass-launcher"] floating enable - for_window [app_id="bubble"] floating enable - for_window [app_id="task_dialog"] floating enable - for_window [app_id="Preferences"] floating enable - for_window [app_id="dialog"] floating enable - for_window [app_id="menu"] floating enable - for_window [app_id="Organizer"] floating enable - for_window [app_id="About"] floating enable - for_window [app_id="toolbox"] floating enable - for_window [app_id="page-info"] floating enable - for_window [app_id="webconsole"] floating enable - for_window [app_id="Authy"] floating enable - for_window [app_id="termfloat"] floating enable - for_window [app_id="termfloat"] resize set height 540 - for_window [app_id="termfloat"] resize set width 960 - for_window [app_id="mpv"] floating enable - for_window [app_id="mpv"] resize set height 540 - for_window [app_id="mpv"] resize set width 960 - for_window [app_id="Nautilus"] floating enable - for_window [app_id="Nautilus"] resize set height 540 - for_window [app_id="Nautilus"] resize set width 960 - -# Sticky floating windows(sticky enable|disable|toggle) - for_window [app_id="danmufloat"] floating enable - for_window [app_id="danmufloat"] sticky enable - for_window [app_id="danmufloat"] resize set height 540 - for_window [app_id="danmufloat"] resize set width 960 - -# Program Opacity - for_window [app_id="telegram"] opacity 0.95 - for_window [app_id="danmufloat"] opacity 0.80 - # for_window [app_id="icalingua"] opacity 0.95 - # for_window [class="netease-cloud-music"] opacity 0.90 - -# Focus follows mouse -focus_follows_mouse yes - -# Autostart # - -#exec_always --no-startup-id dunst & - -## Keyboard setup - -# NOTE: for bg phonetic use ,bg(phonetic) - input "type:keyboard" { - xkb_layout us,gr - xkb_options grp:win_space_toggle - } - - -# set gtk+ theme -set $gnome-schema org.gnome.desktop.interface - -# Window colours: border background text - # client.unfocused #2e3440 #1f222d #888888 - # client.focused_inactive #2e3440 #1f222d #888888 - # client.placeholder #2e3440 #1f222d #888888 - # client.urgent #D08770 #D08770 #ffffff - # client.background #242424 -client.focused #2D2D2D #2D2D2D #ffffff #ffffff #c6c6c6 -client.focused_inactive #0f1212 #0f1212 #ffffff #0f1212 #0f1212 -client.unfocused #2D2D2D #000000 #c6c6c6 #000000 #000000 -client.urgent #0f1212 #FF5555 #F8F8F2 #FF5555 #FF5555 -client.placeholder #000000 #000000 #F8F8F2 #000000 #000000 - -# TODO Direction keys, like Emacs - set $left h - set $down j - set $up k - set $right l - -#----------------------------------# -# Your preferred terminal emulator # -#----------------------------------# - set $term emacsclient -c - -# Control volume,monitor brightness,media players # - bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% - bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% - bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle - bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle - bindsym XF86MonBrightnessUp exec light -A 5 - bindsym XF86MonBrightnessDown exec light -U 5 - bindsym XF86AudioPlay exec playerctl play-pause - bindsym XF86AudioNext exec playerctl next - bindsym XF86AudioPrev exec playerctl previous - -# Key bindings --# - bindsym $mod+Return exec $term - bindsym $mod+Shift+Return exec kitty --class="termfloat" - bindsym $mod+Shift+m exec kitty --class="musicfox" --hold sh -c "musicfox" - bindsym $mod+Shift+d exec kitty --class="danmufloat" --hold sh -c "cd /home/ruixi/Codelearning/go/src/bilibili_live_tui/ && export TERM=xterm-256color && ./main" - - bindsym $mod+Shift+x exec --no-startup-id ~/.config/sway/swaylock.sh - bindsym $mod+t exec --no-startup-id telegram-desktop - bindsym $mod+bracketleft exec --no-startup-id grimshot --notify save area ~/Pictures/$(date "+%Y-%m-%d"T"%H:%M:%S_no_watermark").png - bindsym $mod+bracketright exec --no-startup-id grimshot --notify copy area - bindsym $mod+a exec --no-startup-id ~/.config/sway/grimshot_watermark.sh - - - # Kill focused window - bindsym $mod+q kill - - # Start your launcher - bindsym $mod+r exec fuzzel - - # Reload the configuration file - bindsym $mod+Shift+r reload - - # Exit sway (logs you out of your Wayland session) - bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' - - # Drag floating windows by holding down $mod and left mouse button. - # Resize them with right mouse button + $mod. - # Despite the name, also works for non-floating windows. - # Change normal to inverse to use left mouse button for resizing and right - # mouse button for dragging. - floating_modifier $mod normal - -# Moving around: # - # Move your focus around - bindsym $mod+$left focus left - bindsym $mod+$down focus down - bindsym $mod+$up focus up - bindsym $mod+$right focus right - # Or use $mod+[up|down|left|right] - bindsym $mod+Left focus left - bindsym $mod+Down focus down - bindsym $mod+Up focus up - bindsym $mod+Right focus right - - # Move the focused window with the same, but add Shift - bindsym $mod+Shift+$left move left - bindsym $mod+Shift+$down move down - bindsym $mod+Shift+$up move up - bindsym $mod+Shift+$right move right - # Ditto, with arrow keys - bindsym $mod+Shift+Left move left - bindsym $mod+Shift+Down move down - bindsym $mod+Shift+Up move up - bindsym $mod+Shift+Right move right - -# Workspaces: - # Switch to workspace - bindsym $mod+1 workspace number 1 - bindsym $mod+2 workspace number 2 - bindsym $mod+3 workspace number 3 - bindsym $mod+4 workspace number 4 - bindsym $mod+5 workspace number 5 - bindsym $mod+6 workspace number 6 - bindsym $mod+7 workspace number 7 - bindsym $mod+8 workspace number 8 - bindsym $mod+9 workspace number 9 - bindsym $mod+0 workspace number 10 - # Move focused container to workspace - bindsym $mod+Shift+1 move container to workspace number 1 - bindsym $mod+Shift+2 move container to workspace number 2 - bindsym $mod+Shift+3 move container to workspace number 3 - bindsym $mod+Shift+4 move container to workspace number 4 - bindsym $mod+Shift+5 move container to workspace number 5 - bindsym $mod+Shift+6 move container to workspace number 6 - bindsym $mod+Shift+7 move container to workspace number 7 - bindsym $mod+Shift+8 move container to workspace number 8 - bindsym $mod+Shift+9 move container to workspace number 9 - bindsym $mod+Shift+0 move container to workspace number 10 - # move focused container to workspace(follow) - bindsym $mod+Ctrl+1 move container to workspace number 1, workspace 1 - bindsym $mod+Ctrl+2 move container to workspace number 2, workspace 2 - bindsym $mod+Ctrl+3 move container to workspace number 3, workspace 3 - bindsym $mod+Ctrl+4 move container to workspace number 4, workspace 4 - bindsym $mod+Ctrl+5 move container to workspace number 5, workspace 5 - bindsym $mod+Ctrl+6 move container to workspace number 6, workspace 6 - bindsym $mod+Ctrl+7 move container to workspace number 7, workspace 7 - bindsym $mod+Ctrl+8 move container to workspace number 8, workspace 8 - bindsym $mod+Ctrl+9 move container to workspace number 9, workspace 9 - bindsym $mod+Ctrl+0 move container to workspace number 10, workspace 10 - # Note: workspaces can have any name you want, not just numbers. - # We just use 1-10 as the default. -# Layout stuff: - # You can "split" the current object of your focus with - # $mod+semicolon or $mod+apostrophe, for horizontal and vertical splits - # respectively. - bindsym $mod+semicolon splitv - bindsym $mod+apostrophe splith - - # Switch the current container between different layout styles - bindsym $mod+s layout stacking - bindsym $mod+w exec emacsclient -e '(thanos/pass-launcher)' - bindsym $mod+e layout toggle split - - # Make the current focus fullscreen - bindsym $mod+f fullscreen - - # Toggle the current focus between tiling and floating mode - bindsym $mod+Shift+space floating toggle - - # Swap focus between the tiling area and the floating area - bindsym $mod+space focus mode_toggle - - # Move focus to the parent container - bindsym $mod+p focus parent - # Move focus the child container - bindsym $mod+c focus child - -# Scratchpad: # -## hide | show window(minus is "-" and plus is "+".) -bindsym $mod+minus move scratchpad -bindsym $mod+equal scratchpad show - -#----------------------# -# Resizing containers: # -#----------------------# -#bindsym $mod+r mode "resize" -mode "resize" { - # left will shrink the containers width - # right will grow the containers width - # up will shrink the containers height - # down will grow the containers height - bindsym $left resize shrink width 10px - bindsym $up resize grow height 10px - bindsym $down resize shrink height 10px - bindsym $right resize grow width 10px - - # Ditto, with arrow keys - bindsym Left resize shrink width 10px - bindsym Up resize grow height 10px - bindsym Down resize shrink height 10px - bindsym Right resize grow width 10px - - # Return to default mode - bindsym Return mode "default" - bindsym Escape mode "default" -} -## Better to resize window -bindsym Shift+Ctrl+h resize shrink width 5 px or 5 ppt -bindsym Shift+Ctrl+k resize grow height 5 px or 5 ppt -bindsym Shift+Ctrl+j resize shrink height 5 px or 5 ppt -bindsym Shift+Ctrl+l resize grow width 5 px or 5 ppt -bindsym Shift+Ctrl+Left resize shrink width 5 px or 5 ppt -bindsym Shift+Ctrl+Up resize grow height 5 px or 5 ppt -bindsym Shift+Ctrl+Down resize shrink height 5 px or 5 ppt -bindsym Shift+Ctrl+Right resize grow width 5 px or 5 ppt diff --git a/waybar-config b/waybar-config deleted file mode 100644 index 66599a9..0000000 --- a/waybar-config +++ /dev/null @@ -1,123 +0,0 @@ -// -*- mode: json -*- - -{ - "layer": "top", - "position": "top", - - "modules-left": [ - "sway/workspaces", - "custom/right-arrow-dark" - ], - "modules-center": [ - "custom/left-arrow-dark", - "clock#1", - "custom/left-arrow-light", - "custom/left-arrow-dark", - "clock#2", - "custom/right-arrow-dark", - "custom/right-arrow-light", - "clock#3", - "custom/right-arrow-dark" - ], - "modules-right": [ - "custom/left-arrow-dark", - "pulseaudio", - "custom/left-arrow-light", - "custom/left-arrow-dark", - "memory", - "custom/left-arrow-light", - "custom/left-arrow-dark", - "cpu", - "custom/left-arrow-light", - "custom/left-arrow-dark", - "battery", - "custom/left-arrow-light", - "custom/left-arrow-dark", - "disk", - "custom/left-arrow-light", - "custom/left-arrow-dark", - "tray" - ], - - "custom/left-arrow-dark": { - "format": "", - "tooltip": false - }, - "custom/left-arrow-light": { - "format": "", - "tooltip": false - }, - "custom/right-arrow-dark": { - "format": "", - "tooltip": false - }, - "custom/right-arrow-light": { - "format": "", - "tooltip": false - }, - - "sway/workspaces": { - "disable-scroll": true, - "format": "{name}" - }, - - "clock#1": { - "format": "{:%a}", - "tooltip": false - }, - "clock#2": { - "format": "{:%H:%M}", - "tooltip": false - }, - "clock#3": { - "format": "{:%Y-%m-%d}", - "tooltip": false - }, - - "pulseaudio": { - "format": "VOL: {volume:2}%", - "format-bluetooth": "{icon} {volume}%", - "format-muted": "MUTE", - "format-icons": { - "headphones": "", - "default": [ - "", - "" - ] - }, - "scroll-step": 5, - "on-click": "pamixer -t", - "on-click-right": "pavucontrol" - }, - "memory": { - "interval": 5, - "format": "Mem {}%" - }, - "cpu": { - "interval": 5, - "format": "CPU {usage:2}%" - }, - "battery": { - "states": { - "good": 95, - "warning": 30, - "critical": 15 - }, - "format": "{icon} {capacity}%", - "format-icons": [ - "", - "", - "", - "", - "" - ] - }, - "disk": { - "interval": 5, - "format": "Disk {percentage_used:2}%", - "path": "/" - }, - "tray": { - "icon-size": 10 - } -} diff --git a/waybar-style.css b/waybar-style.css deleted file mode 100644 index 4c6cbf0..0000000 --- a/waybar-style.css +++ /dev/null @@ -1,74 +0,0 @@ -* { - font-size: 15px; - font-family: monospace; -} - -window#waybar { - background: #292b2e; - color: #fdf6e3; -} - -#custom-right-arrow-dark, -#custom-left-arrow-dark { - color: #1a1a1a; -} -#custom-right-arrow-light, -#custom-left-arrow-light { - color: #292b2e; - background: #1a1a1a; -} - -#workspaces, -#clock.1, -#clock.2, -#clock.3, -#pulseaudio, -#memory, -#cpu, -#battery, -#disk, -#tray { - background: #1a1a1a; -} - -#workspaces button { - padding: 0 2px; - color: #fdf6e3; -} -#workspaces button.focused { - color: #268bd2; -} -#workspaces button:hover { - box-shadow: inherit; - text-shadow: inherit; -} -#workspaces button:hover { - background: #1a1a1a; - border: #1a1a1a; - padding: 0 3px; -} - -#pulseaudio { - color: #268bd2; -} -#memory { - color: #2aa198; -} -#cpu { - color: #6c71c4; -} -#battery { - color: #859900; -} -#disk { - color: #b58900; -} - -#clock, -#pulseaudio, -#memory, -#cpu, -#battery, -#disk { - padding: 0 10px; -} -- cgit v1.2.3 From 0a986710fbaf68478127f593f10f4dfa66d7b1d6 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 10 May 2024 21:17:03 +0300 Subject: guix-home: Update packages & dotfile service --- guix/home.scm | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/guix/home.scm b/guix/home.scm index b11fc4f..02ee094 100644 --- a/guix/home.scm +++ b/guix/home.scm @@ -19,17 +19,24 @@ (home-environment ;; Below is the list of packages that will show up in your ;; Home profile, under ~/.guix-home/profile. - ;; (packages - ;; (append (map specification->package - ;; '("emacs-pgtk" "aspell-dict-el")))) + (packages (specifications->packages + (list "anki" "qtwebengine" "aspell-dict-el" "perl" "tree" + "font-iosevka-aile" "font-jetbrains-mono" "mu" "hyfetch" + "emacs-nov-el" "iptables" "emacs-yeetube" "syncthing" + "ungoogled-chromium" "emacs-pdf-tools" "python-lsp-server" + "transmission" "emacs-pgtk" "mpv" "yt-dlp" "icecat" "dino" "nyxt" + "0ad" "torbrowser" "pinentry" "emacs-elpy" "python-requests" + "python-mypy" "fuzzel" "alacritty" "wtype" "git" "emacs-geiser" + "emacs-geiser-guile" "sbcl" "curl" "libvterm" "emacs-vterm" + "inetutils" "emacs-jabber" "bind" "go" "nmap" "hunspell" + "hunspell-dict-en-us" "pinentry-emacs" "mlocate" "rsync"))) ;; Below is the list of Home services. To search for available ;; services, run 'guix home search KEYWORD' in a terminal. (services (list (service home-bash-service-type (home-bash-configuration (guix-defaults? #f) - (aliases '(("fanki" . "flatpak run net.ankiweb.Anki") - ("ga" . "git add") + (aliases '(("ga" . "git add") ("gaa" . "git add .") ("gc" . "git commit -m") ("gp" . "git push -u origin") @@ -46,19 +53,13 @@ ("ytd" . "yt-dlp") ("gx" . "guix"))) (bashrc (list (local-file "/home/thanos/dotfiles/bash-base.sh" #:recursive? #t))))) - ;; TODO: Rewrite this mess - (service home-xdg-configuration-files-service-type - `(("emacs/init.el" ,(local-file "../emacs.el")) - ("alacritty/alacritty.toml" ,(local-file "../alacritty.toml")) - ("sway/config" ,(local-file "../sway.config")) - ("waybar/config" ,(local-file "../waybar-config")) - ("waybar/style.css" ,(local-file "../waybar-style.css")))) (service home-dotfiles-service-type (home-dotfiles-configuration (directories '("/home/thanos/dotfiles/")) - (excluded '(".*~" ".*\\.swp" "\\.git" "\\.gitignore" ".*emacs.el" "sway\\*" "waybar-config" - "alacritty.toml" "vimium-options.json" "waybar-style.css" - ".*bash" "README" "LICENSE" ".*\\.scm" "sway.config" ".stow-local-ignore")))) + (excluded '(".*~" ".*\\.swp" "\\.git" "\\.gitignore" + ".*emacs.el" "waybar-config" "vimium-options.json" + ".*bash" "README" "LICENSE" ".*\\.scm" "__pycache__" "bash-base.sh")) + (layout 'plain))) ;; Env variables (simple-service 'profile-service-type home-environment-variables-service-type @@ -67,8 +68,7 @@ ("GTK_THEME" . "Adwaita-dark") ("XDG_CURRENT_DESKTOP" . "sway") ("XDG_SESSION_TYPE" . "wayland") - ("PATH" . "/home/$USER/.local/bin:$PATH") - ("XDG_DATA_DIRS" . "$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share"))) + ("PATH" . "/home/$USER/.local/bin:$PATH"))) ;; GPG Configuration (service home-gpg-agent-service-type (home-gpg-agent-configuration -- cgit v1.2.3 From 395b9780bf978eb133a6f815d995239d50f7e957 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 10 May 2024 21:17:19 +0300 Subject: guix-system: Remove flatpak --- guix/system.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guix/system.scm b/guix/system.scm index 2d38409..6dd0be7 100644 --- a/guix/system.scm +++ b/guix/system.scm @@ -32,7 +32,7 @@ ;; Packages installed system-wide. (packages (append (map specification->package - '("sway" "swaylock" "swaylock-effects" "swaybg" "flatpak" + '("sway" "swaylock" "swaylock-effects" "swaybg" "waybar" "mu" "gnupg" "pinentry" "password-store" "isync" "python" "sbcl" "font-jetbrains-mono" "docker" "docker-cli" "icecat" "git")) %base-packages)) -- cgit v1.2.3 From 5c5e4d98af25cf915c033349ad26069293374c83 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sun, 12 May 2024 19:18:17 +0300 Subject: guix:(home) Update packages --- guix/home.scm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/guix/home.scm b/guix/home.scm index 02ee094..b48d8fd 100644 --- a/guix/home.scm +++ b/guix/home.scm @@ -24,12 +24,13 @@ "font-iosevka-aile" "font-jetbrains-mono" "mu" "hyfetch" "emacs-nov-el" "iptables" "emacs-yeetube" "syncthing" "ungoogled-chromium" "emacs-pdf-tools" "python-lsp-server" - "transmission" "emacs-pgtk" "mpv" "yt-dlp" "icecat" "dino" "nyxt" - "0ad" "torbrowser" "pinentry" "emacs-elpy" "python-requests" + "transmission" "emacs-pgtk" "mpv" "yt-dlp" "icecat" "dino" + "0ad" "torbrowser" "emacs-elpy" "python-requests" "python-mypy" "fuzzel" "alacritty" "wtype" "git" "emacs-geiser" "emacs-geiser-guile" "sbcl" "curl" "libvterm" "emacs-vterm" "inetutils" "emacs-jabber" "bind" "go" "nmap" "hunspell" - "hunspell-dict-en-us" "pinentry-emacs" "mlocate" "rsync"))) + "hunspell-dict-en-us" "pinentry-emacs" "mlocate" "rsync" + "grimshot" "nyxt"))) ;; Below is the list of Home services. To search for available ;; services, run 'guix home search KEYWORD' in a terminal. (services -- cgit v1.2.3 From 14c42ec00e0cc48b292921acfa820aa4979c1da6 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sun, 12 May 2024 19:18:34 +0300 Subject: emacs: Remove gentoo packages --- .config/emacs/init.el | 67 +++++++++++++++++---------------------------------- 1 file changed, 22 insertions(+), 45 deletions(-) diff --git a/.config/emacs/init.el b/.config/emacs/init.el index a80febc..c9bb5b9 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -28,13 +28,25 @@ ;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰╯ ;;; Code: +;; Disable package.el +(setq package-enable-at-startup nil + package-archives nil) + (setf user-full-name "Thanos Apollo" user-mail-address "public@thanosapollo.org") + (defvar is-zeus (equal (system-name) "zeus")) (defvar is-hermes (equal (system-name) "hermes")) (defvar is-phone (equal (system-name) "localhost")) +;; Font +(custom-set-faces + (if is-hermes '(default ((t (:inherit nil :height 120 :family "Jetbrains Mono")))) + '(default ((t (:inherit nil :height 130 :family "Jetbrains Mono"))))) + '(variable-pitch ((t (:inherit t :family "Iosevka Aile")))) + '(org-modern-symbol ((t (:inherit t :family "Iosevka Aile"))))) + ;; Autoinsert (auto-insert-mode 1) @@ -74,8 +86,6 @@ (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) -(setq package-enable-at-startup nil) - (require 'straight) (setf straight-use-package-by-default t) @@ -88,7 +98,6 @@ (pcmpl-rc :type git :host nil :repo "git@thanosapollo.org:/var/git/pcmpl-rc.git"))) (use-package emacs - :straight nil :ensure t :config @@ -647,6 +656,7 @@ :commands emojify-mode) (use-package flycheck-package + :straight t :ensure t :after flycheck) @@ -691,13 +701,18 @@ (defalias (car alias) (cdr alias))) aliases)) +(defun thanos/eshell-clear () + "Interactive call for clear-scrollback." + (interactive) + (eshell/clear-scrollback)) + (use-package eshell :config (setf eshell-highlight-prompt t) (eshell-syntax-highlighting-global-mode 1) :bind (("C-c e" . eshell) :map eshell-mode-map - ("C-l" . eshell/clear-scrollback)) + ("C-l" . 'thanos/eshell-clear)) :hook ((eshell-mode . (lambda () (thanos/set-eshell-aliases thanos/aliases) (display-line-numbers-mode -1))))) @@ -818,16 +833,6 @@ By default, returns all jabber related buffers format." (setf xref-show-xrefs-function #'consult-xref xref-show-definitions-function #'consult-xref)) -(use-package moc-player - :defer t - :straight '(moc-player :local-repo "~/Dev/emacs-lisp/moc-player") - :init (define-prefix-command 'thanos/mocp) - :bind (("C-z" . thanos/mocp) - :map thanos/mocp - ("SPC" . 'mocp-toggle-pause) - ("n" . 'mocp-next) - ("p" . 'mocp-previous))) - ;; My packages (when (or is-zeus is-hermes) (use-package yeetube @@ -911,19 +916,7 @@ By default, returns all jabber related buffers format." ("t" . 'gnosis-test-start))) ;; Run vc-pull on startup - (gnosis-vc-pull) - - (use-package pcmpl-emerge - :defer t - :straight (pcmpl-emerge :local-repo "~/Dev/emacs-lisp/pcmpl-emerge")) - - (use-package pcmpl-rc - :straight (pcmpl-rc :local-repo "~/Dev/emacs-lisp/pcmpl-rc") - :defer t) - - (use-package pcmpl-tailscale - :straight (pcmpl-tailscale :local-repo "~/Dev/emacs-lisp/pcmpl-taiscale") - :defer t)) + (gnosis-vc-pull)) ;; Emacs dev @@ -936,8 +929,7 @@ By default, returns all jabber related buffers format." :config (setf gptel-api-key (password-store-get-field "openai/openai@thanosapollo.org" "api") gptel-default-mode 'org-mode) - (setq-default gptel-model "ChatGPT:gpt-4" - gptel-backend (gptel-make-ollama "Ollama" + (setq-default gptel-backend (gptel-make-ollama "Ollama" :host "zeus:11434" :stream t :models '("llama2:latest" "zephyr:latest" "codellama:latest" @@ -953,14 +945,6 @@ By default, returns all jabber related buffers format." :map gptel-mode-map ("C-c h" . 'gptel-menu))) -;; (use-package copilot -;; :straight (copilot :host github :repo "zerolfx/copilot.el" :files ("dist" "*.el")) -;; :bind (:map copilot-mode-map -;; ("M-TAB" . 'copilot-accept-completion-by-line) -;; ("C-M-" . 'copilot-accept-completion-by-word) -;; ("C-M-n" . 'copilot-next-completion) -;; ("C-M-p" . 'copilot-previous-completion))) - ;; Password-store (use-package password-store @@ -1207,7 +1191,7 @@ By default, returns all jabber related buffers format." (defun thanos/wallpaper-set (image) "Set IMAGE as wallpaper, using feh." - (let ((command (if is-zeus "swaybg -o '*' -i" "feh --bg-scale"))) + (let ((command "swaybg -o '*' -i")) ;; Kill previous swaybg (call-process-shell-command "kill -15 $(pgrep swaybg | tail -n 1)") ;; Set wallpaper @@ -1265,11 +1249,4 @@ By default, returns all jabber related buffers format." :group 'iimage :lighter " iImg" (thanos/iimage-mode-buffer thanos/iimage-mode)) -;; Font -(custom-set-faces - (if is-hermes '(default ((t (:inherit nil :height 120 :family "Jetbrains Mono")))) - '(default ((t (:inherit nil :height 130 :family "Jetbrains Mono"))))) - '(variable-pitch ((t (:inherit t :family "Iosevka Aile")))) - '(org-modern-symbol ((t (:inherit t :family "Iosevka Aile"))))) - ;;; init.el ends here -- cgit v1.2.3 From 56c0b84e1d53231593a27fd74404a52e47d75a90 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sun, 12 May 2024 19:20:32 +0300 Subject: waybar: Remove disk & extra arrows modules --- .config/waybar/config | 213 ++++++++++++++++++++++++-------------------------- 1 file changed, 101 insertions(+), 112 deletions(-) diff --git a/.config/waybar/config b/.config/waybar/config index 66599a9..a5c780a 100644 --- a/.config/waybar/config +++ b/.config/waybar/config @@ -1,123 +1,112 @@ // -*- mode: json -*- { - "layer": "top", - "position": "top", + "layer": "top", + "position": "top", - "modules-left": [ - "sway/workspaces", - "custom/right-arrow-dark" - ], - "modules-center": [ - "custom/left-arrow-dark", - "clock#1", - "custom/left-arrow-light", - "custom/left-arrow-dark", - "clock#2", - "custom/right-arrow-dark", - "custom/right-arrow-light", - "clock#3", - "custom/right-arrow-dark" - ], - "modules-right": [ - "custom/left-arrow-dark", - "pulseaudio", - "custom/left-arrow-light", - "custom/left-arrow-dark", - "memory", - "custom/left-arrow-light", - "custom/left-arrow-dark", - "cpu", - "custom/left-arrow-light", - "custom/left-arrow-dark", - "battery", - "custom/left-arrow-light", - "custom/left-arrow-dark", - "disk", - "custom/left-arrow-light", - "custom/left-arrow-dark", - "tray" - ], + "modules-left": [ + "sway/workspaces", + "custom/right-arrow-dark" + ], + "modules-center": [ + "custom/left-arrow-dark", + "clock#1", + "custom/left-arrow-light", + "custom/left-arrow-dark", + "clock#2", + "custom/right-arrow-dark", + "custom/right-arrow-light", + "clock#3", + "custom/right-arrow-dark" + ], + "modules-right": [ + "custom/left-arrow-dark", + "pulseaudio", + "custom/left-arrow-light", + "custom/left-arrow-dark", + "memory", + "custom/left-arrow-light", + "custom/left-arrow-dark", + "cpu", + "custom/left-arrow-light", + "custom/left-arrow-dark", + "battery", + "custom/left-arrow-light", + "tray" + ], - "custom/left-arrow-dark": { - "format": "", - "tooltip": false - }, - "custom/left-arrow-light": { - "format": "", - "tooltip": false - }, - "custom/right-arrow-dark": { - "format": "", - "tooltip": false - }, - "custom/right-arrow-light": { - "format": "", - "tooltip": false - }, + "custom/left-arrow-dark": { + "format": "", + "tooltip": false + }, + "custom/left-arrow-light": { + "format": "", + "tooltip": false + }, + "custom/right-arrow-dark": { + "format": "", + "tooltip": false + }, + "custom/right-arrow-light": { + "format": "", + "tooltip": false + }, - "sway/workspaces": { - "disable-scroll": true, - "format": "{name}" - }, + "sway/workspaces": { + "disable-scroll": true, + "format": "{name}" + }, - "clock#1": { - "format": "{:%a}", - "tooltip": false - }, - "clock#2": { - "format": "{:%H:%M}", - "tooltip": false - }, - "clock#3": { - "format": "{:%Y-%m-%d}", - "tooltip": false - }, + "clock#1": { + "format": "{:%a}", + "tooltip": false + }, + "clock#2": { + "format": "{:%H:%M}", + "tooltip": false + }, + "clock#3": { + "format": "{:%m-%d}", + "tooltip": false + }, - "pulseaudio": { - "format": "VOL: {volume:2}%", - "format-bluetooth": "{icon} {volume}%", - "format-muted": "MUTE", - "format-icons": { - "headphones": "", - "default": [ - "", - "" - ] - }, - "scroll-step": 5, - "on-click": "pamixer -t", - "on-click-right": "pavucontrol" - }, - "memory": { - "interval": 5, - "format": "Mem {}%" - }, - "cpu": { - "interval": 5, - "format": "CPU {usage:2}%" - }, - "battery": { - "states": { - "good": 95, - "warning": 30, - "critical": 15 - }, - "format": "{icon} {capacity}%", - "format-icons": [ - "", - "", - "", - "", - "" - ] + "pulseaudio": { + "format": "VOL: {volume:2}%", + "format-bluetooth": "{icon} {volume}%", + "format-muted": "MUTE", + "format-icons": { + "headphones": "", + "default": [ + "", + "" + ] }, - "disk": { - "interval": 5, - "format": "Disk {percentage_used:2}%", - "path": "/" + "scroll-step": 5, + "on-click": "pamixer -t", + "on-click-right": "pavucontrol" + }, + "memory": { + "interval": 5, + "format": "MEM {}%" + }, + "cpu": { + "interval": 5, + "format": "CPU {usage:2}%" + }, + "battery": { + "states": { + "good": 95, + "warning": 30, + "critical": 15 }, - "tray": { - "icon-size": 10 - } + "format": "BAT: {capacity}%", + }, + "disk": { + "interval": 5, + "format": "Disk {percentage_used:2}%", + "path": "/" + }, + "tray": { + "icon-size": 10 + } } -- cgit v1.2.3 From 584848eb6e40a8247f9e16040659e2a1f8469661 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sun, 12 May 2024 19:21:02 +0300 Subject: Add fuzzel --- .config/fuzzel/fuzzel.ini | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .config/fuzzel/fuzzel.ini diff --git a/.config/fuzzel/fuzzel.ini b/.config/fuzzel/fuzzel.ini new file mode 100644 index 0000000..c36c47c --- /dev/null +++ b/.config/fuzzel/fuzzel.ini @@ -0,0 +1,20 @@ +width=50 +font=Jetbrains Mono:weight=bold:size=10 +line-height=20 +fields=filename,name +inner-pad=15 +prompt="❯ " +layer=overlay +dpi-aware=yes +icons-enabled=false + +[colors] +background=0C0C0Cff +selection=3d4474fa +border=1e1e1eff + +[border] +radius=30 + +[dmenu] +exit-immediately-if-empty=yes -- cgit v1.2.3 From 5110563667a857a8e1cbd46c92219f6b08956ac0 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sun, 12 May 2024 23:41:25 +0300 Subject: emacs: Refactor thanos/pass-launcher --- .config/emacs/init.el | 79 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 33 deletions(-) diff --git a/.config/emacs/init.el b/.config/emacs/init.el index c9bb5b9..eccc78a 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -952,6 +952,52 @@ By default, returns all jabber related buffers format." :defer t :config (setf password-store-password-length (+ 20 (random 20))) + + (defmacro thanos/make-frame (name &rest body) + "Create temporary frame as NAME. + +Create a temporary frame to execute BODY, which will then be deleted." + `(unwind-protect + (with-selected-frame + (make-frame '((name . ,name) + (fullscreen . 0) + (undecorated . t) + (minibuffer . only) + (width . 70) + (height . 15))) + ,@body + (delete-frame)))) + + (defun thanos/pass-autotype (&optional entry) + "Autotype password ENTRY." + (let* ((entry (or entry (password-store--completing-read t))) + (user (password-store-get-field entry "user")) + (pass (password-store-get entry))) + (start-process-shell-command + "wtype" nil + (format "sleep 0.3 && wtype %s -P tab %s" + (shell-quote-argument (if user user "thanosapollo")) + (shell-quote-argument pass))))) + + (defun thanos/pass-launcher () + "Launch Emacs as a front-end for pass." + (interactive) + (thanos/make-frame + "thanos/pass-launcher" + (let* ((choice (completing-read "Choose an action: " + '("AUTO" "COPY PASS" "EDIT" "GENERATE"))) + (action (pcase choice + ("AUTO" #'thanos/pass-autotype) + ("COPY PASS" #'password-store-copy) + ("EDIT" #'password-store-edit) + ("GENERATE" #'password-store-generate)))) + (funcall action (completing-read "Search: " (password-store-list)))))) + + (defun smtp-get-pass () + "Get password for smtp." + (interactive) + (password-store-copy-field "fastmail.com/thanosapollo@fastmail.com" "smtp")) + :bind (("C-c p" . 'thanos/pass) :map thanos/pass ("i" . 'password-store-insert) @@ -960,39 +1006,6 @@ By default, returns all jabber related buffers format." ("c" . 'password-store-copy) ("s" . 'smtp-get-pass))) -(defun thanos/pass-launcher () - "Launch Emacs as a front-end for pass." - (interactive) - (unwind-protect - (with-selected-frame - (make-frame '((name . "thanos/pass-launcher") - (fullscreen . 0) - (undecorated . t) - (minibuffer . only) - (width . 70) - (height . 15))) - (let* ((choice (completing-read "Choose an action: " - '("AUTO" "COPY PASS" "COPY USERNAME" "EDIT" "GENERATE"))) - (action (pcase choice - ("AUTO" #'(lambda (entry) (let ((user (password-store-get-field entry "user")) - (pass (password-store-get entry))) - (start-process-shell-command - "wtype" nil - (format "sleep 0.3 && wtype %s -P tab %s" - (shell-quote-argument (if user user "thanosapollo")) - (shell-quote-argument pass)))))) - ("COPY PASS" #'password-store-copy) - ("COPY USERNAME" #'(lambda (entry) (password-store-copy-field entry "user"))) - ("EDIT" #'password-store-edit) - ("GENERATE" #'password-store-generate)))) - (funcall action (completing-read "Search: " (password-store-list))) - (delete-frame))))) - -(defun smtp-get-pass () - "Get password for smtp." - (interactive) - (password-store-copy-field "fastmail.com/thanosapollo@fastmail.com" "smtp")) - (use-package package-lint :defer t) -- cgit v1.2.3 From 5f13fe17ed52f5ecd352209221a07e67fd21584d Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Mon, 13 May 2024 08:03:10 +0300 Subject: emacs: Use straight for yeetube --- .config/emacs/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/emacs/init.el b/.config/emacs/init.el index eccc78a..493f554 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -837,12 +837,12 @@ By default, returns all jabber related buffers format." (when (or is-zeus is-hermes) (use-package yeetube :init (define-prefix-command 'thanos/yeetube-map) - :straight nil + :straight (yeetube :local-repo "~/Dev/emacs-lisp/yeetube") :ensure t :config (setf yeetube-results-limit 20 yeetube-mpv-disable-video t - yeetube-display-thumbnails nil + yeetube-display-thumbnails t yeetube-play-function #'yeetube-mpv-play) (defun yeetube-download-videos-ffmpeg () -- cgit v1.2.3 From 349c9a513f69e656c1a67a65dd3171702285a116 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Mon, 13 May 2024 08:03:33 +0300 Subject: guix:(home) Add browser & xdg_screenshots_dir for shell config --- guix/home.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/guix/home.scm b/guix/home.scm index b48d8fd..08fd7ce 100644 --- a/guix/home.scm +++ b/guix/home.scm @@ -69,6 +69,8 @@ ("GTK_THEME" . "Adwaita-dark") ("XDG_CURRENT_DESKTOP" . "sway") ("XDG_SESSION_TYPE" . "wayland") + ("BROWSER" . "icecat") + ("XDG_SCREENSHOTS_DIR" . "/home/$USER/Pictures/screenshots/") ("PATH" . "/home/$USER/.local/bin:$PATH"))) ;; GPG Configuration (service home-gpg-agent-service-type -- cgit v1.2.3 From fce9239ff77339998a2407ed0574b7f124417c04 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Mon, 13 May 2024 08:05:43 +0300 Subject: change mods --- .config/autostart/autostart.sh | 0 .config/qtile/colors.py | 0 .config/qtile/spotify2.png | Bin 29204 -> 0 bytes .mbsyncrc | 2 +- 4 files changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 .config/autostart/autostart.sh mode change 100755 => 100644 .config/qtile/colors.py delete mode 100755 .config/qtile/spotify2.png diff --git a/.config/autostart/autostart.sh b/.config/autostart/autostart.sh old mode 100755 new mode 100644 diff --git a/.config/qtile/colors.py b/.config/qtile/colors.py old mode 100755 new mode 100644 diff --git a/.config/qtile/spotify2.png b/.config/qtile/spotify2.png deleted file mode 100755 index a7f88f7..0000000 Binary files a/.config/qtile/spotify2.png and /dev/null differ diff --git a/.mbsyncrc b/.mbsyncrc index 371b864..ef184a1 100644 --- a/.mbsyncrc +++ b/.mbsyncrc @@ -51,4 +51,4 @@ Expunge None CopyArrivalDate yes Sync All Create Both -SyncState * +SyncState * \ No newline at end of file -- cgit v1.2.3 From fb87dd1aa75d413a86f3dd2db457c3291e425bb5 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Mon, 13 May 2024 08:06:03 +0300 Subject: sway: Add screenshot keys --- .config/sway/config | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.config/sway/config b/.config/sway/config index 8eaa6d6..94e82d6 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -9,8 +9,9 @@ bindsym $mod+o exec killall -SIGUSR1 waybar # Workspace switch bindsym $mod+period workspace back_and_forth -bindsym $mod+slash workspace next -bindsym $mod+comma workspace prev +bindsym $mod+comma grimshot save area +bindsym $mod+m grimshot save screen + ## Setup monitors & wallpapers output DP-2 pos 0 0 res 2560x1440 bg ~/wallpapers/colors-fantasy.jpg stretch output HDMI-A-1 pos 2560 0 res 2560x1440 bg ~/wallpapers/colors-fantasy.jpg fill transform 270 -- cgit v1.2.3 From 5d6840de02f01c017cc1ce99238d6962331087da Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Mon, 13 May 2024 08:42:24 +0300 Subject: guix:(system) Major rewrite --- guix/system.scm | 114 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 90 insertions(+), 24 deletions(-) diff --git a/guix/system.scm b/guix/system.scm index 6dd0be7..2a86298 100644 --- a/guix/system.scm +++ b/guix/system.scm @@ -1,14 +1,19 @@ ;; TODO: Use this as a base module and seperate each system/machine (use-modules (gnu) (gnu services) - (gnu home services desktop) - (gnu home services desktop) - (gnu home services gnupg) + (gnu services dbus) + (gnu services desktop) + (gnu system) + (gnu system setuid) + (gnu system nss) (nongnu packages linux) (nongnu system linux-initrd)) (use-service-modules cups desktop networking ssh xorg docker guix admin pm docker) +(use-package-modules nfs certs shells ssh linux bash emacs networking wm fonts libusb cups freedesktop file-systems version-control package-management) + + (operating-system (locale "en_US.utf8") (timezone "Europe/Athens") @@ -33,36 +38,97 @@ (packages (append (map specification->package '("sway" "swaylock" "swaylock-effects" "swaybg" - "waybar" "mu" "gnupg" "pinentry" "password-store" "isync" "python" - "sbcl" "font-jetbrains-mono" "docker" "docker-cli" "icecat" "git")) + "waybar" "gnupg" "pinentry" "password-store" + "isync" "python" "font-jetbrains-mono" "docker" + "docker-cli" "icecat" "git" "avahi")) %base-packages)) ;; Below is the list of system services. To search for available ;; services, run 'guix system search KEYWORD' in a terminal. (services - (append (list (service gnome-desktop-service-type) - (service docker-service-type) - - (service openssh-service-type - (openssh-configuration - (permit-root-login 'prohibit-password))) - ;; ;; TODO: Fix swaylock - ;; (service screen-locker-service-type - ;; (screen-locker-configuration - ;; (name "swaylock") - ;; (program (file-append swaylock "/bin/swaylock")) - ;; (using-pam? #t) - ;; (using-setuid? #f))) - - (service tor-service-type) - (service cups-service-type) - (set-xorg-configuration - (xorg-configuration (keyboard-layout keyboard-layout)))) - %desktop-services)) + (append (list + (service docker-service-type) + ;; tty login + (service elogind-service-type) + + (service console-font-service-type + (map (lambda (tty) + ;; Use a larger font for HIDPI screens + (cons tty (file-append + font-terminus + "/share/consolefonts/ter-132n"))) + '("tty1" "tty2" "tty3"))) + + (service greetd-service-type + (greetd-configuration + (greeter-supplementary-groups + (list "video" "input")) + (terminals + (list + (greetd-terminal-configuration + (terminal-vt "1") + (terminal-switch #t)) + (greetd-terminal-configuration + (terminal-vt "2")) + (greetd-terminal-configuration + (terminal-vt "3")))))) + + + (service gnome-desktop-service-type) + + (service openssh-service-type + (openssh-configuration + (permit-root-login 'prohibit-password))) + + ;; (service static-networking-service-type + ;; (list %loopback-static-networking)) + + ;; TODO: Fix swaylock + (service screen-locker-service-type + (screen-locker-configuration + (name "swaylock") + (program (file-append swaylock "/bin/swaylock")) + (using-pam? #t) + (using-setuid? #f))) + + ;; Networking services + (service network-manager-service-type) + (service wpa-supplicant-service-type) ;; Needed by NetworkManager + (service modem-manager-service-type) ;; For cellular modems + + polkit-wheel-service + + (service tor-service-type) + (service cups-service-type) + ;; + ;; (service avahi-service-type) + (service udisks-service-type) + (service upower-service-type) + (service cups-pk-helper-service-type) + (service geoclue-service-type) + ;; (service polkit-service-type) + ;; (service dbus-root-service-type) + fontconfig-file-system-service ;; Manage the fontconfig cache + + ;; Power and thermal management services + (service thermald-service-type) + (service tlp-service-type + (tlp-configuration + (cpu-boost-on-ac? #t) + (wifi-pwr-on-bat? #t)))) + + (modify-services %base-services + (delete login-service-type) + (delete mingetty-service-type) + (delete console-font-service-type)))) + + (bootloader (bootloader-configuration (bootloader grub-efi-bootloader) (targets (list "/boot/efi")) (keyboard-layout keyboard-layout))) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (swap-devices (list (swap-space (target (uuid "10551e45-7810-4171-a4b2-87372ae5bdb4"))))) -- cgit v1.2.3