Browse Source

Init desktop module

main
parent
commit
ca7d3bb64c
  1. 73
      README.org
  2. 58
      init.el

73
README.org

@ -185,6 +185,7 @@ Avoid the infamous *Emacs pinky* by binding =SPC= as a leader key, utilizing the
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defvar dotfiles/leader-key "SPC") (defvar dotfiles/leader-key "SPC")
(defvar dotfiles/leader-key-global "C-SPC")
#+end_src #+end_src
Implement the *leader* key mentioned above using [[https://github.com/noctuid/general.el][general.el]], letting us easily configure prefixed keybindings in a much cleaner manner than the default methods. Implement the *leader* key mentioned above using [[https://github.com/noctuid/general.el][general.el]], letting us easily configure prefixed keybindings in a much cleaner manner than the default methods.
@ -195,7 +196,8 @@ Implement the *leader* key mentioned above using [[https://github.com/noctuid/ge
(general-create-definer dotfiles/leader (general-create-definer dotfiles/leader
:states '(normal motion) :states '(normal motion)
:keymaps 'override :keymaps 'override
:prefix dotfiles/leader-key))
:prefix dotfiles/leader-key
:global-prefix dotfiles/leader-key-global))
#+end_src #+end_src
Use [[https://github.com/abo-abo/hydra][hydra]] for transient keybindings sharing a common prefix. Use [[https://github.com/abo-abo/hydra][hydra]] for transient keybindings sharing a common prefix.
@ -485,6 +487,75 @@ https://github.com/seagle0128/doom-modeline
:custom ((doom-modeline-height 16))) :custom ((doom-modeline-height 16)))
#+end_src #+end_src
* Desktop
:PROPERTIES:
:header-args: :tangle ~/.local/source/dotfiles/init.el :results silent
:END:
#+begin_src emacs-lisp
(defun desktop/run (command)
(let ((command-parts (split-string command "[ ]+")))
(apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))
#+end_src
#+begin_src emacs-lisp
(defun desktop/set-wallpaper (path)
(interactive)
(when (file-exists-p path)
(let ((command (concat "feh --bg-scale " path)))
(start-process-shell-command "feh" nil command))))
#+end_src
#+begin_src emacs-lisp
(defun desktop/init-hook ()
(exwm-workspace-switch-create 1)
(setq display-time-and-date t)
(display-battery-mode 1)
(display-time-mode 1))
#+end_src
#+begin_src emacs-lisp
(defun desktop/update-display ()
(desktop/run "autorandr --change --force")
;; (desktop/set-wallpaper "TODO")
(message "Display: %s"
(string-trim
(shell-command-to-string "autorandr --current"))))
#+end_src
#+begin_src emacs-lisp
(use-package exwm
:config
(require 'exwm-randr)
(exwm-randr-enable)
(start-process-shell-command "xrandr" nil "xrandr --output Virtual-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal")
(add-hook 'exwm-init-hook #'desktop/init-hook)
(add-hook 'exwm-randr-screen-change-hook #'desktop/update-display)
(desktop/update-display)
(setq exwm-input-prefix-keys
'(?\M-x
?\C-\ ) ;; C-SPC
exwm-input-global-keys
`(([?\s-r] . exwm-reset)
([?\s-&] . (lambda (command)
(interactive (list (read-shell-command "λ ")))
(start-process-shell-command command nil command)))
,@(mapcar (lambda (i)
`(,(kbd (format "s-%d" i)) .
(lambda ()
(interactive)
(exwm-workspace-switch-create ,i))))
(number-sequence 1 9))))
(exwm-enable))
#+end_src
* Writing * Writing
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/.local/source/dotfiles/init.el :results silent :header-args: :tangle ~/.local/source/dotfiles/init.el :results silent

58
init.el

@ -77,13 +77,15 @@
:config (setq which-key-idle-delay dotfiles/idle)) :config (setq which-key-idle-delay dotfiles/idle))
(defvar dotfiles/leader-key "SPC") (defvar dotfiles/leader-key "SPC")
(defvar dotfiles/leader-key-global "C-SPC")
(use-package general (use-package general
:config :config
(general-create-definer dotfiles/leader (general-create-definer dotfiles/leader
:states '(normal motion) :states '(normal motion)
:keymaps 'override :keymaps 'override
:prefix dotfiles/leader-key))
:prefix dotfiles/leader-key
:global-prefix dotfiles/leader-key-global))
(use-package hydra) (use-package hydra)
@ -188,6 +190,60 @@
:init (doom-modeline-mode 1) :init (doom-modeline-mode 1)
:custom ((doom-modeline-height 16))) :custom ((doom-modeline-height 16)))
(defun desktop/run (command)
(let ((command-parts (split-string command "[ ]+")))
(apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))
(defun desktop/set-wallpaper (path)
(interactive)
(when (file-exists-p path)
(let ((command (concat "feh --bg-scale " path)))
(start-process-shell-command "feh" nil command))))
(defun desktop/init-hook ()
(exwm-workspace-switch-create 1)
(setq display-time-and-date t)
(display-battery-mode 1)
(display-time-mode 1))
(defun desktop/update-display ()
(desktop/run "autorandr --change --force")
;; (desktop/set-wallpaper "TODO")
(message "Display: %s"
(string-trim
(shell-command-to-string "autorandr --current"))))
(use-package exwm
:config
(require 'exwm-randr)
(exwm-randr-enable)
(start-process-shell-command "xrandr" nil "xrandr --output Virtual-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal")
(add-hook 'exwm-init-hook #'desktop/init-hook)
(add-hook 'exwm-randr-screen-change-hook #'desktop/update-display)
(desktop/update-display)
(setq exwm-input-prefix-keys
'(?\M-x
?\C-\ ) ;; C-SPC
exwm-input-global-keys
`(([?\s-r] . exwm-reset)
([?\s-&] . (lambda (command)
(interactive (list (read-shell-command "λ ")))
(start-process-shell-command command nil command)))
,@(mapcar (lambda (i)
`(,(kbd (format "s-%d" i)) .
(lambda ()
(interactive)
(exwm-workspace-switch-create ,i))))
(number-sequence 1 9))))
(exwm-enable))
(use-package org-superstar (use-package org-superstar
:hook (org-mode . org-superstar-mode)) :hook (org-mode . org-superstar-mode))

Loading…
Cancel
Save