mirror of
https://git.sr.ht/~rjarry/aerc
synced 2025-12-19 10:21:00 +01:00
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>
35 lines
627 B
Go
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
|
|
}
|