diff options
author | tv <tv@krebsco.de> | 2019-02-09 02:13:06 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2019-02-09 02:33:04 +0100 |
commit | 9d688b6ffad14912bd1afe42555747cb3d213d95 (patch) | |
tree | bfe639002a97508784e1c52135f566f4399d0dbb /src/Flameshot/Internal.hs | |
parent | 03623ce6c011c1e85df7d91aed4458c098ff22ff (diff) |
Main.app: copy capture to clipboard with xclipv1.1.0
Diffstat (limited to 'src/Flameshot/Internal.hs')
-rw-r--r-- | src/Flameshot/Internal.hs | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/Flameshot/Internal.hs b/src/Flameshot/Internal.hs index 56a35b4..b01b145 100644 --- a/src/Flameshot/Internal.hs +++ b/src/Flameshot/Internal.hs @@ -10,19 +10,17 @@ import Control.Concurrent.Async (race) import Control.Concurrent.Extended import Control.Exception import Data.ByteString (ByteString) -import qualified Data.ByteString as BS import qualified Data.Char as C import Data.Function (on) import Data.Maybe (fromMaybe) -import Data.Time.Clock import Data.Time.Clock.System -import Data.Time.Format import Data.Time.ISO8601 import DBus import DBus.Internal.Message import DBus.Socket import Data.Text (Text) import qualified Data.Text.Extended as T +import qualified Flameshot.Internal.Process as P blessBusName :: BusName -> Blessings Text @@ -110,14 +108,6 @@ showUnprintable = . T.groupBy ((==) `on` p) -saveImage :: FilePath -> ByteString -> IO () -saveImage cGuiPath rawImage = do - t <- formatISO8601Seconds . systemToUTCTime <$> getSystemTime - let path = cGuiPath <> "/" <> baseName - baseName = t <> "_flameshot.png" - BS.writeFile path rawImage - - -formatISO8601Seconds :: UTCTime -> String -formatISO8601Seconds = - formatTime defaultTimeLocale (iso8601DateFormat $ Just "%H:%M:%SZ") +copyToClipboard :: String -> ByteString -> IO () +copyToClipboard mimetype = + P.writeDaemon "xclip" ["-selection", "clipboard", "-t", mimetype, "-i"] |