From 325f1c0da2132705fb71153bb22a4ecd4482dae5 Mon Sep 17 00:00:00 2001 From: zongor Date: Wed, 18 Dec 2024 14:49:36 -0500 Subject: [PATCH] add exwm config --- .emacs | 52 ++++++++--- .emacs.d/exwm/.exwm-config.el.~undo-tree~ | 7 ++ .emacs.d/exwm/.start-exwm.~undo-tree~ | 7 ++ .emacs.d/exwm/exwm-config.el | 108 ++++++++++++++++++++++ .emacs.d/exwm/exwm-config.el~ | 108 ++++++++++++++++++++++ .emacs.d/exwm/exwm.desktop | 7 ++ .emacs.d/exwm/start-exwm | 6 ++ .emacs.d/exwm/start-exwm~ | 3 + 8 files changed, 284 insertions(+), 14 deletions(-) create mode 100644 .emacs.d/exwm/.exwm-config.el.~undo-tree~ create mode 100644 .emacs.d/exwm/.start-exwm.~undo-tree~ create mode 100644 .emacs.d/exwm/exwm-config.el create mode 100644 .emacs.d/exwm/exwm-config.el~ create mode 100644 .emacs.d/exwm/exwm.desktop create mode 100644 .emacs.d/exwm/start-exwm create mode 100644 .emacs.d/exwm/start-exwm~ diff --git a/.emacs b/.emacs index 74d38bb..3d9ee16 100755 --- a/.emacs +++ b/.emacs @@ -86,6 +86,8 @@ (menu-bar-mode -1) (show-paren-mode 1) (blink-cursor-mode 0) +(display-battery-mode 1) +(display-time-mode 1) (set-cursor-color "#ffffff") (defun move-to-previous-window () @@ -169,8 +171,6 @@ and position the cursor inside the comment. Additionally insert the word under t (define-key evil-normal-state-map (kbd "C-M-p") 'compile) (define-key evil-normal-state-map (kbd "C-M-k") 'compile) (define-key evil-normal-state-map (kbd "M-/") 'dabbrev-expand) - (define-key evil-normal-state-map (kbd "C-,") 'move-to-previous-window) - (define-key evil-normal-state-map (kbd "C-.") 'move-to-next-window) (define-key evil-normal-state-map (kbd "C-M-\\") 'format-all-buffer) ;; (evil-define-key 'normal Buffer-menu-mode-map (kbd "RET") ) (evil-define-key 'normal neotree-mode-map (kbd "TAB") 'neotree-enter) @@ -413,8 +413,7 @@ Other buffer group by `centaur-tabs-get-group-name' with project name." ("g T" . centaur-tabs-backward))) (use-package undo-tree - :config (global-undo-tree-mode 1) - :diminish undo-tree-mode) + :config (global-undo-tree-mode 1)) (use-package format-all :hook ((format-all-mode-hook . format-all-ensure-formatter))) @@ -473,6 +472,19 @@ Other buffer group by `centaur-tabs-get-group-name' with project name." (use-package ivy :init (ivy-mode 1)) +(use-package counsel + :bind (("C-M-j" . 'counsel-switch-buffer) + :map minibuffer-local-map + ("C-r" . 'counsel-minibuffer-history)) + :custom + (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only) + :config + (counsel-mode 1)) + +(use-package ivy-rich + :init + (ivy-rich-mode 1)) + (use-package org-modern :config (setq @@ -528,35 +540,47 @@ Other buffer group by `centaur-tabs-get-group-name' with project name." (typescript-mode . tide-hl-identifier-mode) (before-save . tide-format-before-save))) (use-package uxntal-mode) -(use-package hy-mode) +;(use-package hy-mode) (use-package lua-mode) -(use-package elm-mode) +;(use-package elm-mode) (use-package go-mode) -(use-package rust-mode) -(use-package cargo) +;(use-package rust-mode) +;(use-package cargo) (use-package ccls :ensure t :init (setq ccls-executable "/usr/bin/ccls") :hook ((c-mode c++-mode objc-mode cuda-mode) . (lambda () (require 'ccls) (lsp)))) +(use-package elixir-mode + :ensure t + :hook + (elixir-mode . inf-elixir-minor-mode)) + +(use-package inf-elixir + :ensure t) + (use-package lsp-mode :commands (lsp lsp-deferred) + :ensure t + :diminish lsp-mode :init (setq lsp-keymap-prefix "C-c l") + (add-to-list 'exec-path "/home/zongor/lib/elixir-ls") :hook - ((go-mode) . lsp) - ((rust-mode) . lsp)) + ((elixir-mode. lsp) + ;(rust-mode) . lsp) + (go-mode) . lsp)) (use-package lsp-ui :hook (lsp-mode . lsp-ui-mode) :config (setq lsp-ui-doc-enable t)) -(use-package sly - :ensure t - :config - (setq inferior-lisp-program "sbcl")) +;(use-package sly +; :ensure t +; :config +; (setq inferior-lisp-program "sbcl")) (use-package vterm :ensure t) diff --git a/.emacs.d/exwm/.exwm-config.el.~undo-tree~ b/.emacs.d/exwm/.exwm-config.el.~undo-tree~ new file mode 100644 index 0000000..d6b2f4e --- /dev/null +++ b/.emacs.d/exwm/.exwm-config.el.~undo-tree~ @@ -0,0 +1,7 @@ +(undo-tree-save-format-version . 1) +"a4a4eb86472cd1947fff9c701f0ef4473f82ae3d" +[nil nil nil nil (26455 6668 563825 959000) 0 nil] +([nil nil ((1587 . 1588) (t 26455 6404 423191 206000)) nil (26455 6668 563811 667000) 0 nil]) +([nil nil ((#(";" 0 1 (face font-lock-comment-delimiter-face fontified t)) . 889) (undo-tree-id2 . -1) (undo-tree-id3 . -1) (t 26455 6668 580000 84000)) nil (26455 7611 630474 94000) 0 nil]) +([nil current ((#(")" 0 1 (fontified t)) . 846) (undo-tree-id0 . -1) (undo-tree-id1 . -1)) nil (26455 7611 630451 343000) 0 nil]) +nil diff --git a/.emacs.d/exwm/.start-exwm.~undo-tree~ b/.emacs.d/exwm/.start-exwm.~undo-tree~ new file mode 100644 index 0000000..e66b6e2 --- /dev/null +++ b/.emacs.d/exwm/.start-exwm.~undo-tree~ @@ -0,0 +1,7 @@ +(undo-tree-save-format-version . 1) +"02ec50cb4fbea74640358f436c453e910fb20828" +[nil nil nil nil (26454 63619 549485 475000) 0 nil] +([nil nil ((120 . 128) (#("," 0 1 (fontified t)) . -120) (undo-tree-id0 . -1) (undo-tree-id1 . -1) (undo-tree-id2 . -1) (undo-tree-id3 . -1) (undo-tree-id4 . -1) (undo-tree-id5 . -1) (undo-tree-id6 . -1) (undo-tree-id7 . -1) (undo-tree-id8 . -1) 121 (114 . 121) (#("l" 0 1 (fontified t)) . -114) (undo-tree-id9 . -1) (undo-tree-id10 . -1) (undo-tree-id11 . -1) (undo-tree-id12 . -1) (undo-tree-id13 . -1) (undo-tree-id14 . -1) (undo-tree-id15 . -1) (undo-tree-id16 . -1) (undo-tree-id17 . -1) 115 (112 . 115) (#("`" 0 1 (face sh-quoted-exec fontified nil)) . -112) (undo-tree-id18 . -1) (undo-tree-id19 . -1) (undo-tree-id20 . -1) (undo-tree-id21 . -1) (undo-tree-id22 . -1) (undo-tree-id23 . -1) (undo-tree-id24 . -1) (undo-tree-id25 . -1) (undo-tree-id26 . -1) (undo-tree-id27 . -1) (#("`" 0 1 (face sh-quoted-exec fontified t)) . 113) (112 . 114) (t 26454 61080 662144 585000)) nil (26454 63619 549466 516000) 0 nil]) +([nil nil ((45 . 46) (44 . 45) (t 26454 63619 570218 940000) 11) nil (26455 4620 832607 379000) 0 nil]) +([nil current ((49 . 55) (46 . 49) (45 . 46)) nil (26455 4620 832591 629000) 0 nil]) +nil diff --git a/.emacs.d/exwm/exwm-config.el b/.emacs.d/exwm/exwm-config.el new file mode 100644 index 0000000..2f73aad --- /dev/null +++ b/.emacs.d/exwm/exwm-config.el @@ -0,0 +1,108 @@ +(defun efs/run-in-background (command) + (let ((command-parts (split-string command "[ ]+"))) + (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts))))) + +(defun efs/set-wallpaper () + (interactive) + ;; NOTE: You will need to update this to a valid background path! + (start-process-shell-command + "feh" nil "feh --bg-scale /home/zongor/Pictures/anorlondo.png")) + +(defun efs/exwm-init-hook () + ;; Make workspace 1 be the one where we land at startup + (exwm-workspace-switch-create 1) + + ;; Show battery status in the mode line + (display-battery-mode 1) + + ;; Show the time and date in modeline + (setq display-time-day-and-date t) + (display-time-mode 1) + ;; Also take a look at display-time-format and format-time-string + + ;; Launch apps that will run in the background + (efs/run-in-background "nm-applet") + ;(efs/run-in-background "pasystray") + (efs/run-in-background "blueman-applet")) + +(defun efs/exwm-update-class () + (exwm-workspace-rename-buffer exwm-class-name)) + +(use-package exwm + :config + ;; Set the default number of workspaces + (setq exwm-workspace-number 5) + + ;; When window "class" updates, use it to set the buffer name + (add-hook 'exwm-update-class-hook #'efs/exwm-update-class) + + ;; When EXWM starts up, do some extra confifuration + (add-hook 'exwm-init-hook #'efs/exwm-init-hook) + + ;; Set the screen resolution (update this to be the correct resolution for your screen!) + (require 'exwm-randr) + (exwm-randr-mode 1) + + ;(efs/set-wallpaper) + + ;; Load the system tray before exwm-init + (require 'exwm-systemtray) + ;(setq exwm-systemtray-height 32) + (exwm-systemtray-mode 1) + + ;; These keys should always pass through to Emacs + (setq exwm-input-prefix-keys + '(?\C-x + ?\C-u + ?\C-h + ?\M-x + ?\M-` + ?\M-& + ?\M-: + ?\C-\M-j ;; Buffer list + ?\C-\ )) ;; Ctrl+Space + + ;; Ctrl+Q will enable the next key to be sent directly + (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key) + + ;; Set up global key bindings. These always work, no matter the input state! + ;; Keep in mind that changing this list after EXWM initializes has no effect. + (setq exwm-input-global-keys + `( + ;; Reset to line-mode (C-c C-k switches to char-mode via exwm-input-release-keyboard) + ([?\s-r] . exwm-reset) + + ;; Move between windows + ([s-left] . windmove-left) + ([s-right] . windmove-right) + ([s-up] . windmove-up) + ([s-down] . windmove-down) + + ;; Launch applications via shell command + ([?\s-&] . (lambda (command) + (interactive (list (read-shell-command "$ "))) + (start-process-shell-command command nil command))) + + ;; Switch workspace + ([?\s-w] . exwm-workspace-switch) + ([?\s-`] . (lambda () (interactive) (exwm-workspace-switch-create 0))) + + ;; 's-N': Switch to certain workspace with Super (Win) plus a number key (0 - 9) + ,@(mapcar (lambda (i) + `(,(kbd (format "s-%d" i)) . + (lambda () + (interactive) + (exwm-workspace-switch-create ,i)))) + (number-sequence 0 9)))) + + (exwm-input-set-key (kbd "s-SPC") 'counsel-linux-app) + (exwm-enable)) + +(use-package desktop-environment + :after exwm + :config (desktop-environment-mode) + :custom + (desktop-environment-brightness-small-increment "2%+") + (desktop-environment-brightness-small-decrement "2%-") + (desktop-environment-brightness-normal-increment "5%+") + (desktop-environment-brightness-normal-decrement "5%-")) diff --git a/.emacs.d/exwm/exwm-config.el~ b/.emacs.d/exwm/exwm-config.el~ new file mode 100644 index 0000000..6f756e1 --- /dev/null +++ b/.emacs.d/exwm/exwm-config.el~ @@ -0,0 +1,108 @@ +(defun efs/run-in-background (command) + (let ((command-parts (split-string command "[ ]+"))) + (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts))))) + +(defun efs/set-wallpaper () + (interactive) + ;; NOTE: You will need to update this to a valid background path! + (start-process-shell-command + "feh" nil "feh --bg-scale /home/zongor/Pictures/anorlondo.png")) + +(defun efs/exwm-init-hook () + ;; Make workspace 1 be the one where we land at startup + (exwm-workspace-switch-create 1) + + ;; Show battery status in the mode line + (display-battery-mode 1) + + ;; Show the time and date in modeline + (setq display-time-day-and-date t) + (display-time-mode 1) + ;; Also take a look at display-time-format and format-time-string + + ;; Launch apps that will run in the background + (efs/run-in-background "nm-applet")) + ;(efs/run-in-background "pasystray") + ;(efs/run-in-background "blueman-applet")) + +(defun efs/exwm-update-class () + (exwm-workspace-rename-buffer exwm-class-name)) + +(use-package exwm + :config + ;; Set the default number of workspaces + (setq exwm-workspace-number 5) + + ;; When window "class" updates, use it to set the buffer name + (add-hook 'exwm-update-class-hook #'efs/exwm-update-class) + + ;; When EXWM starts up, do some extra confifuration + (add-hook 'exwm-init-hook #'efs/exwm-init-hook) + + ;; Set the screen resolution (update this to be the correct resolution for your screen!) + (require 'exwm-randr) + (exwm-randr-mode 1) + + ;(efs/set-wallpaper) + + ;; Load the system tray before exwm-init + (require 'exwm-systemtray) + ;(setq exwm-systemtray-height 32) + (exwm-systemtray-mode 1) + + ;; These keys should always pass through to Emacs + (setq exwm-input-prefix-keys + '(?\C-x + ?\C-u + ?\C-h + ?\M-x + ?\M-` + ?\M-& + ?\M-: + ?\C-\M-j ;; Buffer list + ?\C-\ )) ;; Ctrl+Space + + ;; Ctrl+Q will enable the next key to be sent directly + (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key) + + ;; Set up global key bindings. These always work, no matter the input state! + ;; Keep in mind that changing this list after EXWM initializes has no effect. + (setq exwm-input-global-keys + `( + ;; Reset to line-mode (C-c C-k switches to char-mode via exwm-input-release-keyboard) + ([?\s-r] . exwm-reset) + + ;; Move between windows + ([s-left] . windmove-left) + ([s-right] . windmove-right) + ([s-up] . windmove-up) + ([s-down] . windmove-down) + + ;; Launch applications via shell command + ([?\s-&] . (lambda (command) + (interactive (list (read-shell-command "$ "))) + (start-process-shell-command command nil command))) + + ;; Switch workspace + ([?\s-w] . exwm-workspace-switch) + ([?\s-`] . (lambda () (interactive) (exwm-workspace-switch-create 0))) + + ;; 's-N': Switch to certain workspace with Super (Win) plus a number key (0 - 9) + ,@(mapcar (lambda (i) + `(,(kbd (format "s-%d" i)) . + (lambda () + (interactive) + (exwm-workspace-switch-create ,i)))) + (number-sequence 0 9)))) + + (exwm-input-set-key (kbd "s-SPC") 'counsel-linux-app) + (exwm-enable)) + +(use-package desktop-environment + :after exwm + :config (desktop-environment-mode) + :custom + (desktop-environment-brightness-small-increment "2%+") + (desktop-environment-brightness-small-decrement "2%-") + (desktop-environment-brightness-normal-increment "5%+") + (desktop-environment-brightness-normal-decrement "5%-")) diff --git a/.emacs.d/exwm/exwm.desktop b/.emacs.d/exwm/exwm.desktop new file mode 100644 index 0000000..45722d6 --- /dev/null +++ b/.emacs.d/exwm/exwm.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Name=EXWM +Comment=Emacs Window Manager +Exec=sh /home/zongor/.emacs.d/exwm/start-exwm +TryExec=sh +Type=Application +DesktopNames=exwm diff --git a/.emacs.d/exwm/start-exwm b/.emacs.d/exwm/start-exwm new file mode 100644 index 0000000..a6ec401 --- /dev/null +++ b/.emacs.d/exwm/start-exwm @@ -0,0 +1,6 @@ +#!/bin/sh +# xrdb ~/.emacs.d/exwm/Xresources + +#compton & + +exec dbus-launch --exit-with-session emacs -mm --debug-init --load ~/.emacs.d/exwm/exwm-config.el diff --git a/.emacs.d/exwm/start-exwm~ b/.emacs.d/exwm/start-exwm~ new file mode 100644 index 0000000..d0037af --- /dev/null +++ b/.emacs.d/exwm/start-exwm~ @@ -0,0 +1,3 @@ +#!/bin/sh +# xrdb ~/.emacs.d/exwm/Xresources +exec dbus-launch --exit-with-session emacs -mm --debug-init --load ~/.emacs.d/exwm/exwm-config.el