summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-10-26 07:11:58 +0100
committerjao <jao@gnu.org>2021-10-26 21:56:37 +0100
commit34288685116e90826aaa5639bafc4b5ef58b2575 (patch)
tree2caa66c91d1a2d840ae642b500921e9c57815ae9
parenta5d897e9a31a62555ac96a571818edc201123a97 (diff)
downloadelibs-34288685116e90826aaa5639bafc4b5ef58b2575.tar.gz
elibs-34288685116e90826aaa5639bafc4b5ef58b2575.tar.bz2
dehydration: transient is all we need
-rw-r--r--blog.org45
-rw-r--r--exwm.org190
-rw-r--r--gnus.org25
-rw-r--r--init.org351
-rw-r--r--notmuch.org34
-rw-r--r--org.org17
6 files changed, 320 insertions, 342 deletions
diff --git a/blog.org b/blog.org
index faea694..e259828 100644
--- a/blog.org
+++ b/blog.org
@@ -138,8 +138,8 @@
(advice-add 'org-static-blog-generate-post-path :override
#'jao-org-static-post-path)
- :bind (("H-s-b" . jao-hydra-org-blog/body)
- :map org-mode-map (("C-c B" . jao-hydra-org-blog/body))))
+ :bind (("H-s-b" . jao-transient-org-blog)
+ :map org-mode-map (("C-c B" . jao-transient-org-blog))))
#+end_src
* Commands
*** New entries
@@ -228,23 +228,28 @@
(interactive)
(jao-org-blog-publish t))
#+end_src
-* Hydras
+* Transient
#+begin_src emacs-lisp
- (pretty-hydra-define jao-hydra-org-blog (:color blue :quit-key "q")
- ("Insert"
- (("s" (insert jao-org-static-blog--prev-beg) "preview begin")
- ("S" (insert jao-org-static-blog--prev-end) "preview end")
- ("t" jao-org-static-blog-update-date "update date"))
- "Edit"
- (("n" jao-org-static-blog-create-new-post "create post")
- ("d" jao-org-static-blog-create-new-draft "create draft")
- ("e" jao-org-static-blog-edit-draft "edit draft"))
- "Publish"
- (("D" jao-org-static-blog-publish-draft "publish draft")
- ("f" jao-org-blog-publish-file "publish single file")
- ("p" jao-org-blog-publish "publish all")
- ("r" jao-org-blog-republish "republish"))))
-
- (major-mode-hydra-define+ org-mode nil
- ("Utilities" (("b" jao-hydra-org-blog/body "Blog ops"))))
+ (defun jao-org-static-prev-begin ()
+ (interactive)
+ (insert jao-org-static-blog--prev-beg))
+
+ (defun jao-org-static-prev-end ()
+ (interactive)
+ (insert jao-org-static-blog--prev-end))
+
+ (jao-transient-major-mode+ org
+ ["Insert blog snippet"
+ ("s" "preview begin" jao-org-static-prev-begin)
+ ("S" "preview end" jao-org-static-prev-end)
+ ("T" "update date" jao-org-static-blog-update-date)]
+ ["Edit blog"
+ ("n" "create post" jao-org-static-blog-create-new-post)
+ ("d" "create draft" jao-org-static-blog-create-new-draft)
+ ("e" "edit draft" jao-org-static-blog-edit-draft)]
+ ["Publish blog"
+ ("D" "publish draft" jao-org-static-blog-publish-draft)
+ ("f" "publish single file" jao-org-blog-publish-file)
+ ("p" "publish all" jao-org-blog-publish)
+ ("r" "republish" jao-org-blog-republish)])
#+end_src
diff --git a/exwm.org b/exwm.org
index 1a7a38d..352c8b0 100644
--- a/exwm.org
+++ b/exwm.org
@@ -326,6 +326,7 @@
(jao-exwm--send-str (format "%sg" page-no)))
(defun jao-zathura-open-doc (&optional file-name page-no height)
+ (interactive)
(let* ((file-name (expand-file-name (or file-name (buffer-file-name))))
(buffer (seq-find `(lambda (b)
(string= ,file-name
@@ -420,6 +421,13 @@
(jao-afio--goto-docs)
(pop-to-buffer b)))
+
+ (let ((viewers ["External viewers"
+ ("z" "open with zathura" jao-zathura-open-doc)
+ ("m" "open with mupdf" jao-exwm-open-with-mupdf)]))
+ (jao-transient-major-mode+ pdf-view viewers)
+ (jao-transient-major-mode+ doc-view viewers))
+
#+end_src
* Firefox helpers
#+begin_src emacs-lisp
@@ -431,92 +439,100 @@
(jao-exwm--send-str "yy")
(switch-to-buffer cb))))
#+end_src
-* Hydras
+* Transients
#+begin_src emacs-lisp
- (major-mode-hydra-define+ (doc-view-mode pdf-view-mode) nil
- ("External"
- (("z" (jao-zathura-open-doc) "open with zathura")
- ("m" jao-exwm-open-with-mupdf "open with mupdf"))))
-
- (defhydra jao-hydra-float (:color blue)
- "Float"
- ("f" exwm-floating-toggle-floating "float")
- ("F" exwm-layout-toggle-fullscreen "full")
- ("tl" (jao-exwm--float-to 20 20))
- ("tr" (jao-exwm--float-to -20 20))
- ("bl" (jao-exwm--float-to 20 -20))
- ("br" (jao-exwm--float-to -20 -20))
- ("c" jao-exwm--center-float)
- ("k" (exwm-floating-move 0 -5) :color red)
- ("j" (exwm-floating-move 0 5) :color red)
- ("h" (exwm-floating-move -5 0) :color red)
- ("l" (exwm-floating-move 5 0) :color red)
- ("K" (exwm-layout-enlarge-window 5) :color red)
- ("J" (exwm-layout-enlarge-window -5) :color red)
- ("H" (exwm-layout-enlarge-window 5 t) :color red)
- ("L" (exwm-layout-enlarge-window -5 t) :color red)
- ("q" nil ""))
-
- (pretty-hydra-define jao-hydra-exwm-misc (:color blue :quit-key "q")
- ("Jump around"
- (("s" jao-slack-download "slack downloads")
- ("h" (jao-buffer-same-mode 'helpful) "helpful buffer")
- ("g" exwm-workspace-switch nil))
- "X-Windows"
- (("f" exwm-floating-toggle-floating "toggle floating window")
- ("F" exwm-layout-toggle-fullscreen "toggle fullscreen mode")
- ("m" exwm-workspace-move-window nil))
- "Zathura"
- (("o" jao-exwm-zathura-goto-org "Go to org notes")
- ("O" (jao-exwm-zathura-goto-org t) "Go to org notes, linking"))
- "Exwm utilities"
- (("k" exwm-input-release-keyboard "release keyboard")
- ("x" exwm-reset "reset exwm"))))
-
- (pretty-hydra-define jao-hydra-exwm
- (global-map "s-w" :color blue :quit-key "q")
- ("Notes"
- (("n" jao-org-notes-open-or-create "capture note")
- ("/" jao-org-notes-open "search notes")
- ("d" jao-exwm-select-pdf "go to doc")
- ("D" jao-open-doc "open to doc"))
- "Packages"
- (("a" jao-term-aptitude "aptitude")
- ("l" jao-exwm-packages "packages")
- ("s-w" jao-hydra-exwm/body nil))
- "Monitors"
- (("p" jao-term-htop "htop")
- ("x" jao-exwm-xmobar "restart xmobar")
- ("X" jao-exwm-kill-xmobar "kill xmobar"))
- "Network"
- (("S" jao-ssh "ssh")
- ("b" jao-exwm-bluetooth "bluetooth")
- ("c" (jao-chats t) "connect chats")
- ("v" jao-mullvad-status "vpn status"))
- "Chats"
- (("t" (jao-buffer-same-mode '(telega-root-mode telega-chat-mode)) "telegram")
- ("T" telega "telegram rooster")
- ("s" (jao-buffer-same-mode 'slack-message-buffer-mode) "slack")
- ("i" (jao-buffer-same-mode '(circe-channel-mode circe-query-mode erc-mode))
- "irc"))
- "Winner"
- (("f" winner-undo "Previous window layout" :color red)
- ("F" winner-redo "Undo window layout restore" :color red))
- "Helpers"
- (("r" org-reveal "org reveal")
- ("w" jao-set-wallpaper "set wallpaper")
- ("W" jao-set-random-wallpaper "set radom wallpaper")
- ("k" jao-kb-toggle "toggle keyboard" :toggle (jao-kb-toggled-p))
- ("M" jao-minibuffer-toggle "toggle minibuffer"
- :toggle jao-minibuffer-enabled-p))))
- #+end_src
+ (defmacro jao-exwm--mover (x y dx dy)
+ `(progn
+ (defun ,(intern (format "jao-exwm-move-%d-%d" dx dy)) ()
+ ,(format "Nudge window by %d, %s" dx dy)
+ (interactive)
+ (exwm-floating-move ,dx ,dy))
+ (defun ,(intern (format "jao-exwm-float-to-%d-%d" x y)) ()
+ ,(format "Move window to %d, %s" x y)
+ (interactive)
+ (jao-exwm--float-to ,x ,y))
+ (defun ,(intern (format "jao-exwm-enlarge-%d-%d" dx dy)) ()
+ ,(format "Enlarge window by %d, %s" dx dy)
+ (interactive)
+ (exwm-layout-enlarge-window ,(if (zerop dx) dy dx) ,(zerop dx)))))
+
+ (jao-exwm--mover 20 -20 0 -5)
+ (jao-exwm--mover 20 20 0 5)
+ (jao-exwm--mover -20 20 5 0)
+ (jao-exwm--mover -20 -20 -5 0)
+ (defun jao-exwm--floating-p () exwm--floating-frame)
+
+ (transient-define-prefix jao-transient-float ()
+ "Operations on EXWM floating windows."
+ :transient-non-suffix 'transient--do-quit-one
+ [["Float"
+ ("f" "float" exwm-floating-toggle-floating)
+ ("F" "full" exwm-layout-toggle-fullscreen)
+ ("c" "center" jao-exwm--center-float :if jao-exwm--floating-p)]
+ ["Slide"
+ :if jao-exwm--floating-p
+ ("k" "up" jao-exwm-move-0--5 :transient t)
+ ("j" "down" jao-exwm-move-0-5 :transient t)
+ ("h" "left" jao-exwm-move--5-0 :transient t)
+ ("l" "right" jao-exwm-move-5-0 :transient t)]
+ ["Resize"
+ :if jao-exwm--floating-p
+ ("K" "up" jao-exwm-enlarge-5-0 :transient t)
+ ("J" "down" jao-exwm-enlarge--5-0 :transient t)
+ ("H" "left" jao-exwm-enlarge-0-5 :transient t)
+ ("L" "right" jao-exwm-enlarge-0--5 :transient t)]
+ ["Nudge"
+ :if jao-exwm--floating-p
+ ("tl" "top-left" jao-exwm-float-to-20-20)
+ ("tr" "top-right" jao-exwm-float-to--20-20)
+ ("bl" "bottom-left" jao-exwm-float-to-20--20)
+ ("br" "bottom-right " jao-exwm-float-to--20--20)]])
+
+ (transient-define-prefix jao-transient-exwm ()
+ "Global operations in EXWM."
+ [["Notes"
+ ("n" "capture note" jao-org-notes-open-or-create)
+ ("/" "search notes" jao-org-notes-open)
+ ("d" "go to doc" jao-exwm-select-pdf)
+ ("D" "open to doc" jao-open-doc)]
+ ["Packages"
+ ("a" "aptitude" jao-term-aptitude)
+ ("l" "packages" jao-exwm-packages)]
+ ["Monitors"
+ ("p" "htop" jao-term-htop)
+ ("x" "restart xmobar" jao-exwm-xmobar)
+ ("X" "kill xmobar" jao-exwm-kill-xmobar)]
+ ["Network"
+ ("S" "ssh" jao-ssh)
+ ("b" "bluetooth" jao-exwm-bluetooth)
+ ("c" "connect chats" jao-all-chats)
+ ("v" "vpn status" jao-mullvad-status)]
+ ["Chats"
+ ("t" "telegram" jao-chats-telega)
+ ("T" "telegram rooster" telega)
+ ("s" "slack" jao-chats-slack)
+ ("i" "irc" jao-chats-irc)]
+ ["Windows"
+ ("f" "Previous window layout" winner-undo :transient t)
+ ("F" "Undo window layout restore" winner-redo :transient t)
+ ("w" "set wallpaper" jao-set-wallpaper)
+ ("W" "set radom wallpaper" jao-set-random-wallpaper)]
+ ["PDFs"
+ :if (lambda () (derived-mode-p 'doc-view-mode 'pdf-view-mode))
+ ("z" "open with zathura" jao-zathura-open-doc)
+ ("m" "open with mupdf" jao-exwm-open-with-mupdf)]
+ ["Helpers"
+ ("r" "org reveal" org-reveal)
+ ("k" (lambda () (concat "keyboard" (when (jao-kb-toggled-p) "*")))
+ jao-kb-toggle)
+ ("M" (lambda () (concat "minibuffer" (when jao-minibuffer-enabled-p "*")))
+ jao-minibuffer-toggle)]])
+
+ #+end_src
* Keybindings
#+begin_src emacs-lisp
(define-key exwm-mode-map [?\C-q] #'exwm-input-send-next-key)
- (define-key exwm-mode-map [?\s-f] #'jao-hydra-float/body)
- (define-key exwm-mode-map [?\s-m] #'jao-hydra-media/body)
- (define-key exwm-mode-map [?\s-s] #'jao-hydra-spotify/body)
- (define-key exwm-mode-map [?\s-w] #'jao-hydra-exwm/body)
+ (define-key exwm-mode-map [?\s-f] #'jao-transient-float)
(define-key exwm-mode-map (kbd "C-c o") #'jao-exwm-zathura-goto-org)
(define-key exwm-mode-map (kbd "C-c O") #'jao-exwm-zathura-goto-org*)
(define-key exwm-mode-map (kbd "M-o") #'other-window)
@@ -531,18 +547,18 @@
([?\s-4] . jao-afio--goto-docs)
([?\s-A] . org-agenda-list)
([?\s-a] . jao-first-window)
- ([?\s-b] . jao-hydra-org-blog/body)
- ([?\s-c] . jao-hydra-chats/body)
+ ([?\s-b] . jao-transient-org-blog)
([?\s-e] . jao-exwm-firefox-1)
([?\s-t] . jao-term-here-toggle)
- ([?\s-n] . jao-hydra-ednc/body)
+ ([?\s-m] . jao-transient-media)
([?\s-O] . jao-transpose-windows)
([?\s-o] . jao-other-window)
([?\s-P] . jao-transpose-windows-prev)
([?\s-p] . jao-prev-window)
([?\s-r] . app-launcher-run-app)
- ([?\s-x] . jao-hydra-exwm-misc/body)
- ([?\s-z] . jao-hydra-sleep/body)
+ ([?\s-s] . jao-transient-spotify)
+ ([?\s-w] . jao-transient-exwm)
+ ([?\s-z] . jao-transient-sleep)
([XF86AudioMute] . jao-mixer-master-toggle)
([XF86AudioPlay] . jao-player-toggle)
([XF86AudioPause] . jao-player-toggle)
diff --git a/gnus.org b/gnus.org
index af2e36d..ae52fe7 100644
--- a/gnus.org
+++ b/gnus.org
@@ -723,27 +723,4 @@
(define-key gnus-article-mode-map "\C-ci" 'w3m-view-image)
(define-key gnus-article-mode-map "z" 'w3m-lnum-zoom-in-image))
- (major-mode-hydra-define gnus-summary-mode nil
- ("Browse"
- (("g" jao-gnus-follow-link "Follow link in emacs")
- ("G" (jao-gnus-follow-link t) "Follow link in external browser")
- ("i" jao-gnus-show-images "Show images"))
- "Capture"
- (("x" jao-gnus-arXiv-capture "Capture arXiv entry")
- ("e" jao-gnus-open-enclosure "Add enclosure to playlist")
- ("E" (jao-gnus-open-enclosure t) "Play enclosure"))))
-
- (major-mode-hydra-define gnus-article-mode nil
- ("Browse"
- (("g" jao-gnus-follow-link "Follow link in emacs")
- ("G" (jao-gnus-follow-link t) "Follow link in external browser"))
- "Capture"
- (("x" jao-gnus-arXiv-capture "Capture arXiv entry")
- ("e" jao-gnus-open-enclosure "Add enclosure to playlist")
- ("E" (jao-gnus-open-enclosure t) "Play enclosure"))
- "Images"
- (("z" w3m-lnum-zoom-in-image "Zoom image at point")
- ("I" (if (fboundp 'w3m-view-image) (w3m-view-image) (eww-display-image))
- "View image at point")
- ("i" jao-gnus-show-images "Show images"))))
- #+end_src
+ #+end_src
diff --git a/init.org b/init.org
index a12615a..c837582 100644
--- a/init.org
+++ b/init.org
@@ -199,23 +199,43 @@
(jao-exec-string "brightnessctl -q s 5%%-")
(jao-bright-show))
#+end_src
-*** Keyboard and hydra
+*** Keyboard
#+begin_src emacs-lisp
(use-package repeat
:config (setq repeat-echo-function #'repeat-echo-mode-line))
(when (> emacs-major-version 27) (repeat-mode))
(use-package transient
- :init (setq transient-show-popup 2.0))
+ :init (setq transient-show-popup 2.0)
+ :config
+ (transient-bind-q-to-quit)
+
+ :bind (("s-SPC" . jao-transient-major-mode)))
+
+ (defmacro jao-transient-major-mode (mode &rest suffix)
+ (declare (indent defun))
+ (let ((mode (intern (format "%s-mode" mode)))
+ (mmap (intern (format "%s-mode-map" mode)))
+ (name (intern (format "jao-transient-%s" mode))))
+ `(progn
+ (transient-define-prefix ,name ()
+ ,(format "Transient ops for %s" mode)
+ [,(format "Operations for %s" mode) :if-derived ',mode ,@suffix])
+ (define-key ,mmap (kbd "s-SPC") #',name))))
+
+ (defmacro jao-transient-major-mode+1 (mode suffix)
+ (declare (indent defun))
+ (let ((name (intern (format "jao-transient-%s" mode))))
+ (if (fboundp name)
+ `(transient-append-suffix ',name '(0 -1) ,suffix)
+ `(jao-transient-major-mode ,mode ,suffix))))
+
+ (defmacro jao-transient-major-mode+ (mode &rest suffixes)
+ (declare (indent defun))
+ `(progn
+ ,@(mapcar (lambda (s) `(jao-transient-major-mode+1 ,mode ,s))
+ suffixes)))
- (use-package hydra :ensure t)
- (use-package major-mode-hydra
- :ensure t
- :custom (major-mode-hydra-invisible-quit-key "q")
- :bind (("s-SPC" . major-mode-hydra)
- ("H-s-SPC" . major-mode-hydra)
- ("C-s-SPC" . major-mode-hydra)))
- (require 'major-mode-hydra)
(defun jao-kb-toggle (&optional lyt)
(interactive)
@@ -551,12 +571,12 @@
(shell-command "swaylock -i ~/.lockimage")
(jao-xlock-screen)))
- (pretty-hydra-define jao-hydra-sleep (:color blue)
- ("Sleep"
- (("l" jao-lock-screen "lock screen")
- ("z" jao-suspend "sleep")
- ("u" jao-screensaver-toggle "enable/disable screensaver")
- ("q" nil "cancel"))))
+ (transient-define-prefix jao-transient-sleep ()
+ ["Sleep"
+ ("l" "lock screen" jao-lock-screen)
+ ("z" "sleep" jao-suspend)
+ ("u" "enable/disable screensaver" jao-screensaver-toggle)])
+
#+end_src
*** X clipboard
#+BEGIN_SRC emacs-lisp
@@ -1651,24 +1671,42 @@
(setq jao-org-open-pdf-fun #'jao-afio-open-pdf)
#+end_src
-*** hydra
- #+begin_src emacs-lisp
- (major-mode-hydra-define doc-view-mode nil
- ("Notes"
- (("o" jao-org-pdf-goto-org "notes file")
- ("O" (jao-org-pdf-goto-org 4) "notes file, linking"))
- "Navigation"
- (("b" jao-doc-view-back "back jump")
- ("B" jao-doc-view-back "forward jump")
- ("u" jao-doc-view-visit-url "visit URL"))
- "Slices"
- (("cb" doc-view-set-slice-from-bounding-box "bounding box")
- ("cm" doc-view-set-slice-using-mouse "using mouse"))
- "Session"
- (("s" jao-open-pdf-session "load session")
- ("S" jao-doc-view-save-session "save session")
- ("d" doc-view-dired-cache "visit cache directory"))))
- #+end_src
+*** transient
+ #+begin_src emacs-lisp
+ (defun jao-org-pdf-goto-org-linking ()
+ (interactive)
+ (jao-org-pdf-goto-org 4))
+
+ (jao-transient-major-mode doc-view
+ ["Notes"
+ ("o" "notes file" jao-org-pdf-goto-org)
+ ("O" "notes file, linking" jao-org-pdf-goto-org-linking)]
+ ["Navigation"
+ ("b" "back jump" jao-doc-view-back)
+ ("B" "forward jump" jao-doc-view-back)
+ ("u" "visit URL" jao-doc-view-visit-url)]
+ ["Slices"
+ ("cb" "bounding box" doc-view-set-slice-from-bounding-box)
+ ("cm" "using mouse" doc-view-set-slice-using-mouse)]
+ ["Session"
+ ("s" "load session" jao-open-pdf-session)
+ ("S" "save session" jao-doc-view-save-session)
+ ("d" "visit cache directory" doc-view-dired-cache)])
+
+ (jao-transient-major-mode pdf-view
+ ["Notes"
+ ("o" "notes file" jao-org-pdf-goto-org)
+ ("O" "notes file, linking" jao-org-pdf-goto-org-linking)]
+ ["Navigation"
+ ("b" "back jump" pdf-history-backward)
+ ("f" "forward jump" pdf-history-forward)]
+ ["Session"
+ ("s" "load session" jao-afio-open-pdf-session)
+ ("S" "save session" jao-doc-view-save-session)])
+
+ ;; (transient-get-suffix 'jao-transient-pdf-view '(0 -1))
+
+ #+end_src
* Shells
*** shell modes
#+begin_src emacs-lisp
@@ -2079,15 +2117,16 @@
'(progn
(define-key gnus-summary-mode-map "\C-cG" 'jao-gnus-github-review)
(define-key gnus-article-mode-map "\C-cG" 'jao-gnus-github-review)))
- :mode-hydra
- (github-review-mode nil
- ("Review"
- (("a" github-review-approve "Approve")
- ("r" github-review-reject "Reject")
- ("c" github-review-reject "Comment"))
- "Quit"
- (("Q" bury-buffer "Bury buffer")
- ("k" kill-buffer "Kill buffer")))))
+
+ (jao-transient-major-mode github-review
+ ["Review"
+ ("a" "Approve" github-review-approve)
+ ("r" "Reject" github-review-reject)
+ ("c" "Comment" github-review-reject)]
+ ["Quit"
+ ("Q" "Bury buffer" bury-buffer)
+ ("k" "Kill buffer" kill-buffer)]))
+
#+end_src
*** Jenkins
[[https://github.com/rmuslimov/jenkins.el][GitHub - rmuslimov/jenkins.el: Jenkins plugin for emacs]]
@@ -2488,20 +2527,20 @@
:diminish ""
:hook (haskell-mode . hlint-refactor-mode))
#+end_src
-***** hydra
+***** transient
#+begin_src emacs-lisp
- (major-mode-hydra-define haskell-mode nil
- ("Imports"
- (("in" haskell-navigate-imports "Navigate imports")
- ("if" haskell-mode-format-imports "Format imports")
- ("is" haskell-sort-imports "Sort imports")
- ("ia" haskell-align-imports "Align imports"))
- "Code"
- (("c" haskell-compile "Compile")
- ("s" haskell-mode-stylish-buffer "stylish on buffer"))
- "Hoogle"
- (("h" jao-haskell-hoogle "Hoogle")
- ("H" haskell-hoogle-lookup-from-local "Hoogle from local server"))))
+ (jao-transient-major-mode haskell
+ ["Imports"
+ ("in" "Navigate imports" haskell-navigate-imports)
+ ("if" "Format imports" haskell-mode-format-imports)
+ ("is" "Sort imports" haskell-sort-imports)
+ ("ia" "Align imports" haskell-align-imports)]
+ ["Code"
+ ("c" "Compile" haskell-compile)
+ ("s" "stylish on buffer" haskell-mode-stylish-buffer)]
+ ["Hoogle"
+ ("h" "Hoogle" jao-haskell-hoogle)
+ ("H" "Hoogle from local server" haskell-hoogle-lookup-from-local)])
#+end_src
*** Prolog
#+BEGIN_SRC emacs-lisp
@@ -2750,27 +2789,28 @@
(when (or p (y-or-n-p "Connect to libera? "))
(circe "Libera Chat")))
- (pretty-hydra-define jao-hydra-chats (global-map "s-q" :color blue :quit-key "q")
- ("Connect"
- (("A" (jao-chats t) "all chats -y")
- ("a" jao-chats "all chats")
- ("S" slack-start "slack")
- ("g" signel-start "signal")
- ("e" (jao-erc t) "erc -y")
- ("s-q" jao-hydra-chats/body nil))
- "Go"
- (("i" (jao-buffer-same-mode 'erc-mode) "irc")
- ("s" (jao-buffer-same-mode 'slack-message-buffer-mode) "slack buffer")
- ("t" (jao-buffer-same-mode 'telega-chat-mode) "telega buffer")
- ("T" telega "telega rooster"))))
-
- (global-set-key (kbd "H-s-q") #'jao-hydra-chats/body)
+ (defun jao-all-chats () (interactive) (jao-chats t))
+
+ (defun jao-chats-telega ()
+ (interactive)
+ (jao-buffer-same-mode '(telega-root-mode telega-chat-mode)))
+
+ (defun jao-chats-slack ()
+ (interactive)
+ (jao-buffer-same-mode 'slack-message-buffer-mode))
+
+ (defun jao-chats-irc ()
+ (interactive)
+ (jao-buffer-same-mode '(circe-channel-mode circe-query-mode erc-mode)))
+
#+end_src
* Multimedia
*** mixer
#+begin_src emacs-lisp
- (defun jao-mixer-get-level (dev)
- (let* ((s (shell-command-to-string (format "amixer sget %s" dev)))
+ (defun jao-mixer-get-level (&optional dev)
+ (interactive)
+ (let* ((dev (or dev "Master"))
+ (s (shell-command-to-string (format "amixer sget %s" dev)))
(s (car (last (split-string s "\n" t)))))
(when (string-match ".*Front .*\\[\\([0-9]+\\)%\\] .*" s)
(let ((level (match-string 1 s)))
@@ -2856,7 +2896,7 @@
(defalias 'jao-player-connect 'jao-mpc-connect)
(defalias 'jao-player-play 'jao-mpc-play)
#+end_src
-*** hydras
+*** transients
#+begin_src emacs-lisp
(require 'jao-lyrics)
@@ -2879,59 +2919,77 @@
(interactive)
(jao-notify "Volume" (format "%s%%" (jao-player-volume))))
+ (defun jao-player-seek-10 () (interactive) (jao-player-seek 10))
+ (defun jao-player-seek--10 () (interactive) (jao-player-seek -10))
+
+ (defun jao-spotify-clear () (interactive) (jao-mpc-clear jao-mopidy-port))
+ (defun jao-spotify-echo-current ()
+ (interactive)
+ (jao-mpc-echo-current jao-mopidy-port))
+ (defun jao-spotify-show-playlist ()
+ (interactive)
+ (jao-mpc-show-playlist jao-mopidy-port))
+
+ (defun jao-player-seek-m10 ()
+ (interactive)
+ (jao-player-seek 10 jao-mopidy-port))
+ (defun jao-player-seek-m-10 ()
+ (interactive)
+ (jao-player-seek -10 jao-mopidy-port))
+
+
+ (defun jao-player-level-cap () (interactive) (jao-mixer-level "Capture"))
+
(use-package jao-random-album :demand t)
- (pretty-hydra-define jao-hydra-spotify
- (global-map "s-s" :color blue :quit-key "q")
- ("Search"
- (("a" jao-spotify-album "album")
- ("A" jao-spotify-artist "artist")
- ("t" jao-spotify-track "track")
- ("P" jao-spotify-playlist "playlist"))
- "Play"
- (("s" espotify-play-pause "toggle")
- ("n" espotify-next "next")
- ("p" espotify-previous "previous")
- ("f" (jao-mpc-seek 10 jao-mopidy-port) "seek fwd" :color red)
- ("F" (jao-mpc-seek -10 jao-mopidy-port) "seek bwd" :color red))
- "Browse"
- (("l" (jao-mpc-show-playlist jao-mopidy-port) "playing list")
- ("c" (jao-mpc-clear jao-mopidy-port) "clear list" :color red)
- ("w" (jao-mpc-echo-current jao-mopidy-port) "currently playing")
- ("s-s" jao-hydra-spotify/body nil))))
-
- (pretty-hydra-define jao-hydra-media
- (global-map "s-m" :color blue :quit-key "q")
- ("Play"
- (("m" jao-player-toggle "toggle")
- ("n" jao-player-next "next")
- ("p" jao-player-previous "previous")
- ("s" (espotify-play-pause) "toggle spotify"))
- "Seek and search"
- (("f" (jao-player-seek 10) "seek fwd" :color red)
- ("F" (jao-player-seek -10) "seek bwd" :color red)
- ("a" jao-mpc-select-album "select album"))
- "Browse"
- (("b" jao-player-browse "browse")
- ("l" jao-player-list "show play list")
- ("L" jao-show-lyrics "show lyrics")
- ("w" (let ((jao-notify-use-messages-p t)) (jao-player-echo))
- "now playing"))
- "Master volume"
- (("d" jao-mixer-master-down "master down" :color red)
- ("u" jao-mixer-master-up "master up" :color red)
- ("M" jao-mixer-master-toggle "master toggle")
- ("v" (jao-mixer-get-level "Master") "show"))
- "Capture volume"
- (("D" jao-mixer-capture-down "capture down" :color red)
- ("U" jao-mixer-capture-up "capture up" :color red)
- ("V" (jao-mixer-get-level "Capture") "show"))
- "Utilities"
- (("c" jao-player-connect "reconnect to mpd")
- ("N" jao-random-album-next "next random album")
- ("r" jao-random-album-toggle "toggle random album"
- :toggle jao-random-album-p)
- ("s-m" jao-hydra-media/body nil))))
+ (transient-define-prefix jao-transient-spotify ()
+ [["Search"
+ ("a" "album" jao-spotify-album)
+ ("A" "artist" jao-spotify-artist)
+ ("t" "track" jao-spotify-track)
+ ("P" "playlist" jao-spotify-playlist)]
+ ["Play"
+ ("s" "toggle" espotify-play-pause)
+ ("n" "next" espotify-next)
+ ("p" "previous" espotify-previous)]
+ ["Seek"
+ ("f" "seek fwd" jao-player-seek-m10 :transient t)
+ ("F" "seek bwd" jao-player-seek-m-10 :transient t)]
+ ["Browse"
+ ("l" "playing list" jao-spotify-show-playlist)
+ ("c" "clear list"jao-spotify-clear :transient t)
+ ("w" "currently playing" jao-spotify-echo-current)]])
+
+ (transient-define-prefix jao-transient-media ()
+ [["Play"
+ ("m" "toggle" jao-player-toggle)
+ ("n" "next" jao-player-next)
+ ("p" "previous" jao-player-previous)
+ ("s" "toggle spotify" espotify-play-pause)]
+ ["Seek and search"
+ ("f" "seek fwd" jao-player-seek-10 :transient t)
+ ("F" "seek bwd" jao-player-seek--10 :transient t)
+ ("a" "select album" jao-mpc-select-album)]
+ ["Browse"
+ ("b" "browse" jao-player-browse)
+ ("l" "show play list" jao-player-list)
+ ("L" "show lyrics" jao-show-lyrics)
+ ("w" "now playing" jao-player-echo)]
+ ["Master volume"
+ ("d" "master down" jao-mixer-master-down :transient t)
+ ("u" "master up" jao-mixer-master-up :transient t)
+ ("M" "master toggle" jao-mixer-master-toggle)
+ ("v" "show" jao-mixer-get-level)]
+ ["Capture volume"
+ ("D" "capture down" jao-mixer-capture-down :transient t)
+ ("U" "capture up" jao-mixer-capture-up :transient t)
+ ("V" "show" jao-player-level-cap)]
+ ["Utilities"
+ ("c" "reconnect to mpd" jao-player-connect)
+ ("N" "next random album" jao-random-album-next)
+ ("r" (lambda ()
+ (concat (if jao-random-album-p "dis" "en") "able random album"))
+ jao-random-album-toggle)]])
#+end_src
* Key bindings
@@ -2941,49 +2999,6 @@
(global-set-key "\C-xr\M-w" #'kill-rectangle-save)
(global-set-key "\C-c\C-z" #'comment-or-uncomment-region)
(global-set-key "\C-z" #'comment-or-uncomment-region)
-
- (pretty-hydra-define jao-hydra-emacs-utils
- (global-map "s-w" :color blue :quit-key "q")
- ("Notes"
- (("n" jao-org-notes-open-or-create "capture note")
- ("/" jao-org-notes-open "search notes"))
- "Docs"
- (("d" (jao-buffer-same-mode '(pdf-view-mode docview-mode)
- #'jao-afio--goto-docs)
- "go to doc")
- ("D" jao-open-doc "open to doc"))
- "Packages"
- (("a" jao-term-aptitude "aptitude")
- ("l" list-packages "packages")
- ("s-w" jao-hydra-emacs-utils/body nil))
- "Network"
- (("S" jao-ssh "ssh")
- ("T" telega "telegram rooster")
- ("c" (jao-chats t) "connect chats"))
- "Monitors"
- (("p" jao-term-htop "htop")
- ("b" jao-exwm-bluetooth "bluetooth")
- ;; ("P" jao-exwm-proced "proced")
- ("x" jao-exwm-xmobar "restart xmobar")
- ;; ("X" jao-exwm-kill-xmobar "kill xmobar")
- ;; ("t" jao-time-echo-times "current time")
- )
- "Chats"
- (("t" (jao-buffer-same-mode 'telega-chat-mode) "telegram buffers")
- ("s" (jao-buffer-same-mode 'slack-message-buffer-mode) "slack buffers")
- ("i" (jao-buffer-same-mode '(circe-channel-mode erc-mode)) "irc channels"))
- "Looks"
- (;; ("T" jao-toggle-transparency "toggle transparency"
- ;; :toggle (jao-transparent-p) :color red)
- ("w" jao-set-wallpaper "set wallpaper")
- ("W" jao-set-random-wallpaper "set radom wallpaper"))
- "Helpers"
- (("r" org-reveal "org reveal")
- ("k" jao-kb-toggle "toggle keyboard"
- :toggle (jao-kb-toggled-p) :color red)
- ("M" jao-minibuffer-toggle "toggle minibuffer"
- :toggle jao-minibuffer-enabled-p))))
-
#+end_src
* Last minute (post.el)
#+begin_src emacs-lisp
diff --git a/notmuch.org b/notmuch.org
index 3885f02..1c1e6d7 100644
--- a/notmuch.org
+++ b/notmuch.org
@@ -494,37 +494,3 @@
(org-capture nil "X"))))
#+end_src
-* hydras
- #+begin_src emacs-lisp
- (major-mode-hydra-define notmuch-search-mode nil
- ("Tagging"
- (("*" notmuch-search-tag-all "tag all")
- ("+" notmuch-search-add-tag "add tag")
- ("-" notmuch-search-remove-tag "add tag")
- ("k" notmuch-tag-jump "jump to tag"))
- "Search"
- (("l" notmuch-search-filter "filter with additional query")
- ("t" notmuch-search-filter-by-tag "filter by tag")
- ("y" notmuch-stash-query "stash current query"))
- "Moving around"
- (("b" notmuch-search-scroll-down "scroll down")
- ("<" notmuch-search-first-thread "first thread")
- (">" notmuch-search-last-thread "last thread"))))
-
- (major-mode-hydra-define notmuch-tree-mode nil
- ("View"
- (("." jao-notmuch-toggle-mime-parts "toggle mime parts")
- ("i" jao-notmuch-show-images "toggle images")
- ("a" notmuch-tree-archive-thread-then-next "archive thread")
- ("C" jao-notmuch-echo-count "echo unread count"))
- "Mark"
- (("d" jao-notmuch-tree-delete-message "delete message")
- ("D" jao-notmuch-tree-delete-thread "delete thread")
- ("u" (jao-notmuch-tree-delete-message t) "undelete message")
- ("k" jao-notmuch-tree-read-thread "kill thread"))
- "Edit/send"
- (("r" notmuch-tree-reply-sender "reply sender")
- ("R" notmuch-tree-reply "reply all")
- ("f" notmuch-tree-forward-message "forward")
- ("e" notmuch-tree-resume-message "edit draft"))))
- #+end_src
diff --git a/org.org b/org.org
index 09ab951..b4fe511 100644
--- a/org.org
+++ b/org.org
@@ -200,15 +200,14 @@
(use-package jao-org-notes
:commands (jao-org-notes-setup)
:config
- (major-mode-hydra-define+ org-mode ()
- ("Notes"
- (("i" jao-org-notes-insert-link "insert link")
- ("t" jao-org-notes-insert-tags "insert tags")
- ("o" jao-org-notes-open "find and open note")
- ("c" jao-org-notes-open-or-create "open or create note")
- ("v" jao-org-notes-backlinks "show backlinks"))))
- :bind (("C-c n" . jao-org-notes-open-or-create)
- ("C-c N" . jao-org-notes-open)))
+ (jao-transient-major-mode+ org
+ ["Notes"
+ ("i" "insert link" jao-org-notes-insert-link)
+ ("t" "insert tags" jao-org-notes-insert-tags)
+ ("o" "find and open note" jao-org-notes-open)
+ ("c" "open or create note" jao-org-notes-open-or-create)
+ ("v" "show backlinks" jao-org-notes-backlinks)]))
+
(jao-org-notes-setup "n")
#+end_src
* Links