emacs: add ddgr integration

This commit is contained in:
Hoang Nguyen 2021-02-19 02:42:26 +03:00
parent fd3511d513
commit 67296cf1f1
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
1 changed files with 35 additions and 4 deletions

View File

@ -62,7 +62,7 @@
(add-hook 'exwm-update-title-hook #'follie/exwm-rename-buffer)
;; Force tiling by default
(setq exwm-manage-force-tiling nil)
;;(setq exwm-manage-force-tiling t)
;; Window rules
(add-hook 'exwm-manage-finish-hook #'follie/configure-window-by-class)
@ -112,11 +112,16 @@
;; Reset to line-mode (C-c C-k switches to char-mode via exwm-input-release-keyboard)
([?\s-r] . exwm-reset)
;; Move between windows
;; Move between windows with arrow keys
([s-left] . windmove-left)
([s-right] . windmove-right)
([s-up] . windmove-up)
([s-down] . windmove-down)
;; or with vim keys
([?\s-h] . windmove-left)
([?\s-l] . windmove-right)
([?\s-k] . windmove-up)
([?\s-j] . windmove-down)
;; Launch applications via shell command
([?\s-&] . (lambda (command)
@ -135,6 +140,8 @@
(exwm-workspace-switch-create ,i))))
(number-sequence 0 9))))
(exwm-input-set-key (kbd "s-SPC") 'counsel-linux-app)
(exwm-input-set-key (kbd "s-t") 'exwm-floating-toggle-floating)
(exwm-input-set-key (kbd "s-f") 'exwm-layout-toggle-fullscreen)
;; Enable EXWM
(exwm-enable)
@ -143,7 +150,7 @@
(exwm-config-ido)
(ido-mode nil))
;; Edit everthing in X windows with Emacs
;; Edit everything in X windows with Emacs
(use-package! exwm-edit
:after exwm
:config
@ -207,7 +214,15 @@
;; Function keys
(use-package! desktop-environment
:after exwm
:config (desktop-environment-mode)
:diminish desktop-environment-mode
:config
;; Give me back Super+l
(progn
(setf
(alist-get (elt (kbd "s-l") 0) desktop-environment-mode-map nil t)
nil)
(desktop-environment-mode))
(exwm-input-set-key (kbd "s-x") #'desktop-environment-lock-screen)
:custom
;; Brightness
(desktop-environment-brightness-get-command "brightnessctl")
@ -245,3 +260,19 @@
(defun follie/toggle-desktop-notifications ()
(interactive)
(start-process-shell-command "notify-send" nil "notify-send \"DUNST_COMMAND_TOGGLE\""))
;; DuckDuckGo
(defun ddgr ()
"Duck the web inside Emacs with ddgr"
(interactive)
(let* ((query (read-from-minibuffer "Search query: "))
(results (shell-command-to-string (concat "ddgr -x --np --noua -C " query)))
(buffer "*DuckDuckGo*"))
(when (get-buffer buffer)
(kill-buffer buffer))
(with-current-buffer (generate-new-buffer buffer)
(insert "** Search results:\n\n")
(insert results))
(switch-to-buffer buffer)
(org-mode)
(evil-goto-first-line)))