2020-03-06 07:50:18 +01:00
|
|
|
|
;;; oni-hydra.el --- Configuration for using Hydra -*- lexical-binding: t; -*-
|
|
|
|
|
|
|
|
|
|
;; Copyright (C) 2020 Tom Willemse
|
|
|
|
|
|
|
|
|
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
|
|
|
|
;; Keywords: local
|
2021-07-16 07:34:08 +02:00
|
|
|
|
;; Version: 2021.0715.221700
|
2020-03-06 07:50:18 +01:00
|
|
|
|
;; Package-Requires: (hydra posframe)
|
|
|
|
|
|
|
|
|
|
;; This program is free software; you can redistribute it and/or modify
|
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
|
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;; Configuration for hydra. Set it up to use posframe instead of the default lv.
|
2021-07-16 07:34:08 +02:00
|
|
|
|
;; Add the following to your init file in case you want to use this
|
|
|
|
|
;; configuraiton:
|
|
|
|
|
;;
|
|
|
|
|
;; (with-eval-after-load 'hydra (require 'oni-hydra))
|
2020-03-06 07:50:18 +01:00
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
(require 'hydra)
|
2021-01-21 01:25:25 +01:00
|
|
|
|
(require 'lv)
|
|
|
|
|
(require 'posframe)
|
|
|
|
|
|
|
|
|
|
(defun oni-hydra-custom-show (&rest args)
|
|
|
|
|
"Use ‘hydra-posframe-show’ when possible, fall back to ‘lv-message’.
|
|
|
|
|
ARGS are passed on without modification."
|
|
|
|
|
(if (posframe-workable-p)
|
|
|
|
|
(apply #'hydra-posframe-show args)
|
|
|
|
|
(apply #'lv-message args)))
|
|
|
|
|
|
|
|
|
|
(defun oni-hydra-custom-hide (&rest args)
|
|
|
|
|
"Use ‘hydra-posframe-hide’ when possible, fall back to ‘lv-delete-window’.
|
|
|
|
|
ARGS are passed on without modification."
|
|
|
|
|
(if (posframe-workable-p)
|
|
|
|
|
(apply #'hydra-posframe-hide args)
|
|
|
|
|
(apply #'lv-delete-window args)))
|
|
|
|
|
|
|
|
|
|
(add-to-list 'hydra-hint-display-alist '(custom oni-hydra-custom-show oni-hydra-custom-hide))
|
|
|
|
|
|
|
|
|
|
(setq hydra-hint-display-type 'custom)
|
2020-03-06 07:50:18 +01:00
|
|
|
|
|
|
|
|
|
(provide 'oni-hydra)
|
|
|
|
|
;;; oni-hydra.el ends here
|