From 84d21fff125407039dd300708226488ab4f6c660 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Wed, 30 Nov 2022 02:38:34 +0200 Subject: Restracture --- .emacs.d/lisp/functions.el | 110 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 .emacs.d/lisp/functions.el (limited to '.emacs.d/lisp/functions.el') 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 +" + + + + + + My Title + + + + +
+

Starting point

+
+ + +" )) + +(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-") '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 + -- cgit v1.2.3