Safe Haskell | None |
---|---|
Language | Haskell2010 |
General GTK API adapter functions. Internal.
Synopsis
- gtkUi :: Members [Stop Text, Embed IO] r => Text -> IO a -> Sem r a
- unsafeGtkClipboard :: MonadIO m => Display -> Selection -> m Clipboard
- gtkClipboard :: Members [Stop Text, Embed IO] r => Display -> Selection -> Sem r Clipboard
- clipboardRequest :: Clipboard -> (Either Text Text -> IO ()) -> IO ()
- subscribeWith :: Member (Final IO) r => Clipboard -> (Either Text Text -> Sem r ()) -> Sem r ()
- readClipboard :: Members [Log, Stop Text, Embed IO] r => Clipboard -> Sem r (Maybe Text)
- unsafeSetClipboard :: MonadIO m => Clipboard -> Text -> m ()
- writeClipboard :: Members [Stop Text, Embed IO] r => Clipboard -> Text -> Sem r ()
- getDisplay :: Members [Stop Text, Embed IO] r => Sem r Display
- getClipboard :: Members [Reader Display, Stop Text, Embed IO] r => Selection -> Sem r Clipboard
- subscribeToClipboard :: Members [Reader Display, Log, Stop Text, Embed IO, Final IO] r => (Selection -> Text -> Sem r ()) -> Selection -> Sem r ()
- clipboardText :: Members [Reader Display, Log, Stop Text, Embed IO] r => Selection -> Sem r (Maybe Text)
- setClipboardText :: Members [Reader Display, Log, Stop Text, Embed IO, Final IO] r => Selection -> Text -> Sem r ()
Documentation
gtkUi :: Members [Stop Text, Embed IO] r => Text -> IO a -> Sem r a Source #
Safe wrapper around calls to ght GTK API.
This schedules an IO
action for execution on the GTK main loop thread, which is crucial for some actions to avoid
horrible crashes.
Since this results in asynchronous execution, an MVar
is used to extract the result.
Catches all exception and converts them to Stop
.
unsafeGtkClipboard :: MonadIO m => Display -> Selection -> m Clipboard Source #
Accesses a clipboard by creating the appropriate X11 atom structure. Does not catch exceptions.
gtkClipboard :: Members [Stop Text, Embed IO] r => Display -> Selection -> Sem r Clipboard Source #
Return a GTK clipboard, converting all exceptions to Stop
.
subscribeWith :: Member (Final IO) r => Clipboard -> (Either Text Text -> Sem r ()) -> Sem r () Source #
readClipboard :: Members [Log, Stop Text, Embed IO] r => Clipboard -> Sem r (Maybe Text) Source #
Safely request the text contents of a clipboard by scheduling an action on the UI thread and converting exceptions
into Stop
.
unsafeSetClipboard :: MonadIO m => Clipboard -> Text -> m () Source #
Update the text contents of a clipboard. Does not catch exceptions.
writeClipboard :: Members [Stop Text, Embed IO] r => Clipboard -> Text -> Sem r () Source #
Safely update the text contents of a clipboard by scheduling an action on the UI thread and converting exceptions
into Stop
.
getDisplay :: Members [Stop Text, Embed IO] r => Sem r Display Source #
Obtain the default GTK display, converting exceptions into Stop
.
getClipboard :: Members [Reader Display, Stop Text, Embed IO] r => Selection -> Sem r Clipboard Source #
Obtain a GTK clipboard handle for a specific Selection
subscribeToClipboard :: Members [Reader Display, Log, Stop Text, Embed IO, Final IO] r => (Selection -> Text -> Sem r ()) -> Selection -> Sem r () Source #
Listen to clipboard events for a specific source, like "primary selection", and pass them to the callback.