diff options
author | Thanos Apollo <[email protected]> | 2022-11-30 02:38:34 +0200 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2022-11-30 02:38:34 +0200 |
commit | 84d21fff125407039dd300708226488ab4f6c660 (patch) | |
tree | d3554eebcb44de2816921540792a5cb9c804a9cf | |
parent | 50bc7230ad8780d4d037ad66581d40e87a9dad8d (diff) |
Restracture
-rw-r--r-- | .emacs.d/lisp/functions.el | 110 | ||||
-rw-r--r-- | .emacs.d/lisp/keys.el | 31 |
2 files changed, 141 insertions, 0 deletions
diff --git a/.emacs.d/lisp/functions.el b/.emacs.d/lisp/functions.el new file mode 100644 index 0000000..6823f28 --- /dev/null +++ b/.emacs.d/lisp/functions.el @@ -0,0 +1,110 @@ +;;; package --- Summary +;;; Commentary: +;;; useful snippets of code for my daily use. +;;; Code: + + +(defun apollo/html-boostrap-boilerplate () + "Insert html boilerplate with boostrap link." + (interactive) + (insert +"<!DOCTYPE html> +<html lang=\"en\"> + <head> + <meta charset=\"UTF-8\"> + <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"> + <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\"> + <title>My Title</title> + <link rel=\"stylesheet\" href=\"./style.css\"> + <link href=\"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css\" rel=\"stylesheet\" integrity=\"sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi\" crossorigin=\"anonymous\"> + </head> + <body> + <main> + <h1>Starting point</h1> + </main> + <script src=\"index.js\"></script> + </body> +</html>" )) + +(defun center-buffer () + "Center buffer." + (interactive) + (setq visual-fill-column-width 100 + visual-fill-column-center-text t) + (visual-fill-column-mode 1)) + +(defun center-buffer-undo () + "Undo center-buffer." + (interactive) + (setq visual-fill-column-width 2000 + visual-fill-column-center-text nil) + (visual-fill-column-mode 1)) +(require 'use-package) + +(defun apollo/rofi-switch-window () + "Launch rofi. Cant get it to work with exwm as of now tho." + (interactive) + (start-process-shell-command + "rofi" nil "rofi -show window")) +;; (global-set-key (kbd "s-<tab>") 'apollo/run_rofi) + +(defun apollo/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 rofi () + "Run Rofi." + (interactive) + (apollo/run-in-background "rofi -show drun")) + +(defun apollo/volume-increase () + "Increase Volume." + (interactive) + (start-process-shell-command + "amixer" nil "amixer sset Master 5%+")) + +(defun apollo/volume-decrease () + "Decrease Volume." + (interactive) + (start-process-shell-command + "amixer" nil "amixer sset Master 5%-")) + +(defun apollo/restore-wallpaper () + "Restore wallpaper." + (interactive) + (start-process-shell-command + "nitrogen" nil "nitrogen --restore")) + +(defun apollo/emacs-keys () + "Swap caps with ctrl." + (interactive) + (start-process-shell-command + "setxkbmap" nil "setxkbmap us -option ctrl:swapcaps")) + +(defun apollo/greek-keyboard () + "Swap caps with ctrl." + (interactive) + (start-process-shell-command + "setxkbmap" nil "setxkbmap gr")) + +(defun apollo/exwm-init-hook () + "Do this upon start." + (display-battery-mode 0) ;;Change to 1 to display battery + + (setq display-time-day-and-date t) + (display-time-mode 1) + + ;;Launch apps that will run in the background +;; (apollo/run-in-background "blueman-applet") + (apollo/run-in-background "picom") +;; (apollo/run-in-background "nm-applet") + (apollo/emacs-keys) + (apollo/set-wallpaper) + ) + +(defun apollo/exwm-update-class () + (exwm-workspace-rename-buffer exwm-class-name)) + +;;; my-functions.el ends here + diff --git a/.emacs.d/lisp/keys.el b/.emacs.d/lisp/keys.el new file mode 100644 index 0000000..051a93a --- /dev/null +++ b/.emacs.d/lisp/keys.el @@ -0,0 +1,31 @@ +;; init-keys.el +;;; Code: + +;;Ibuffer +(global-set-key (kbd "C-x C-b") 'ibuffer) + +;;Editing +(global-set-key (kbd "C-d") 'kill-region) +(global-set-key (kbd "C-k") 'copy-region-as-kill) + +;;Counsel +(global-set-key (kbd "M-;") 'counsel-M-x) + +;;Window control map +(define-prefix-command 'window-control-map) +(global-set-key (kbd "C-w") 'window-control-map) +(define-key window-control-map (kbd "C-v") 'split-window-right) +(define-key window-control-map (kbd "C-n") 'windmove-right) +(define-key window-control-map (kbd "C-p") 'windmove-left) +(define-key window-control-map (kbd "C-q") 'delete-window) + + +;;; God Mode +;; (use-package god-mode +;; :init +;; (god-mode) +;; :config +;; (global-set-key (kbd "C-f") #'god-mode-all)) + + +;;init-keys ends here |