fix(ui): hide tab bar during fullscreen video playback
- commit
- a9e245c6b4bf58a36374f161c9bef5503c97fe2e
- author
- bnema · · 2025-12-27 22:45 UTC
- parent
- d3cff9d
- signature
- GPG Unverified
2B82207D370127A0The key is unknown
2 files · +28 -0
M internal/ui/app.go +14 -0
| @@ -1006,6 +1006,20 @@ func (a *App) initCoordinators(ctx context.Context) { | |||
| 1006 | 1006 | a.contentCoord.SetIdleInhibitor(a.deps.IdleInhibitor) | |
| 1007 | 1007 | } | |
| 1008 | 1008 | ||
| 1009 | + | // Set fullscreen callback to hide/show tab bar | |
| 1010 | + | a.contentCoord.SetOnFullscreenChanged(func(entering bool) { | |
| 1011 | + | if a.mainWindow == nil || a.mainWindow.TabBar() == nil { | |
| 1012 | + | return | |
| 1013 | + | } | |
| 1014 | + | if entering { | |
| 1015 | + | // Hide tab bar when entering fullscreen video | |
| 1016 | + | a.mainWindow.TabBar().SetVisible(false) | |
| 1017 | + | } else { | |
| 1018 | + | // Restore tab bar visibility based on normal logic | |
| 1019 | + | a.tabCoord.UpdateBarVisibility(ctx) | |
| 1020 | + | } | |
| 1021 | + | }) | |
| 1022 | + | ||
| 1009 | 1023 | // 2. Tab Coordinator | |
| 1010 | 1024 | a.tabCoord = coordinator.NewTabCoordinator(ctx, coordinator.TabCoordinatorConfig{ | |
| 1011 | 1025 | TabsUC: a.tabsUC, | |
| @@ -1006,6 +1006,20 @@ func (a *App) initCoordinators(ctx context.Context) { | |||||
| 1006 | a.contentCoord.SetIdleInhibitor(a.deps.IdleInhibitor) | 1006 | a.contentCoord.SetIdleInhibitor(a.deps.IdleInhibitor) | ||
| 1007 | } | 1007 | } | ||
| 1008 | 1008 | ||||
| 1009 | + | // Set fullscreen callback to hide/show tab bar | |||
| 1010 | + | a.contentCoord.SetOnFullscreenChanged(func(entering bool) { | |||
| 1011 | + | if a.mainWindow == nil || a.mainWindow.TabBar() == nil { | |||
| 1012 | + | return | |||
| 1013 | + | } | |||
| 1014 | + | if entering { | |||
| 1015 | + | // Hide tab bar when entering fullscreen video | |||
| 1016 | + | a.mainWindow.TabBar().SetVisible(false) | |||
| 1017 | + | } else { | |||
| 1018 | + | // Restore tab bar visibility based on normal logic | |||
| 1019 | + | a.tabCoord.UpdateBarVisibility(ctx) | |||
| 1020 | + | } | |||
| 1021 | + | }) | |||
| 1022 | + | ||||
| 1009 | // 2. Tab Coordinator | 1023 | // 2. Tab Coordinator | ||
| 1010 | a.tabCoord = coordinator.NewTabCoordinator(ctx, coordinator.TabCoordinatorConfig{ | 1024 | a.tabCoord = coordinator.NewTabCoordinator(ctx, coordinator.TabCoordinatorConfig{ | ||
| 1011 | TabsUC: a.tabsUC, | 1025 | TabsUC: a.tabsUC, | ||
M internal/ui/coordinator/content.go +14 -0
| @@ -75,6 +75,9 @@ type ContentCoordinator struct { | |||
| 75 | 75 | ||
| 76 | 76 | // Idle inhibitor for fullscreen video playback | |
| 77 | 77 | idleInhibitor port.IdleInhibitor | |
| 78 | + | ||
| 79 | + | // Callback when fullscreen state changes (for hiding/showing tab bar) | |
| 80 | + | onFullscreenChanged func(entering bool) | |
| 78 | 81 | } | |
| 79 | 82 | ||
| 80 | 83 | // NewContentCoordinator creates a new ContentCoordinator. | |
| @@ -137,6 +140,11 @@ func (c *ContentCoordinator) SetIdleInhibitor(inhibitor port.IdleInhibitor) { | |||
| 137 | 140 | c.idleInhibitor = inhibitor | |
| 138 | 141 | } | |
| 139 | 142 | ||
| 143 | + | // SetOnFullscreenChanged sets the callback for fullscreen state changes. | |
| 144 | + | func (c *ContentCoordinator) SetOnFullscreenChanged(fn func(entering bool)) { | |
| 145 | + | c.onFullscreenChanged = fn | |
| 146 | + | } | |
| 147 | + | ||
| 140 | 148 | // EnsureWebView acquires or reuses a WebView for the given pane. | |
| 141 | 149 | func (c *ContentCoordinator) EnsureWebView(ctx context.Context, paneID entity.PaneID) (*webkit.WebView, error) { | |
| 142 | 150 | log := logging.FromContext(ctx) | |
| @@ -1289,6 +1297,9 @@ func (c *ContentCoordinator) setupIdleInhibitionHandlers(ctx context.Context, pa | |||
| 1289 | 1297 | log.Warn().Err(err).Str("pane_id", string(paneID)).Msg("failed to inhibit idle") | |
| 1290 | 1298 | } | |
| 1291 | 1299 | } | |
| 1300 | + | if c.onFullscreenChanged != nil { | |
| 1301 | + | c.onFullscreenChanged(true) | |
| 1302 | + | } | |
| 1292 | 1303 | return false // Allow fullscreen | |
| 1293 | 1304 | } | |
| 1294 | 1305 | ||
| @@ -1298,6 +1309,9 @@ func (c *ContentCoordinator) setupIdleInhibitionHandlers(ctx context.Context, pa | |||
| 1298 | 1309 | log.Warn().Err(err).Str("pane_id", string(paneID)).Msg("failed to uninhibit idle") | |
| 1299 | 1310 | } | |
| 1300 | 1311 | } | |
| 1312 | + | if c.onFullscreenChanged != nil { | |
| 1313 | + | c.onFullscreenChanged(false) | |
| 1314 | + | } | |
| 1301 | 1315 | return false // Allow leaving fullscreen | |
| 1302 | 1316 | } | |
| 1303 | 1317 | ||
| @@ -75,6 +75,9 @@ type ContentCoordinator struct { | |||||
| 75 | 75 | ||||
| 76 | // Idle inhibitor for fullscreen video playback | 76 | // Idle inhibitor for fullscreen video playback | ||
| 77 | idleInhibitor port.IdleInhibitor | 77 | idleInhibitor port.IdleInhibitor | ||
| 78 | + | ||||
| 79 | + | // Callback when fullscreen state changes (for hiding/showing tab bar) | |||
| 80 | + | onFullscreenChanged func(entering bool) | |||
| 78 | } | 81 | } | ||
| 79 | 82 | ||||
| 80 | // NewContentCoordinator creates a new ContentCoordinator. | 83 | // NewContentCoordinator creates a new ContentCoordinator. | ||
| @@ -137,6 +140,11 @@ func (c *ContentCoordinator) SetIdleInhibitor(inhibitor port.IdleInhibitor) { | |||||
| 137 | c.idleInhibitor = inhibitor | 140 | c.idleInhibitor = inhibitor | ||
| 138 | } | 141 | } | ||
| 139 | 142 | ||||
| 143 | + | // SetOnFullscreenChanged sets the callback for fullscreen state changes. | |||
| 144 | + | func (c *ContentCoordinator) SetOnFullscreenChanged(fn func(entering bool)) { | |||
| 145 | + | c.onFullscreenChanged = fn | |||
| 146 | + | } | |||
| 147 | + | ||||
| 140 | // EnsureWebView acquires or reuses a WebView for the given pane. | 148 | // EnsureWebView acquires or reuses a WebView for the given pane. | ||
| 141 | func (c *ContentCoordinator) EnsureWebView(ctx context.Context, paneID entity.PaneID) (*webkit.WebView, error) { | 149 | func (c *ContentCoordinator) EnsureWebView(ctx context.Context, paneID entity.PaneID) (*webkit.WebView, error) { | ||
| 142 | log := logging.FromContext(ctx) | 150 | log := logging.FromContext(ctx) | ||
| @@ -1289,6 +1297,9 @@ func (c *ContentCoordinator) setupIdleInhibitionHandlers(ctx context.Context, pa | |||||
| 1289 | log.Warn().Err(err).Str("pane_id", string(paneID)).Msg("failed to inhibit idle") | 1297 | log.Warn().Err(err).Str("pane_id", string(paneID)).Msg("failed to inhibit idle") | ||
| 1290 | } | 1298 | } | ||
| 1291 | } | 1299 | } | ||
| 1300 | + | if c.onFullscreenChanged != nil { | |||
| 1301 | + | c.onFullscreenChanged(true) | |||
| 1302 | + | } | |||
| 1292 | return false // Allow fullscreen | 1303 | return false // Allow fullscreen | ||
| 1293 | } | 1304 | } | ||
| 1294 | 1305 | ||||
| @@ -1298,6 +1309,9 @@ func (c *ContentCoordinator) setupIdleInhibitionHandlers(ctx context.Context, pa | |||||
| 1298 | log.Warn().Err(err).Str("pane_id", string(paneID)).Msg("failed to uninhibit idle") | 1309 | log.Warn().Err(err).Str("pane_id", string(paneID)).Msg("failed to uninhibit idle") | ||
| 1299 | } | 1310 | } | ||
| 1300 | } | 1311 | } | ||
| 1312 | + | if c.onFullscreenChanged != nil { | |||
| 1313 | + | c.onFullscreenChanged(false) | |||
| 1314 | + | } | |||
| 1301 | return false // Allow leaving fullscreen | 1315 | return false // Allow leaving fullscreen | ||
| 1302 | } | 1316 | } | ||
| 1303 | 1317 | ||||