suggesting screen-hook

Franck Richter franckr01 at online.de
Sun Nov 15 16:54:49 UTC 2020


Hi All,

Would it be possible/useful to add a type of hook that get triggered depending of the screen currently displayed ?
ex:
  to get sidebar visible when seeing index screen
    screen-hook index '<enter-command>"set sidebar_visible=yes"<enter>'
  to hide sidebar when seeing pager screen
    screen-hook pager '<enter-command>"set sidebar_visible=no"<enter>'

or even better:
    screen-hook !pager '<enter-command>"set sidebar_visible=yes"<enter>'
    screen-hook pager  '<enter-command>"set sidebar_visible=no"<enter>'

How do you think ?


[ Background ]
If I missed a simple way to achieve above, let me know, I would be happy to hear about it :-)
I wish to hide the sidebar when viewing emails, because copying >1 line of text with the mouse unfortunately includes the content of the sidebar in the copy buffer.

Currently I am using following tricks that unfortunately fail time to time to show the sidebar again :
  message-hook ~A 'set sidebar_visible=no'
  macro pager q '<enter-command>set sidebar_visible=yes<enter><exit>'
  (adapted from https://jhutar.blogspot.com/2018/09/hide-sidebar-when-viewing-message-in.html)

  macro index \CB '<enter-command>toggle sidebar_visible<enter><refresh>'
  macro pager \CB '<enter-command>toggle sidebar_visible<enter><redraw-screen>'

To increase the cases where sidebar_visible=yes happens, I had to make other hooks I use more complex, ex:
  folder-hook "$my_mailboxname/in$" macro index d '<save-message>+$my_mailboxname/trash<enter><enter-command>"set sidebar_visible=yes"<enter>'
  folder-hook "$my_mailboxname/trash$" macro index d '<delete-message><enter-command>"set sidebar_visible=yes"<enter>'
  folder-hook "$my_mailboxname/old$" macro index <F12> '<save-message>+$my_mailboxname/in<enter><enter-command>"set sidebar_visible=yes"<enter>'
  folder-hook "$my_mailboxname/in$" macro index <F12> '<save-message>+$my_mailboxname/old<enter><enter-command>"set sidebar_visible=yes"<enter>'
  folder-hook "$my_mailboxname/trash$" macro index <F12> '<save-message>+$my_mailboxname/in<enter><enter-command>"set sidebar_visible=yes"<enter>'
Even with above, when manually saving mails in other mailboxes (via 's' or ';s'), I have to manually make sidebar visible again.


[ Name alternatives ]
screen-hook, context-hook, mode-hook... (doesn't matter)

Kind regards,
Franck Richter


More information about the Mutt-users mailing list