1
0
Fork 0
mirror of https://git.sr.ht/~rjarry/aerc synced 2025-12-19 10:21:00 +01:00
aerc/commands/account/toggle-sidebar.go
Matthew Phillips 66cf16c4b6 commands: add :toggle-sidebar command
Add a command to toggle the sidebar visibility at runtime.

- Add sidebarHidden field to AccountView
- Add hasSidebar() helper and buildGrid() method
- Update Split() and Vsplit() to respect sidebar state
- Works with all view layouts (basic, hsplit, vsplit)

Changelog-added: New `:toggle-sidebar` command to hide/show the
 sidebar.
Signed-off-by: Matthew Phillips <matthew@matthewphillips.info>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-11-29 21:08:34 +01:00

35 lines
627 B
Go

package account
import (
"errors"
"git.sr.ht/~rjarry/aerc/app"
"git.sr.ht/~rjarry/aerc/commands"
)
type ToggleSidebar struct{}
func init() {
commands.Register(ToggleSidebar{})
}
func (ToggleSidebar) Description() string {
return "Toggle the sidebar on or off."
}
func (ToggleSidebar) Context() commands.CommandContext {
return commands.MESSAGE_LIST
}
func (ToggleSidebar) Aliases() []string {
return []string{"toggle-sidebar"}
}
func (ToggleSidebar) Execute(args []string) error {
acct := app.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
}
acct.ToggleSidebar()
return nil
}