diff options
author | Thanos Apollo <[email protected]> | 2023-01-07 01:54:31 +0200 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2023-01-07 01:54:31 +0200 |
commit | 29e51385230607376a30aa2ef71c05e4679f6a78 (patch) | |
tree | 1976f92c5e6882463176fbfaa8ed99ee1752f7bc /.emacs.d/snippets/functions.el | |
parent | 773bd263bbb65e656a6184e8fe7e653399ae07ba (diff) |
Rename lisp/ to snippets/
Diffstat (limited to '.emacs.d/snippets/functions.el')
-rw-r--r-- | .emacs.d/snippets/functions.el | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/.emacs.d/snippets/functions.el b/.emacs.d/snippets/functions.el new file mode 100644 index 0000000..30cfa60 --- /dev/null +++ b/.emacs.d/snippets/functions.el @@ -0,0 +1,110 @@ +;;; package --- Summary +;;; Commentary: +;;; Random functions 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 apollo/center-buffer () + "Centers/Uncenters selected buffer" + (interactive) + (if visual-fill-column-center-text + (setq visual-fill-column-center-text nil) + (setq visual-fill-column-center-text t)) + (visual-fill-column-mode 1) + (message "General's task completed!")) + + +(defun apollo/rofi-switch-window () + "Navigate X11 buffers using rofi." + (interactive) + (start-process-shell-command + "rofi" nil "rofi -show window")) + +(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 () + "Set NAME as wallpaper." + (interactive) + (start-process-shell-command + "feh" nil "feh --bg-scale ~/Downloads/winter-night-wallpaper.png")) + +(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)) + +(defun eshell-new() + "Open a new instance of eshell." + (interactive) + (eshell 'N)) + +;;; my-functions.el ends here + |