wasamasa / eyebrowse

A simple-minded way of managing window configs in emacs
GNU General Public License v3.0
437 stars 24 forks source link

hydra template #88

Closed novoid closed 6 years ago

novoid commented 6 years ago

Hi,

I'd love to see a section in the README where users may copy a hydra for eyebrowse with the main functionality (e.g., functions that have a default key binding).

To circumvent my personal sparse space problem in the modeline, I'd love to see the eyebrowse-mode-line-indicator in that hydra as well ;-)

Therefore, it should look like that:

1:orgmode, 2, 3:python, 4:dired, 5:misc

_p_revious window config         _0_ switch to window config
_n_next window config        _1_ switch to window config
_l_ast window config         ...                        
_r_ename current window config   _9_ switch to window config  
_c_reate new window config         
_C_lose current window config      

I can help with the bottom section but I don't know how to get the list of current configs. I guess that this should provide the necessary functionality somehow.

(defhydra hydra-eyebrowse (:color red)
  "
  ^
  1:orgmode, 2, 3:python, 4:dired, 5:misc  <- FIXXME: needs to be replaced with the dynamic string

  _p_revious window config         _0_ switch to window config
  _n_next window config            _1_ switch to window config
  _l_ast window config         ...                        
  _r_ename current window config   _9_ switch to window config  
  _c_reate new window config         
  _C_lose current window config      
  ^^
  "
  ("q" nil "quit")
  ("p" eyebrowse-prev-window-config nil)
  ("n" eyebrowse-next-window-config nil)
  ("l" eyebrowse-last-window-config nil)
  ("r" eyebrowse-rename-window-config nil)
  ("c" eyebrowse-create-window-config nil)
  ("C" eyebrowse-close-window-config nil)
  ("0" eyebrowse-switch-to-window-config-0 nil)
  ("1" eyebrowse-switch-to-window-config-1 nil)
  ("2" eyebrowse-switch-to-window-config-2 nil)
  ("3" eyebrowse-switch-to-window-config-3 nil)
  ("4" eyebrowse-switch-to-window-config-4 nil)
  ("5" eyebrowse-switch-to-window-config-5 nil)
  ("6" eyebrowse-switch-to-window-config-6 nil)
  ("7" eyebrowse-switch-to-window-config-7 nil)
  ("8" eyebrowse-switch-to-window-config-8 nil)
  ("9" eyebrowse-switch-to-window-config-9 nil)
)

Thanks for your awesome work!

wasamasa commented 6 years ago

I don't see the point honestly. If you managed making such a thing and believe others are interested, share it elsewhere. The list of configs lives in the current frame and is retrieved with (eyebrowse--get 'window-configs).

novoid commented 6 years ago

Hi,

I found out how to re-use the list of configs via eyebrowse-mode-line-indicator() that returns the current modeline indicator in a formatted way. This works for me as long as I did not find out how to generate the "numbers-only" modeline I was referring to in #89.

Here is my current hydra for anybody interested:

(defhydra hydra-eyebrowse (:color red)
  "
  ^
  %s(eyebrowse-mode-line-indicator)  

  _,_ left window config            _0_ switch to window config
  _._ right window config           _1_ switch to window config
  ↦ previous window config  ^^        ...                        
  _r_ename current window config    _9_ switch to window config  
  _c_reate new window config         
  _C_lose current window config      
  ^^
  "
  ("q" nil "quit")
  ("," eyebrowse-prev-window-config nil)
  ("." eyebrowse-next-window-config nil)
  ("<tab>" eyebrowse-last-window-config nil)
  ("r" eyebrowse-rename-window-config nil)
  ("c" eyebrowse-create-window-config nil)
  ("C" eyebrowse-close-window-config nil)
  ("0" eyebrowse-switch-to-window-config-0 nil)
  ("1" eyebrowse-switch-to-window-config-1 nil)
  ("2" eyebrowse-switch-to-window-config-2 nil)
  ("3" eyebrowse-switch-to-window-config-3 nil)
  ("4" eyebrowse-switch-to-window-config-4 nil)
  ("5" eyebrowse-switch-to-window-config-5 nil)
  ("6" eyebrowse-switch-to-window-config-6 nil)
  ("7" eyebrowse-switch-to-window-config-7 nil)
  ("8" eyebrowse-switch-to-window-config-8 nil)
  ("9" eyebrowse-switch-to-window-config-9 nil)
)

(define-key global-map [(f8)] 'hydra-eyebrowse/body) ;; I personally do use my own map: http://karl-voit.at/2018/07/08/emacs-key-bindings