1
0
Fork 0

Add fallback for hydra display

In case posframe can’t be used, when working from a non-graphical client for
example, fall back to the default ‘lv’.
This commit is contained in:
Tom Willemse 2021-01-20 16:25:25 -08:00
parent 86afae7567
commit 624b9916d7

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
;; Version: 2020.0306.225035
;; Version: 2021.0120.162336
;; Package-Requires: (hydra posframe)
;; This program is free software; you can redistribute it and/or modify
@ -27,8 +27,26 @@
;;; Code:
(require 'hydra)
(require 'lv)
(require 'posframe)
(setq hydra-hint-display-type '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)
;;;###autoload(with-eval-after-load 'hydra (require 'oni-hydra))