From ec7b593bfa656d882462b474e53424411fc0c86f Mon Sep 17 00:00:00 2001 From: Raymond Hogenson Date: Thu, 17 May 2018 11:06:09 -0800 Subject: 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. --- main.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- cgit v1.3.1