Browse Source

Moved exwm to literate config and addeding quit binding in help-mode

master
Josh Wolfe 2 years ago
parent
commit
4c7415695b
3 changed files with 119 additions and 48 deletions
  1. 12
    4
      emacs/.emacs.d/README.org
  2. 0
    44
      exwm/.exwm.el
  3. 107
    0
      exwm/.exwm.org

+ 12
- 4
emacs/.emacs.d/README.org View File

@@ -134,10 +134,10 @@ and if a command line flag (=-light=) was specified.

Start load emacs window manager config if it exists.

#+BEGIN_SRC emacs-lisp :tangle yes
(when (file-exists-p "~/.exwm.el")
(load-file "~/.exwm.el"))
#+END_SRC
#+BEGIN_SRC emacs-lisp :tangle yes
(when (file-exists-p "~/.exwm.org")
(org-babel-load-file "~/.exwm.org"))
#+END_SRC

** Theme Setup

@@ -487,6 +487,14 @@ This behaviour in general emulates the =scrolloff= option in vim.
(setq ispell-program-name "c:/emacs/hunspell/bin/hunspell.exe"))
#+END_SRC

*** Help Mode

#+BEGIN_SRC emacs-lisp :tangle yes
(bind-key (kbd "q") (lambda () (interactive)
(quit-window t))
help-mode-map)
#+END_SRC

** Mode Line

If we're in GUI emacs we make sure to use =powerline= otherwise we use

+ 0
- 44
exwm/.exwm.el View File

@@ -1,44 +0,0 @@
(use-package exwm
:config
(require 'exwm-config))

;; Set the initial workspace number.
(setq exwm-workspace-number 4)
;; Make class name the buffer name
(add-hook 'exwm-update-class-hook
(lambda ()
(exwm-workspace-rename-buffer exwm-class-name)))
;; 's-r': Reset
(exwm-input-set-key (kbd "s-r") #'exwm-reset)
;; 's-w': Switch workspace
(exwm-input-set-key (kbd "s-w") #'exwm-workspace-switch)
;; 's-N': Switch to certain workspace
(let ((workspace-list '("&" "[" "{" "}" "(" "=" "*" ")" "+" "]")))
(dotimes (i 10)
(exwm-input-set-key (kbd (format "s-%s" (nth i workspace-list)))
`(lambda ()
(interactive)
(exwm-workspace-switch-create ,i)))))

;; 's-&': Launch application
(exwm-input-set-key (kbd "s-SPC")
(lambda (command)
(interactive (list (read-shell-command "$ ")))
(start-process-shell-command command nil command)))
;; Line-editing shortcuts
(setq exwm-input-simulation-keys
'(([?\C-b] . [left])
([?\C-f] . [right])
([?\C-p] . [up])
([?\C-n] . [down])
([?\C-a] . [home])
([?\C-e] . [end])
([?\M-v] . [prior])
([?\C-v] . [next])
([?\C-d] . [delete])
([?\C-k] . [S-end delete])))

;; Enable EXWM
(exwm-enable)
;; Other configurations
(fringe-mode 1)

+ 107
- 0
exwm/.exwm.org View File

@@ -0,0 +1,107 @@
* Require

#+BEGIN_SRC emacs-lisp :tangle yes
(use-package exwm)
(require 'exwm-config)
(require 'exwm-systemtray)
(exwm-systemtray-enable)
#+END_SRC

* Functions

#+BEGIN_SRC emacs-lisp :tangle yes
(defmacro wolfe/exwm-bind (key command)
`(exwm-input-set-key ,(kbd key) ,command))
#+END_SRC

#+BEGIN_SRC emacs-lisp :tangle yes
(defmacro wolfe/exwm-bind-lambda (key command)
`(exwm-input-set-key ,(kbd key) (lambda () (interactive) ,command)))
#+END_SRC

#+BEGIN_SRC emacs-lisp :tangle yes
(defmacro wolfe/exwm-bind-exec (key cmd)
`(wolfe/exwm-bind-lambda ,key (start-process-shell-command ,cmd nil ,cmd)))
#+END_SRC

* Config
** Visual

#+BEGIN_SRC emacs-lisp :tangle yes
(fringe-mode 1)
(display-time-mode t) ;Show the time
(setq battery-mode-line-format "[%p]")
(display-battery-mode t)
#+END_SRC

** Workspace & Window

#+BEGIN_SRC emacs-lisp :tangle yes
;; Set the initial workspace number.
(setq exwm-workspace-number 4)
;; Make class name the buffer name
(add-hook 'exwm-update-class-hook
(lambda () (exwm-workspace-rename-buffer exwm-class-name)))
#+END_SRC

* Bindings

#+BEGIN_SRC emacs-lisp :tangle yes
;; 's-r': Reset
(wolfe/exwm-bind "s-r" #'exwm-reset)
;; 's-w': Switch workspace
(wolfe/exwm-bind "s-w" #'exwm-workspace-switch)
;; 's-c': Browser
(wolfe/exwm-bind-exec "s-c" "firefox-developer-edition")
;; 's-RET': Open terminal
(wolfe/exwm-bind-exec "s-<return>" "urxvt")

;; 's-N': Switch to certain workspace
(let ((workspace-list '("&" "[" "{" "}" "(" "=" "*" ")" "+" "]")))
(dotimes (i 10)
(exwm-input-set-key (kbd (format "s-%s" (nth i workspace-list)))
`(lambda ()
(interactive)
(exwm-workspace-switch-create ,i)))))

;; 's-&': Launch application
(exwm-input-set-key (kbd "s-SPC")
(lambda (command)
(interactive (list (read-shell-command "$ ")))
(start-process-shell-command command nil command)))

(exwm-input-set-simulation-keys '(([?\C-c ?\C-c] . ?\C-c)
([?\C-x ?\C-x] . ?\C-x)))
#+END_SRC

** Brightness & Volume

#+BEGIN_SRC emacs-lisp :tangle yes
(wolfe/exwm-bind-exec "<XF86MonBrightnessUp>" "xbacklight -inc 2")
(wolfe/exwm-bind-exec "<XF86MonBrightnessDown>" "xbacklight -dec 2")
(wolfe/exwm-bind-exec "<XF86KbdBrightnessUp>" "asus-kbd-backlight up")
(wolfe/exwm-bind-exec "<XF86KbdBrightnessDown>" "asus-kbd-backlight down")
(wolfe/exwm-bind-exec "<XF86AudioRaiseVolume>" "amixer -D pulse sset Master 2%+")
(wolfe/exwm-bind-exec "<XF86AudioLowerVolume>" "amixer -D pulse sset Master 2%-")
(wolfe/exwm-bind-exec "<XF86AudioMute>" "amixer set Master toggle")

;; Line-editing shortcuts
;;(setq exwm-input-simulation-keys
;; '(([?\C-b] . [left])
;; ([?\C-f] . [right])
;; ([?\C-p] . [up])
;; ([?\C-n] . [down])
;; ([?\C-a] . [home])
;; ([?\C-e] . [end])
;; ([?\M-v] . [prior])
;; ([?\C-v] . [next])
;; ([?\C-d] . [delete])
;; ([?\C-k] . [S-end delete]))
#+END_SRC

* Enable

#+BEGIN_SRC emacs-lisp :tangle yes
;; Enable EXWM
(exwm-enable)
#+END_SRC

Loading…
Cancel
Save