aboutsummaryrefslogtreecommitdiffstats
path: root/app/aerc.go
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2024-08-06 21:55:50 +0200
committerRobin Jarry <robin@jarry.cc>2024-10-08 12:45:21 +0200
commitbc8698e1f088cf144a797d2d0b8f875138a79967 (patch)
tree2cab0a76ae4898b264490716dbb665f923feec22 /app/aerc.go
parent1c54bb3a9d11185d86745c64f2c28655385c9146 (diff)
downloadaerc-bc8698e1f088cf144a797d2d0b8f875138a79967.tar.gz
aerc: add quake-mode terminal
Add a drop-down (quake-mode) terminal which is a persistent terminal session that overlays aerc at the top and can be toggled on or off. Enable quake mode by setting [General].enable-quake-mode=true. The height of the drop-down terminal can be set with [ui].quake-terminal-height (default: 20). Toggling is hardcoded to the F1 key. Note that this key should not be used in your key bindings when you enable Quake mode. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'app/aerc.go')
-rw-r--r--app/aerc.go26
1 files changed, 16 insertions, 10 deletions
diff --git a/app/aerc.go b/app/aerc.go
index beef6328..107fc1f3 100644
--- a/app/aerc.go
+++ b/app/aerc.go
@@ -190,16 +190,15 @@ func (aerc *Aerc) Draw(ctx *ui.Context) {
}
aerc.grid.Draw(ctx)
if aerc.dialog != nil {
- if w, h := ctx.Width(), ctx.Height(); w > 8 && h > 4 {
- if d, ok := aerc.dialog.(Dialog); ok {
- xstart, width := d.ContextWidth()
- ystart, height := d.ContextHeight()
- aerc.dialog.Draw(
- ctx.Subcontext(xstart(w), ystart(h),
- width(w), height(h)))
- } else {
- aerc.dialog.Draw(ctx.Subcontext(4, h/2-2, w-8, 4))
- }
+ w, h := ctx.Width(), ctx.Height()
+ if d, ok := aerc.dialog.(Dialog); ok {
+ xstart, width := d.ContextWidth()
+ ystart, height := d.ContextHeight()
+ aerc.dialog.Draw(
+ ctx.Subcontext(xstart(w), ystart(h),
+ width(w), height(h)))
+ } else if w > 8 && h > 4 {
+ aerc.dialog.Draw(ctx.Subcontext(4, h/2-2, w-8, 4))
}
}
}
@@ -329,6 +328,13 @@ func (aerc *Aerc) simulate(strokes []config.KeyStroke) {
}
func (aerc *Aerc) Event(event vaxis.Event) bool {
+ if config.General.QuakeMode {
+ if e, ok := event.(vaxis.Key); ok && e.MatchString("F1") {
+ ToggleQuake()
+ return true
+ }
+ }
+
if aerc.dialog != nil {
return aerc.dialog.Event(event)
}