summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanosApollo <[email protected]>2022-11-24 18:34:59 +0200
committerThanosApollo <[email protected]>2022-11-24 18:34:59 +0200
commite6d3dfdbf2b77b2fcfe01dc8c1f66d427b5c4917 (patch)
tree65ac41b5a7beffd5e155b791e42d98f64979b0ef
parentad0d1d13a49d547588a8a0971a43c0faa37f94a0 (diff)
Add volume-keys and background processes
-rw-r--r--.emacs.d/lisp/init-exwm.el75
1 files changed, 63 insertions, 12 deletions
diff --git a/.emacs.d/lisp/init-exwm.el b/.emacs.d/lisp/init-exwm.el
index a96974c..c29ef2c 100644
--- a/.emacs.d/lisp/init-exwm.el
+++ b/.emacs.d/lisp/init-exwm.el
@@ -3,30 +3,74 @@
;;; Code:
-(use-package dmenu
- :bind
- ("s-d" . dmenu))
-
-;; (defun apollo/run_rofi ()
-;; (interactive)
-;; (start-process-shell-command
-;; "rofi" nil "rofi -show drun"))
+;; (use-package dmenu
+;; :bind
+;; ("s-d" . dmenu))
+
+(defun apollo/run_rofi ()
+ "Launch rofi. Cant get it to work with exwm as of now tho."
+ (interactive)
+ (start-process-shell-command
+ "rofi" nil "rofi -show run"))
;; (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 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/set-wallpaper ()
+ "Restore wallpaper."
+ (interactive)
+ (start-process-shell-command
+ "nitrogen" nil "nitrogen --restore"))
+
+(defun apollo/change-keys ()
+ "Swap caps with ctrl."
+ (interactive)
+ (start-process-shell-command
+ "setxkbmap" nil "setxkbmap -option ctrl:swapcaps"))
+
+(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-background "nm-applet")
+ (apollo/change-keys)
+ (apollo/set-wallpaper)
+ )
+
(defun apollo/exwm-update-class ()
(exwm-workspace-rename-buffer exwm-class-name))
(use-package exwm
:config
- (setq exwm-workspace-number 10)
+ (setq exwm-workspace-number 6)
;; When window "class" updates, use it to set the buffer name
(add-hook 'exwm-update-class-hook #'apollo/exwm-update-class)
+ ;;When EXWM starts up, run this hook
+ (add-hook 'exwm-init-hook #'apollo/exwm-init-hook)
(start-process-shell-command
"xrandr" nil "xrandr --output eDP1 --off --output DP1 --off --output DP2 --off --output HDMI1 --mode 1920x1080 --pos 0x0 --rotate left --output HDMI2 --primary --mode 2560x1440 --pos 1080x0 --rotate normal --output VIRTUAL1 --off")
- ;; Rebind CapsLock to Ctrl
;; Set the screen resolution (update this to be the correct resolution for your screen!)
@@ -43,6 +87,7 @@
'(?\C-x
?\C-u
?\C-h
+ ?\C-w
?\M-x
?\M-`
?\M-&
@@ -63,10 +108,10 @@
;; Move between windows
([s-left] . windmove-left)
- ([s-right] . windmove-right)
+ ([C-w C-n] . windmove-right)
([s-up] . windmove-up)
([s-down] . windmove-down)
- ([s-v] . split-window-right)
+ ([C-w C-v] . split-window-right)
;; Launch applications via shell command
([?\s-&] . (lambda (command)
@@ -84,6 +129,12 @@
(interactive)
(exwm-workspace-switch-create ,i))))
(number-sequence 0 9))))
+
+ (exwm-input-set-key (kbd "s-d") 'counsel-linux-app)
+ (exwm-input-set-key (kbd "s-<tab>") 'apollo/run_rofi)
+ (exwm-input-set-key (kbd "s-q") 'kill-emacs)
+ (exwm-input-set-key (kbd "<XF86AudioRaiseVolume>") 'apollo/volume-increase)
+ (exwm-input-set-key (kbd "<XF86AudioLowerVolume>") 'apollo/volume-decrease)
(exwm-enable))