System Integration: Clipboard, Commands & Notifications | Kotlin Desktop #18
16views
2likes
025:20
T
Taught by Celeste AI - AI Coding Coach
View on YouTubeDescription
Learn JVM system APIs in Kotlin Compose Desktop! We build a System Toolbox with three tabs — Clipboard History that monitors your clipboard in
real-time, a Command Runner that executes shell commands with ProcessBuilder, and System Info showing platform details and environment
variables. Uses NavigationRail for tab navigation and Compose Desktop Tray for native notifications.
What You'll Learn:
- Clipboard monitoring with AWT Toolkit.getDefaultToolkit().systemClipboard
- Coroutine-based polling with delay() (more reliable than FlavorListener on macOS)
- Reading clipboard with DataFlavor.stringFlavor and writing with StringSelection
- Shell command execution via ProcessBuilder("/bin/sh", "-c", command)
- Process timeout handling with waitFor() and destroyForcibly()
- NavigationRail for vertical tab navigation with Material icons
- Tray composable with rememberTrayState() for system tray integration
- Desktop notifications via sendNotification() on clipboard and command events
- System.getProperty() for OS/arch/Java version and System.getenv() for environment variables
- derivedStateOf for efficient filtering of environment variable lists
Timestamps:
0:00 - Introduction
0:15 - Preview: System Toolbox App
0:45 - Project Setup & Data Models
3:32 - Clipboard Manager (AWT Polling)
5:03 - Command Runner (ProcessBuilder)
6:28 - UI Tabs (Clipboard, Command, System)
17:00 - AppContent (NavigationRail) + Main (Tray)
22:06 - Live Demo: System Toolbox
23:20 - Recap & Key Takeaways
24:20 - Thanks for Watching
Key Takeaways:
1. Clipboard Access — Toolkit.getDefaultToolkit().systemClipboard reads and writes with DataFlavor.stringFlavor
2. Polling Pattern — Coroutine-based polling with delay() is more reliable than FlavorListener on macOS
3. Process Execution — ProcessBuilder("/bin/sh", "-c", command) runs shell commands with waitFor() timeout
4. System Notifications — Tray composable with rememberTrayState() and sendNotification() for desktop alerts
5. Platform Detection — System.getProperty("os.name") and System.getenv() for system information
Previous Lesson:
Lesson 17: Rich Text & Markdown — Markdown Editor with Live Preview
https://youtube.com/...
Next Lesson:
Lesson 19: (coming soon)
Tech Stack:
Kotlin 2.1, Compose Multiplatform 1.7.3, Material3
Material Icons Extended, JVM Standard Library (AWT, ProcessBuilder)
Gradle 8.10, JVM 17+
Source Code: https://github.com/GoCelesteAI/kotlin_desktop_system_toolbox
Taught by CelesteAI
If you found this helpful, please like and subscribe for more Kotlin Desktop tutorials!
#kotlin #compose #desktop #material3 #clipboard #processbuilder #systemtray #notifications #navigationrail #jvm #tutorial #programming
Back to tutorialsOpen in YouTube
Duration
25:20
Published
February 24, 2026
Added to Codegiz
March 15, 2026