From 5a0b48a17f12c5f2537119529c826132a7ce4cc5 Mon Sep 17 00:00:00 2001 From: SqrtMinusOne Date: Sun, 28 Jan 2024 01:58:07 +0300 Subject: [PATCH] emacs: minor changes to index & input methods --- .config/guix/manifests/dev.scm | 2 + .config/guix/manifests/emacs.scm | 3 +- .emacs.d/desktop.el | 4 -- .emacs.d/init.el | 83 +++++++++++++++------------ Desktop.org | 7 +-- Emacs.org | 96 ++++++++++++++++++++------------ 6 files changed, 116 insertions(+), 79 deletions(-) diff --git a/.config/guix/manifests/dev.scm b/.config/guix/manifests/dev.scm index 676dc8b..322f823 100644 --- a/.config/guix/manifests/dev.scm +++ b/.config/guix/manifests/dev.scm @@ -1,5 +1,6 @@ (specifications->manifest '( + "python-cairosvg" "python-chess" "wireshark" "socat" @@ -20,6 +21,7 @@ "openjdk:jdk" "node" "git-filter-repo" + "dnsmasq" "virt-manager" "postgresql" "docker-compose" diff --git a/.config/guix/manifests/emacs.scm b/.config/guix/manifests/emacs.scm index ab67a03..6f277b6 100644 --- a/.config/guix/manifests/emacs.scm +++ b/.config/guix/manifests/emacs.scm @@ -17,4 +17,5 @@ "python-isort" "python-black" "python-yapf" - "plantuml")) + "plantuml" + "xkb-switch")) diff --git a/.emacs.d/desktop.el b/.emacs.d/desktop.el index 0f28374..d31bdeb 100644 --- a/.emacs.d/desktop.el +++ b/.emacs.d/desktop.el @@ -362,10 +362,6 @@ DIR is either 'left or 'right." (when exwm--connection (exwm-input--update-global-prefix-keys))) -(defun my/run-in-background (command) - (let ((command-parts (split-string command "[ ]+"))) - (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts))))) - (defhydra my/exwm-apps-hydra (:color blue :hint nil) " ^Apps^ diff --git a/.emacs.d/init.el b/.emacs.d/init.el index d350570..5a16b9c 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -100,6 +100,10 @@ (use-package no-littering :straight t) +(defun my/run-in-background (command) + (let ((command-parts (split-string command "[ ]+"))) + (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts))))) + (setq confirm-kill-emacs 'y-or-n-p) (use-package general @@ -537,9 +541,19 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." (setq default-input-method "russian-computer") +(defun my/toggle-input-method () + (interactive) + (if (derived-mode-p 'exwm-mode) + (my/run-in-background "xkb-switch -n") + (if (equal (string-trim + (shell-command-to-string "xkb-switch -p")) + "us") + (toggle-input-method) + (my/run-in-background "xkb-switch -s us")))) + (general-define-key :keymaps 'global - "M-\\" #'toggle-input-method) + "M-\\" #'my/toggle-input-method) (use-package smartparens :straight t) @@ -554,14 +568,14 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." ) (use-package accent - :straight t + :straight (:host github :repo "SqrtMinusOne/accent") :init (general-define-key :states '(normal) - "gs" #'accent-menu) + "gs" #'accent-company) (general-define-key :states '(normal insert) - "M-n" #'accent-menu) + "M-n" #'accent-company) :commands (accent-menu) :config (general-define-key @@ -5419,8 +5433,9 @@ KEYS is a list of cons cells like (