From 12268277122a014e24ba4a61bec0c280fbc4e95f Mon Sep 17 00:00:00 2001 From: Abhishek Date: Fri, 2 Jul 2021 00:32:23 -0500 Subject: [PATCH] Add copy functionality. --- Clocker/Panel/UI/TimezoneCellView.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Clocker/Panel/UI/TimezoneCellView.swift b/Clocker/Panel/UI/TimezoneCellView.swift index c29a547..ee020cf 100644 --- a/Clocker/Panel/UI/TimezoneCellView.swift +++ b/Clocker/Panel/UI/TimezoneCellView.swift @@ -198,6 +198,12 @@ class TimezoneCellView: NSTableCellView { } override func mouseDown(with _: NSEvent) { + // Text is copied in the following format: Chicago - 1625185925 + let clipboardCopy = "\(customName.stringValue) - \(time.stringValue)" + let pasteboard = NSPasteboard.general + pasteboard.declareTypes([.string], owner: nil) + pasteboard.setString(clipboardCopy, forType: .string) + window?.endEditing(for: nil) }