diff options
Diffstat (limited to '.emacs.d')
-rw-r--r-- | .emacs.d/exwm/EXWM.desktop | 8 | ||||
-rwxr-xr-x | .emacs.d/exwm/start-exwm.sh | 3 | ||||
-rw-r--r-- | .emacs.d/lisp/init-exwm.el | 81 | ||||
-rw-r--r-- | .emacs.d/lisp/workspaces.el | 42 |
4 files changed, 134 insertions, 0 deletions
diff --git a/.emacs.d/exwm/EXWM.desktop b/.emacs.d/exwm/EXWM.desktop new file mode 100644 index 0000000..656e385 --- /dev/null +++ b/.emacs.d/exwm/EXWM.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=EXWM +Comment=Emacs Window Manager +Exec=sh /home/apollo/.emacs.d/exwm/start-exwm.sh +TryExec=sh +Type=Application +X-LightDM-DesktopName=exwm +DesktopNames=exwm
\ No newline at end of file diff --git a/.emacs.d/exwm/start-exwm.sh b/.emacs.d/exwm/start-exwm.sh new file mode 100755 index 0000000..5b7e315 --- /dev/null +++ b/.emacs.d/exwm/start-exwm.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +exec dbus-launch --exit-with-session emacs --m --debug-init diff --git a/.emacs.d/lisp/init-exwm.el b/.emacs.d/lisp/init-exwm.el new file mode 100644 index 0000000..d1dc888 --- /dev/null +++ b/.emacs.d/lisp/init-exwm.el @@ -0,0 +1,81 @@ +;;; package : EXWM configuration --- +;;; .* --- .* + +;;; Code: + + + +(defun apollo/exwm-update-class () + (exwm-workspace-rename-buffer exwm-class-name)) + +(use-package exwm + :config + (setq exwm-workspace-number 5) + ;; When window "class" updates, use it to set the buffer name + (add-hook 'exwm-update-class-hook #'apollo/exwm-update-class) + + + (start-process-shell-command + "xrandr" nil "xrandr --output DisplayPort-0 --off --output DisplayPort-1 --off --output DisplayPort-2 --primary --mode 2560x1440 --pos 1920x0 --rotate normal --output HDMI-A-0 --mode 1920x1080 --pos 0x0 --rotate normal") + + ;; Rebind CapsLock to Ctrl + + + ;; Set the screen resolution (update this to be the correct resolution for your screen!) + (require 'exwm-randr) + (exwm-randr-enable) + ;; (start-process-shell-command "xrandr" nil "xrandr --output Virtual-1 --primary --mode 2048x1152 --pos 0x0 --rotate normal") + + ;; Load the system tray before exwm-init + (require 'exwm-systemtray) + (exwm-systemtray-enable) + + ;; 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-enable)) + +(provide 'init-exwm) + +;;; init-exwm.el ends here diff --git a/.emacs.d/lisp/workspaces.el b/.emacs.d/lisp/workspaces.el new file mode 100644 index 0000000..ffdf993 --- /dev/null +++ b/.emacs.d/lisp/workspaces.el @@ -0,0 +1,42 @@ +;;; workspaces.el -- implemented using registers + +(defun workspace-create-new (deskid) + "Create a blank workspace at id deskid, between 1 and 9" + (interactive "cWhat ID do you want to give to blank workspace ?") + (workspace-goto ?0) + (window-configuration-to-register deskid) + (add-to-list 'workspaces-list deskid) + (workspace-goto deskid)) + + +(defun workspace-goto (deskid) + "Go to another workspace, deskid is workspace number between 1 and 9; +Workspace 0 is a template workspace, do not use it unless you know what you do; +You can kill a workspace with 'k' and fallback on 1." + (interactive "cTo which workspace do you want to go ? ") + (let (add) + (setq add (if (eq deskid ?0) "\n!-!-! This is template workspace. New workspaces are based on it. " nil)) + (cond + ((and (>= deskid ?0) (<= deskid ?9)) + (if (or (position deskid workspaces-list) (eq deskid ?0)) + (progn + (window-configuration-to-register current-workspace) + (setq current-workspace deskid) + (jump-to-register deskid)) + (if (y-or-n-p "This workspace does not exist, should it be created ? ") + (progn + (window-configuration-to-register current-workspace) + (workspace-create-new deskid)) + nil))) + ((and (eq deskid ?k) (not (or (eq current-workspace ?0) (eq current-workspace ?1)))) + (let ((deskid-to-del current-workspace)) + (workspace-goto ?1) + (setq workspaces-list (remove deskid-to-del workspaces-list)))) + (t (setq add "\n!-!-! Please specify a valid workspace number in (1-9), 0 do edit template, 'k' to kill current workspace in (2-9)"))) + (message (concat "Now on workspace " (char-to-string current-workspace) "\nWorkspaces list is : " (mapconcat 'char-to-string (sort (copy-sequence workspaces-list) '<) ", ") add)))) + +;; workspaces init +(window-configuration-to-register ?0) +(defvar workspaces-list nil) +(setq current-workspace ?0) +(workspace-create-new ?1) |