aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hogenson <rhogenson@posteo.net>2018-05-17 11:06:09 -0800
committerRaymond Hogenson <rhogenson@posteo.net>2018-05-17 11:06:09 -0800
commitec7b593bfa656d882462b474e53424411fc0c86f (patch)
treec8eabc5c8f32f5b58d87df2f22983aa014ee3a23
parentfab7cfc21284d873a27aa60697bdb7706a9afa41 (diff)
downloadhsc-ec7b593bfa656d882462b474e53424411fc0c86f.tar.zst
Copy the result to the clipboard
It's copied to the primary selection since that's most convenient for me. I hope that's not confusing for anyone. Next step, multithreading.
-rw-r--r--main.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/main.hs b/main.hs
index 3c3d457..760e02f 100644
--- a/main.hs
+++ b/main.hs
@@ -12,6 +12,7 @@ main = do _ <- initGUI
grid <- gridNew
input <- entryNew
output <- labelNew (Nothing :: Maybe String)
+ clip <- Cl.liftIO $ clipboardGet selectionPrimary
gridAttach grid input 0 0 1 1
gridAttach grid output 0 1 1 1
containerAdd w grid
@@ -28,7 +29,8 @@ main = do _ <- initGUI
s <- Cl.liftIO $ entryGetText input
case RealCalc.calculate s of
Nothing -> return ()
- Just r -> Cl.liftIO $ labelSetText output r
+ Just r -> do Cl.liftIO $ clipboardSetText clip r
+ Cl.liftIO $ labelSetText output r
return False
widgetShowAll w
mainGUI