helic-0.1.0.0: Clipboard Manager
Safe HaskellNone
LanguageHaskell2010

Helic

Description

A clipboard management CLI tool built with Polysemy, Servant and GI.Gtk.

Synopsis

Documentation

Helic is primarily a CLI tool that listens for clipboard events and broadcasts them to other hosts and tmux.

The program is built with Polysemy, so its effects and interpreters may be useful for other developers. Some utilities for interfacing with GTK are exposed as well.

data Agent :: Effect Source #

An agent is an interface to an external entity that can receive clipboard events. The Helic CLI uses agents for remote hosts over network, tmux, and X11.

data AgentTag Source #

Used to disambiguate Agents via Tagged.

type Agents = [Tagged AgentTmux Agent, Tagged AgentX Agent, Tagged AgentNet Agent] Source #

The default agents for the Helic CLI.

XClipboard

data XClipboard :: Effect Source #

Communicate with the X11 clipboard.

Interpreters

interpretAgentNet :: Members [Manager, Events resource Event, Reader InstanceName, Reader NetConfig] r => Members [AtomicState (Seq Event), Log, Interrupt, Race, Resource, Async, Embed IO, Final IO] r => InterpreterFor (Tagged AgentNet Agent) r Source #

Interpret Agent using remote hosts as targets. This also starts the HTTP server that listens to network events, which are used both for remote hosts and CLI events.

interpretAgentX :: Members [EventConsumer xr XClipboardEvent, Events er Event, Reader InstanceName, XClipboard, ChronosTime] r => Members [Events xr XClipboardEvent, Error Text, Race, Resource, Async, Embed IO, Final IO] r => InterpreterFor (Tagged AgentX Agent) r Source #

Interpret Agent using the X11 clipboard as target. This interpreter also runs a thread that converts events generated by the XClipboard interpreter (XClipboardEvent) to the main Event type.

interpretAgentTmux :: Members [Reader TmuxConfig, Log, Async, Race, Resource, Embed IO] r => InterpreterFor (Tagged AgentTmux Agent) r Source #

Interpret Agent using a tmux server as the target.

interpretXClipboardGtk :: Members [Reader GtkState, Embed IO] r => InterpreterFor XClipboard r Source #

Interpret XClipboard using a GTK backend. This uses the gi-gtk library to access the X11 clipboard.

Data

data Event Source #

The central data type representing a clipboard event.

Instances

Instances details
Eq Event Source # 
Instance details

Defined in Helic.Data.Event

Methods

(==) :: Event -> Event -> Bool #

(/=) :: Event -> Event -> Bool #

Show Event Source # 
Instance details

Defined in Helic.Data.Event

Methods

showsPrec :: Int -> Event -> ShowS #

show :: Event -> String #

showList :: [Event] -> ShowS #

ToJSON Event Source # 
Instance details

Defined in Helic.Data.Event

FromJSON Event Source # 
Instance details

Defined in Helic.Data.Event

Utilities

withMainLoop :: Members [Resource, Error Text, Race, Async, Embed IO] r => InterpreterFor (Reader GtkState) r Source #

Execute a GTK main loop in a baackground thread and interpret Reader GtkState. The clipboards stored in the state need the main loop running to work properly. The main loop is killed after the interpreted program terminates.

subscribeToClipboard :: Members [Events resource XClipboardEvent, Reader GtkState, Embed IO, Final IO] r => Clipboard -> Selection -> Sem r () Source #

Listen to clipboard events for a specific source, like "primary selection", and publish them via Events.

clipboardEvents :: Members [Events resource XClipboardEvent, Reader GtkState, Embed IO, Final IO] r => Sem r () Source #

Listen to clipboard events and publish them via Events.

listenXClipboard :: Members [Events resource XClipboardEvent, Error Text, Race, Resource, Async, Embed IO, Final IO] r => InterpreterFor (Reader GtkState) r Source #

Run a GTK main loop and listen to clipboard events, publishing them via Events.

type Api = "event" :> (Get '[JSON] (Seq Event) :<|> (ReqBody '[JSON] Event :> PostCreated '[JSON] ())) Source #

The Servant API of the daemon, providing endpoints for getting all events and creating one.

listen :: Members Agents r => Members [EventConsumer token Event, AtomicState (Seq Event), ChronosTime, Log] r => Maybe Int -> Sem r () Source #

Listen for Event via Events, broadcasting them to agents.

yank :: Members [Reader InstanceName, ChronosTime, Manager, Log, Race, Error Text, Embed IO] r => NetConfig -> YankConfig -> Sem r () Source #

Send an event to the server.