Config: add exwm support, install consult-notes, fix some keybinding.

This commit is contained in:
2026-04-19 10:59:01 +08:00
parent fffd35f8ed
commit 8576ac275a
11 changed files with 110 additions and 24 deletions

View File

@@ -49,7 +49,7 @@
'(("h" "~/" "Home")
("e" "~/.emacs.d/" "Emacs config")
("s" "~/.config/guix/" "System config")
("p" "~/图片/" "Pictures")
("p" "~/Pictures/" "Pictures")
("d" "~/downloads/" "Downloads")
("v" "~/视频/" "Videos")
("n" "~/org/my-org-note/" "Notes")

View File

@@ -5,15 +5,15 @@
;;; Code:
;; Clash 代理配置
(if *is-linux*
(progn
(setq url-proxy-services
'(("http" . "192.168.31.121:7890")
("https" . "192.168.31.121:7890")
("no_proxy" . "\\(localhost\\|127\\.0\\.0\\.1\\|192\\.168\\.*\\)")))
;; (if *is-linux*
;; (progn
;; (setq url-proxy-services
;; '(("http" . "192.168.31.121:7890")
;; ("https" . "192.168.31.121:7890")
;; ("no_proxy" . "\\(localhost\\|127\\.0\\.0\\.1\\|192\\.168\\.*\\)")))
(setenv "http_proxy" "192.168.31.121:7890")
(setenv "https_proxy" "192.168.31.121:7890"))
;; (setenv "http_proxy" "192.168.31.121:7890")
;; (setenv "https_proxy" "192.168.31.121:7890"))
(progn
(setq url-proxy-services
@@ -23,7 +23,7 @@
(setenv "http_proxy" "127.0.0.1:7890")
(setenv "https_proxy" "127.0.0.1:7890"))
)
;; )
;; straight.el
(defvar bootstrap-version)

View File

@@ -1,10 +1,84 @@
;;; init-exwm.el --- exwm config -*- lexical-binding: t -*-
;;; init-exwm.el --- exwm config -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:
(use-package exwm)
(when *is-linux*
(use-package exwm
:config
(setq exwm-workspace-number 5)
(exwm-input-set-key (kbd "s-&")
(lambda (command)
(interactive (list (read-shell-command "$ ")))
(let ((display-buffer-alist
'((".*" . (display-buffer-no-window . nil)))))
(async-shell-command command))))
(setq exwm-input-prefix-keys
'(?\C-x
?\C-u
?\C-c
?\C-h
?\M-x
?\M-o
?\M-]
?\M-[
XF86AudioLowerVolume
XF86AudioRaiseVolume
XF86AudioMute
))
(define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)
(setq exwm-input-global-keys
`(([?\s-r] . exwm-reset)
([?\s-b] . windmove-left)
([?\s-f] . windmove-right)
([?\s-p] . windmove-up)
([?\s-n] . windmove-down)
([?\s-S] . desktop-environment-screenshot)
([?\s-s] . desktop-environment-screenshot-part)
([?\s-w] . exwm-workspace-switch)
([?\s-`] . (lambda () (interactive) (exwm-workspace-switch-create 0)))
,@(mapcar (lambda (i)
`(,(kbd(format "s-%d" i)) .
(lambda ()
(interactive)
(exwm-workspace-switch-create ,i))))
(number-sequence 0 9))))
(defun my/exwm-update-class ()
(exwm-workspace-rename-buffer exwm-class-name))
(add-hook 'exwm-update-class-hook #'my/exwm-update-class)
(require 'exwm-xim)
(exwm-xim-mode)
(exwm-wm-mode))
(use-package desktop-environment
:config
(desktop-environment-mode)
(advice-add 'desktop-environment-screenshot :after
(lambda (&rest _) (message "Saved fullscreen screenshot.")))
(advice-add 'desktop-environment-screenshot-part :after
(lambda (&rest _) (message "Saved partial screenshot.")))
:custom
(desktop-environment-screenshot-command
"import -window root ~/Pictures/screenshot-$(date +%Y%m%d-%H%M%S).png")
(desktop-environment-screenshot-partial-command
"import ~/Pictures/screenshot-$(date +%Y%m%d-%H%M%S).png"))
(add-hook 'exwm-init-hook
(lambda ()
(unless (zerop (shell-command "pgrep -x fcitx5"))
(start-process-shell-command "fcitx5" nil "fcitx5 -d"))
(unless (zerop (shell-command "pgrep -x mihomo"))
(start-process-shell-command "mihomo" nil "mihomo -d ~/.config/mihomo/"))
(message "fcitx5 enable.")))
)
(provide 'init-exwm)

View File

@@ -7,6 +7,7 @@
(use-package gptel
:hook (gptel-mode-hook . visual-line-mode)
:config
(setq gptel-log-level t)
(setq gptel-default-mode 'org-mode)
(defun my/org-auto-gptel ()

View File

@@ -4,8 +4,6 @@
;;; Code:
(use-package general)
;; 修改mac键位
(when *is-mac*
(setq mac-command-modifier 'meta)
@@ -28,10 +26,11 @@
:prefix "C-c u"
"l" 'global-tab-line-mode
"d" 'disable-theme
"f" 'rainbow-mode
"r" 'rainbow-mode
"b" 'indent-bars-mode
"t" 'consult-theme
"c" 'my-color-picker)
"c" 'my-color-picker
"f" 'describe-face)
;; f for find and consult command
(general-def
@@ -55,7 +54,7 @@
;; o for org-mode
(general-def
:prefix "C-c o"
"s" 'consult-org-agenda
"s" 'consult-notes
"g" 'consult-org-ripgrep
"C" 'calendar
"c" 'org-capture
@@ -180,7 +179,7 @@
"C-x C-b" 'ibuffer-other-window
"C-x K" 'crux-kill-other-buffers
"C-x b" 'consult-buffer
"M-o" 'ace-window
"M-o" 'other-window
;; edit
"M-c" 'capitalize-dwim

View File

@@ -114,6 +114,11 @@
("C-x C-d" . consult-dir)
("C-x C-j" . consult-dir-jump-file)))
(use-package consult-notes
:config
(setq consult-notes-file-dir-sources '(("org notes" ?n "~/org/my-org-note/")
("org journal" ?j "~/org/my-org-daily/" :hidden t))))
;; embark
(use-package embark
:config (setq prefix-help-command 'embark-prefix-help-command)
@@ -239,7 +244,7 @@ targets."
("M-Z" . avy-zap-up-to-char-dwim)))
;; jinx拼写检查
(if *is-mac*
(unless *is-windows*
(use-package jinx
:hook (org-mode-hook . jinx-mode)
:bind ([remap ispell-word] . jinx-correct)
@@ -280,6 +285,12 @@ targets."
(unless *is-windows*
(use-package vterm))
;; general
(use-package general)
;; popup
(use-package popup)
(provide 'init-package)
;;; init-package.el ends here

View File

@@ -78,6 +78,8 @@
;; ibuffer
(setq ibuffer-default-sorting-mode 'filename)
(setq native-comp-async-warnings-errors-kind 'silent)
;; short anwser
(if (boundp 'use-short-answers)
(setq use-short-answers t)

View File

@@ -143,7 +143,7 @@
(when *is-linux*
(defvar tenon-font-size 125
"默认字体大小")
(defvar tenon-font-weight 'light
(defvar tenon-font-weight 'normal
"默认字重选项有ultra-lightlightnormalmediumsemiboldbold"))
;; 定义函数

View File

@@ -102,9 +102,6 @@
(delete-window window)))))
(advice-add #'keyboard-quit :before #'popper-close-window-hack)))
;; 安装ace-windows快速切换窗口
(use-package ace-window)
;; es-windos快速管理窗口
(use-package es-windows)

View File

@@ -18,7 +18,8 @@
(add-to-list 'consult-buffer-sources persp-consult-source))
(setq switch-to-prev-buffer-skip
(lambda (win buff bury-or-kill)
(not (persp-is-current-buffer buff)))))
(not (persp-is-current-buffer buff))))
(setq persp-initial-frame-name "desktop"))
(provide 'init-workspace)

View File

@@ -35,6 +35,7 @@
`(dired-header ((,class (:foreground ,green))))
`(mode-line ((,class (:foreground ,base0 :background ,base02))))
`(mode-line-inactive ((,class (:foreground ,base01 :background ,base03))))
`(jinx-misspelled ((,class (:underline (:style dashes :color ,yellow)))))
`(vertico-current ((,class (:background ,base02 :extend t :underline nil)))))))
(provide-theme 'my-base16-dark)