aboutsummaryrefslogtreecommitdiffstats
path: root/oni-hydra.el
diff options
context:
space:
mode:
Diffstat (limited to 'oni-hydra.el')
-rw-r--r--oni-hydra.el24
1 files changed, 21 insertions, 3 deletions
diff --git a/oni-hydra.el b/oni-hydra.el
index 7960d4c..6c95ca8 100644
--- a/oni-hydra.el
+++ b/oni-hydra.el
@@ -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)
-
-(setq hydra-hint-display-type 'posframe)
+(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)
;;;###autoload(with-eval-after-load 'hydra (require 'oni-hydra))