aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt
index 035259a1a..31008d9b4 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt
@@ -14,6 +14,7 @@ import java.awt.datatransfer.UnsupportedFlavorException
import kotlin.time.Duration.Companion.milliseconds
object ClipboardUtils {
+ private var dispatcher = Dispatchers.IO
private var lastClipboardAccessTime = SimpleTimeMark.farPast()
private fun canAccessClipboard(): Boolean {
@@ -55,7 +56,7 @@ object ClipboardUtils {
suspend fun readFromClipboard(step: Int = 0): String? {
try {
return try {
- withContext(Dispatchers.IO) {
+ withContext(dispatcher) {
getClipboard()?.getData(DataFlavor.stringFlavor)?.toString()
}
} catch (e: UnsupportedFlavorException) {