halloy icon indicating copy to clipboard operation
halloy copied to clipboard

new feature: change behavior of sidebar channel buttons to toggle.

Open neutralparadoxdev opened this issue 1 year ago • 7 comments

clicking on a channel in the sidebar with an open pane closes the pane. Sidebar channel buttons are now effectively toggles.

#466

neutralparadoxdev avatar Aug 04 '24 06:08 neutralparadoxdev

I like the idea here, but I think it would be best to make it a configuration option. I know some users of the new-pane and replace-pane settings for default_action would prefer not to have this behavior, so I suggest we add a toggle-pane setting that will cover this use case.

I'd also like to see if we can address #451 in this PR, which is similar but not exactly the same. If the two ideas can be merged that'd be ideal, but if they're truly incompatible we could add a fourth default_action.

andymandias avatar Aug 06 '24 01:08 andymandias

  • Added the associated config option.
  • Moved hacked Open code to its own event sequence.
  • Added documentation for the config option.\
  • Did not tackle #451 as I do not know the required behavior to meet it.
  • I carelessly merged...

neutralparadoxdev avatar Aug 06 '24 05:08 neutralparadoxdev

I removed the pane_toggling config since your update to DefaultAction means default_action = "toggle-pane" will set the configuration. Otherwise I just reorganized it a bit.

Looks good to me, but let's see if we need to implement a "focus before close" setting.

andymandias avatar Aug 06 '24 06:08 andymandias

If I understand correctly, the first setting would describe the type of open action made when clicking, and the second would describe the action made when clicking on a buffer with the focused state. Since they describe slightly different concepts, maybe they should have distinct styling. Something like, open_action and focused_buffer? Or focused_buffer_action?

andymandias avatar Aug 06 '24 17:08 andymandias

If I understand correctly, the first setting would describe the type of open action made when clicking, and the second would describe the action made when clicking on a buffer with the focused state. Since they describe slightly different concepts, maybe they should have distinct styling. Something like, open_action and focused_buffer? Or focused_buffer_action?

Yes! What about: buffer_action and focused_buffer_action to keep it similar?

casperstorm avatar Aug 06 '24 22:08 casperstorm

thanks accepting my suggestion and the help.

I completely missed the ability to minimize changes by reusing messages regarding opening and close buffers.

neutralparadoxdev avatar Aug 07 '24 01:08 neutralparadoxdev

Yes! What about: buffer_action and focused_buffer_action to keep it similar?

Sounds good to me! Did you want to take a crack at the refactor @neutralparadoxdev? Happy to help, of course, but it's all yours if you want.

andymandias avatar Aug 07 '24 06:08 andymandias

@neutralparadoxdev, I rebased and updated this PR to make it ready for review. Here's what I did:

  • Renamed default_action to buffer_action.
  • Added a buffer_focused_action which is a optional enum which has close-pane variant. By default this is not set.
    • When you set buffer_focused_action = "close-pane" it will close a focused buffer, when pressed.

casperstorm avatar Aug 30 '24 12:08 casperstorm

@andymandias take a look if this make sense to you - I kinda like this new setting.

casperstorm avatar Aug 30 '24 17:08 casperstorm

Sorry, this was a mistake. I'll reopen.

casperstorm avatar Sep 02 '24 09:09 casperstorm