From 784bb77d91abb459755c7fc7042d89b54eb645d8 Mon Sep 17 00:00:00 2001 From: Piotr Grabowski Date: Sat, 10 Aug 2024 14:58:13 +0200 Subject: [PATCH] feat(ui): allow temporarily revealing the UI with the alt button if hidden --- app.go | 6 ++++++ config.go | 1 + image_area.go | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/app.go b/app.go index ea2cbdb..f0f8427 100644 --- a/app.go +++ b/app.go @@ -70,6 +70,7 @@ type State struct { RecentManager *gtk.RecentManager BackgroundColorCssProvider *gtk.CssProvider PageCacheTrimTimeoutHandle *glib.SourceHandle + UITemporarilyRevealed bool } //go:embed about.jpg @@ -236,6 +237,11 @@ func (app *App) handleKeyPress(key uint, shift bool, ctrl bool) { } else { app.W.MenuItemNextPage.Activate() } + case gdk.KEY_Alt_L: + if app.Config.HideUI { + app.S.UITemporarilyRevealed = !app.S.UITemporarilyRevealed + app.toggleHideUI(!app.S.UITemporarilyRevealed) + } } } diff --git a/config.go b/config.go index 04a36fd..361cfd7 100644 --- a/config.go +++ b/config.go @@ -202,6 +202,7 @@ func (app *App) setHideUI(hideUI bool) { app.Config.HideUI = hideUI app.toggleHideUI(hideUI) app.W.MenuItemHideUI.SetActive(hideUI) + app.S.UITemporarilyRevealed = false } func (app *App) setShrink(shrink bool) { diff --git a/image_area.go b/image_area.go index 6313de6..fe86f47 100644 --- a/image_area.go +++ b/image_area.go @@ -35,6 +35,12 @@ func (app *App) imageAreaInit() { }) app.W.ScrolledWindow.Connect("button-press-event", func(self *gtk.ScrolledWindow, event *gdk.Event) bool { + if app.S.UITemporarilyRevealed { + app.S.UITemporarilyRevealed = false + app.toggleHideUI(true) + return true + } + be := &gdk.EventButton{Event: event} switch be.Button() { case 1: