From b73beb1fefda944607ef022f238ad4c0599e91ea Mon Sep 17 00:00:00 2001 From: Stu Date: Tue, 9 Dec 2025 11:19:44 -0500 Subject: [PATCH] Add fullscreen mode with F11 and ESC keyboard shortcuts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implements basic fullscreen toggle functionality for immersive video playback. Fullscreen Features: - F11 key toggles fullscreen on/off - ESC key exits fullscreen mode - Window.SetFullScreen() for native fullscreen - isFullscreen state tracking in appState Keyboard Shortcuts: - F11: Toggle fullscreen (globally available) - ESC: Exit fullscreen (only when in fullscreen mode) - Shortcuts work from any screen in the app Implementation: - Added isFullscreen bool to appState - Created toggleFullscreen() method - Global keyboard handler in runGUI() - SetOnTypedKey handles F11 and ESC Usage: 1. Load a video in VT_Player 2. Press F11 to enter fullscreen 3. Press F11 or ESC to exit fullscreen Next Steps: - Add fullscreen button to player controls - Auto-hide controls after 3 seconds in fullscreen - Show controls on mouse movement in fullscreen - Double-click video to toggle fullscreen ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- main.go | 19 +++++++++++++ scripts/build.sh.old | 63 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100755 scripts/build.sh.old diff --git a/main.go b/main.go index c2757d5..55c14bb 100644 --- a/main.go +++ b/main.go @@ -199,6 +199,7 @@ type appState struct { compareFile1 *videoSource compareFile2 *videoSource keyframingMode bool // Toggle for frame-accurate editing features + isFullscreen bool // Fullscreen mode state } func (s *appState) stopPreview() { @@ -208,6 +209,11 @@ func (s *appState) stopPreview() { } } +func (s *appState) toggleFullscreen() { + s.isFullscreen = !s.isFullscreen + s.window.SetFullScreen(s.isFullscreen) +} + func (s *appState) updateStatsBar() { if s.statsBar == nil || s.jobQueue == nil { return @@ -2024,6 +2030,19 @@ func runGUI() { w.SetOnDropped(func(pos fyne.Position, items []fyne.URI) { state.handleDropPlayer(items) }) + + // Global keyboard shortcuts (F11 for fullscreen, ESC to exit fullscreen) + w.Canvas().SetOnTypedKey(func(key *fyne.KeyEvent) { + switch key.Name { + case fyne.KeyF11: + state.toggleFullscreen() + case fyne.KeyEscape: + if state.isFullscreen { + state.toggleFullscreen() + } + } + }) + state.showMainMenu() logging.Debug(logging.CatUI, "main menu rendered with %d modules", len(modulesList)) diff --git a/scripts/build.sh.old b/scripts/build.sh.old new file mode 100755 index 0000000..b66c98e --- /dev/null +++ b/scripts/build.sh.old @@ -0,0 +1,63 @@ +#!/bin/bash +# VT Player Build Script +# Cleans dependencies and builds the application with proper error handling + +set -e + +PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +BUILD_OUTPUT="$PROJECT_ROOT/VTPlayer" + +echo "โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•" +echo " VT Player Build Script" +echo "โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•" +echo "" + +# Check if go is installed +if ! command -v go &> /dev/null; then + echo "โŒ ERROR: Go is not installed. Please install Go 1.21 or later." + exit 1 +fi + +echo "๐Ÿ“ฆ Go version:" +go version +echo "" + +# Change to project directory +cd "$PROJECT_ROOT" + +echo "๐Ÿงน Cleaning previous builds and cache..." +go clean -cache -modcache -testcache 2>/dev/null || true +rm -f "$BUILD_OUTPUT" 2>/dev/null || true +echo "โœ“ Cache cleaned" +echo "" + +echo "โฌ‡๏ธ Downloading and verifying dependencies..." +go mod download +go mod verify +echo "โœ“ Dependencies verified" +echo "" + +echo "๐Ÿ”จ Building VT Player..." +# Fyne needs cgo for GLFW/OpenGL bindings; build with CGO enabled. +export CGO_ENABLED=1 +if go build -o "$BUILD_OUTPUT" .; then + echo "โœ“ Build successful!" + echo "" + echo "โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•" + echo "โœ… BUILD COMPLETE" + echo "โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•" + echo "" + echo "Output: $BUILD_OUTPUT" + echo "Size: $(du -h "$BUILD_OUTPUT" | cut -f1)" + echo "" + echo "To run:" + echo " $PROJECT_ROOT/VTPlayer" + echo "" + echo "Or use the convenience script:" + echo " source $PROJECT_ROOT/scripts/alias.sh" + echo " VTPlayer" + echo "" +else + echo "โŒ Build failed!" + exit 1 +fi