summaryrefslogtreecommitdiff
path: root/.emacs.d/snippets/functions.el
blob: 64a4af87829b9c04317a3fcd2e16494566b8fd65 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
;;; 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 ~/dotfiles/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))

(defun make-mini-buffer ()
  (interactive)
  (split-window-below 40)
  (other-window 1))

(defun make-mini-geiser ()
  (interactive)
  (split-window-below 60)
  (geiser nil))
;;; my-functions.el ends here