Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide hydra temporarily? #301

Closed
TLINDEN opened this issue Oct 20, 2018 · 3 comments
Closed

Hide hydra temporarily? #301

TLINDEN opened this issue Oct 20, 2018 · 3 comments

Comments

@TLINDEN
Copy link

TLINDEN commented Oct 20, 2018

Hi,

given the following hydra:

(defhydra hydra-windows (:color blue)
  ("a" shrink-window-horizontally :color pink)
  ("d" enlarge-window-horizontally :color pink)
  ("w" shrink-window :color pink)
  ("s" enlarge-window :color pink)
  ("q" nil :color red))

would it be possible that the hydra hides temporarily while I am adjusting window sizes? Say, hide for 1 second when one of a,d,w,s has been hit, otherwise re-appear. The reason why I'm asking is that the window sizes are not at the end result as long as the hydra is shown. So If I have 4 windows and want one of them to be bigger, I start the hydra and start adjusting. However, now there are 5 windows, my 4 plus the hydra window. I need to stop adjusting, hit q to hide the hydra, take a look if the resulting sizes are to my liking and repeat the process if not.

I'd suggest something like this:

(defhydra hydra-windows (:color blue)
  ("a" shrink-window-horizontally :color pink :hide 1)
  ("d" enlarge-window-horizontally :color pink :hide 1)
  ("w" shrink-window :color pink :hide 1)
  ("s" enlarge-window :color pink :hide 1)
  ("q" nil :color red))

(1 would be one second).

best regards,
Tom

@abo-abo
Copy link
Owner

abo-abo commented Feb 5, 2019

Hi Tom. Sorry for the late reply.

Here's an easy solution to the problem of windows not being the final size:

(hydra-set-property 'hydra-windows :verbosity 1)

You can also play around with hiding and showing the hint dynamically:

(defhydra hydra-windows (:color pink)
  ("a" shrink-window-horizontally)
  ("d" enlarge-window-horizontally)
  ("w"
   (progn
     (hydra-set-property
      'hydra-windows
      :verbosity 0)
     (shrink-window 2)))
  ("s" enlarge-window)
  ("?" (hydra-set-property 'hydra-windows :verbosity 1))
  ("q" nil :color blue))

Here, w will hide the doc, but ? will show it once more.

@countvajhula
Copy link

This is great, thanks @abo-abo ! I was just about to create an issue requesting this feature, i.e. a way to show/hide the hydra on demand. The reason is, I'm using hydra primarily as a backend for a modal interface, rather than as a menu-driven interface, e.g. for symex.el (and also more generally in this package). For this purpose, it would sometimes be desirable to launch the hydra "invisibly" by default, and then bring up the menu as needed. It looks like toggling the verbosity parameter is just what I'm looking for.

@abo-abo
Copy link
Owner

abo-abo commented Aug 2, 2019

@countvajhula You're welcome.

I've documented this approach on the wiki. So I think this can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants