A modern video wallpaper engine for macOS that plays videos behind your desktop icons.
Built with C++, Swift, Objective-C++ bridges, and CMake.
- โ Plays video behind desktop icons (proper desktop level)
- โ Infinite looping with AVFoundation
- โ Menu bar control
- โ Works across all spaces
- โ Minimal CPU usage
- โ Pure C++ engine with Objective-C++ macOS bridges
Cool/
โโโ CMakeLists.txt # Build configuration
โโโ src/
โ โโโ WallpaperEngine.hpp # C++ engine header
โ โโโ WallpaperEngine.cpp # C++ engine implementation
โ โโโ WindowManager.mm # Obj-C++ Cocoa/AVFoundation bridge
โ โโโ main.mm # App entry point (Obj-C++)
โ โโโ CoolApp.swift # SwiftUI app entry point
โ โโโ ContentView.swift # Main UI (SwiftUI)
โ โโโ CppBridge.swift # C++ to Swift bridge
โ โโโ VideoManager.swift # Video management logic
โโโ Cool_web/ # Web resources (optional)
โ โโโ index.html
โ โโโ script.js
โ โโโ style.css
โโโ build/ # Build artifacts
โโโ Info.plist # App bundle metadata
โโโ Cool.entitlements # Security entitlements
โโโ README.md # You are here
- macOS 11.0+ (Big Sur or later)
- Xcode Command Line Tools
- CMake 3.20+
- A video file (MP4, MOV)
# Install Xcode Command Line Tools (if not already)
xcode-select --install
# Install CMake (via Homebrew)
brew install cmake# Using provided build script (recommended)
./build.sh
# Or manually:
mkdir -p build && cd build
cmake ..
make# Open the compiled app
open Cool.app
# Or from build directory
open build/Release/Cool.app- The app appears in the menu bar
- Select a video file via the UI
- Video plays behind your desktop icons on repeat
- Video loops infinitely without gaps
- Select video from file picker
- Pause/Resume playback
- Mute toggle
- Adjust scaling mode (Fill/Fit/Stretch)
- Quit from menu bar Click the ๐ฌ icon in the menu bar:
- Quit Cool โ Stop the app
---Modify Video Selection UI
Edit src/ContentView.swift to customize the video picker interface and add new controls.
Current modes are defined in src/VideoManager.swift.
To add more scaling options:
- Add enum case in
VideoManager - Implement corresponding
AVLayerVideoGravityinWindowManager.mm - Update SwiftUI controls in
ContentView.swift
Modify createWallpaperWindow() in src/WindowManager.mm to loop through [NSScreen screens] and create wallpaper layers for each display
To add multiple displays, modify createWallpaperWindow() in WindowManager.mm to loop through [NSScreen screens].
- Pure C++ engine logic
- Platform-agnostic interface
- Staore Components
WallpaperEngine (C++)
- Engine logic and state management
- Platform-agnostic implementation
- Handles wallpaper layer management
WindowManager (Objective-C++)
- Cocoa window creation at desktop level
- AVFoundation video playback
- Bridges between C++ core and Cocoa/AVFoundation
Swift UI Layer
CoolApp.swiftโ SwiftUI app entry pointContentView.swiftโ Main UI for controlsVideoManager.swiftโ Swift video managementCppBridge.swiftโ C++/Swift interoperability
User โ ContentView (SwiftUI)
โ
VideoManager (Swift)
โ
CppBridge (Obj-C++ bridge)
โ
WallpaperEngine (C++)
โ
WindowManager (Obj-C++ โ Cocoa/AVFoundation)
[window setLevel:kCGDesktopWindowLevel];This places the window below desktop icons but above the actual desktop wallpaper.
AVPlBuild fails with CMake errors
```bash
# Clean build from scratch
rm -rf build/
mkdir build && cd build
cmake ..
make- Ensure build completed successfully:
ls build/Release/Cool.app/Contents/MacOS/Cool - Check code signing:
codesign -v build/Release/Cool.app
- Verify video codec (H.264/HEVC recommended)
- Check file permissions:
ls -la /path/to/video.mp4 - Ensure video format is supported by AVFoundation
- Verify bridge declarations in
CppBridge.swift - Check
WindowManager.mmproperly exposes C++ interfaces - Ensure proper
#includedirectives in bridge files
- Check window level setting in
WindowManager.mm - Verify video resolution matches display
- Profile with Instruments.app
- Run
makesuccessfully first - Check that
Cool.app/Contents/MacOS/Coolexists
- Ensure
sample.mp4is inresources/folder - Check CMake copied it:
ls Cool.app/Contents/Resources/ - Verify video codec (H.264 recommended)
- Delete
src/VideoPlayer.mmif it exists (duplicate ofWindowManager.mm) - Clean build:
rm -rf build/* && cd build && cmake .. && make
- Enable ARC in CMakeLists.txt:
set(CMAKE_OBJCXX_FLAGS "${CMAKE_OBJCXX_FLAGS} -fobjc-arc") - Or ignore them (they're warnings, not errors)
- Basic window at desktop level
- Video playback with looping
- Bundled app
- C++/Swift/Objective-C++ architecture
- File picker to choose videos
- Pause/Resume controls
- Mute toggle
- Scaling mode selector (Fill/Fit/Stretch)
- UserDefaults to remember last video
- Multi-monitor support
- Auto-start at login
- CPU/battery saver mode
- Performance profiling
- Native app preferences window
- Per-display video settings
- Playlist support
- Video preview thumbnails
- Screen detection (pause during games)
- HEVC/webM/VP9 codec support
- Brightness/contrast adjustment
- Schedule wallpaper changes
MIT License โ Do whatever you want with this code.
Just don't blame me if your Mac catches fire trying to play 8K 120fps videos as a wallpaper.
Built with a hybrid approach: C++ for performance, Swift for modern UI, and Objective-C++ for the macOS bridge.
Inspired by the need for a lightweight, customizable video wallpaper solution on macOS.
Found a bug? Want to add a feature?
- Fork it
- Fix it
- Submit a PR
Or just roast me in the issues tab. Either works.
Now go add your own video and make your desktop cool. ๐ฌ