     }
 }
 
+#else // Linux support using a simple timer --------------------------------------------------
+
+private let frameDuration: TimeInterval = 1.0/120.0
+
+extension DisplayLink {
+    
+    /// DisplayLink is used to hook into screen refreshes.
+    fileprivate final class Driver {
+        
+        private var timer: Timer? = nil
+        
+        /// The callback to call for each frame.
+        var onFrame: ((Frame) -> Void)? = nil
+        
+        /// If the display link is paused or not.
+        var isPaused: Bool = true {
+            didSet {
+                guard isPaused != oldValue else { return }
+                if isPaused {
+                    stop()
+                } else {
+                    start()
+                }
+            }
+        }
+        
+
+        init() {
+            
+        }
+        
+        deinit {
+            isPaused = true
+        }
+        
+        private func start() {
+            guard timer == nil else { return }
+            let timer = Timer(
+                fire: Date(),
+                interval: frameDuration,
+                repeats: true,
+                block: { [weak self] timer in
+                    let timestamp = Date().timeIntervalSince1970
+                    let frame = Frame(
+                        previousTimestamp: timestamp-frameDuration,
+                        timestamp: timestamp)
+                    self?.handle(frame: frame)
+                })
+            self.timer = timer
+            RunLoop.main.add(timer, forMode: .common)
+        }
+        
+        private func stop() {
+            guard let timer = timer else { return }
+            timer.invalidate()
+            self.timer = nil
+        }
+        
+        func handle(frame: Frame) {
+            guard isPaused == false else { return }
+            onFrame?(frame)
+        }
+        
+    }
+}
+
 #endif // ------------------------------------------------------------------------------------------

import Foundation

#if os(iOS) || os(tvOS)
import QuartzCore
#elseif os(macOS)
import CoreVideo
#endif


/// An object that produces an observable sequence of frames that are synchronized
/// to the device's display refresh rate. Provides a layer of abstraction to allow
/// for a consistent API between platforms.

                    timestamp: inOutputTime.pointee.timeInterval)
                
                DispatchQueue.main.async {
                    self?.handle(frame: frame)
                }
                
                return kCVReturnSuccess
