helic-0.5.2.0: Clipboard Manager
Safe HaskellNone
LanguageHaskell2010

Helic.Gtk

Description

General GTK API adapter functions. Internal.

Synopsis

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.

clipboardRequest :: Clipboard -> (Either Text Text -> IO ()) -> IO () Source #

Request the text contents of a GTK clipboard, catching all exceptions, and passing the result to a handler. If the clipboard is empty or an exception was thrown, the value passed to the handler is Left, otherwise Right.

subscribeWith :: Member (Final IO) r => Clipboard -> (Either Text Text -> Sem r ()) -> Sem r () Source #

Registers a callback for the "owner change" event of a GTK clipboard, which is triggered whenever a client updates the text. The callback then fetches the current text and passes it to the supplied handler as Right, or a Left if an exception was thrown.

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.

clipboardText :: Members [Reader Display, Log, Stop Text, Embed IO] r => Selection -> Sem r (Maybe Text) Source #

Fetch the text contents of the GTK clipboard corresponding to the specified X11 selection, converting exceptions into Stop.

setClipboardText :: Members [Reader Display, Log, Stop Text, Embed IO, Final IO] r => Selection -> Text -> Sem r () Source #

Update the text contents of the GTK clipboard corresponding to the specified X11 selection, converting exceptions into Stop.