sindre-0.6: A programming language for simple GUIs
LicenseMIT-style (see LICENSE)
Stabilityprovisional
Portabilityunportable
Safe HaskellNone
LanguageHaskell2010

Sindre.X11

Description

X11 backend for Sindre. For internationalised keyboard input to work, make sure the locale is correctly set.

Synopsis

Documentation

data SindreX11M a Source #

Sindre backend using Xlib.

Instances

Instances details
Monad SindreX11M Source # 
Instance details

Defined in Sindre.X11

Methods

(>>=) :: SindreX11M a -> (a -> SindreX11M b) -> SindreX11M b #

(>>) :: SindreX11M a -> SindreX11M b -> SindreX11M b #

return :: a -> SindreX11M a #

Functor SindreX11M Source # 
Instance details

Defined in Sindre.X11

Methods

fmap :: (a -> b) -> SindreX11M a -> SindreX11M b #

(<$) :: a -> SindreX11M b -> SindreX11M a #

MonadFail SindreX11M Source # 
Instance details

Defined in Sindre.X11

Methods

fail :: String -> SindreX11M a #

Applicative SindreX11M Source # 
Instance details

Defined in Sindre.X11

Methods

pure :: a -> SindreX11M a #

(<*>) :: SindreX11M (a -> b) -> SindreX11M a -> SindreX11M b #

liftA2 :: (a -> b -> c) -> SindreX11M a -> SindreX11M b -> SindreX11M c #

(*>) :: SindreX11M a -> SindreX11M b -> SindreX11M b #

(<*) :: SindreX11M a -> SindreX11M b -> SindreX11M a #

MonadIO SindreX11M Source # 
Instance details

Defined in Sindre.X11

Methods

liftIO :: IO a -> SindreX11M a #

MonadBackend SindreX11M Source # 
Instance details

Defined in Sindre.X11

MonadReader SindreX11Conf SindreX11M Source # 
Instance details

Defined in Sindre.X11

Param SindreX11M Font Source # 
Instance details

Defined in Sindre.X11

Param SindreX11M Color Source # 
Instance details

Defined in Sindre.X11

type BackEvent SindreX11M Source # 
Instance details

Defined in Sindre.X11

type RootPosition SindreX11M Source # 
Instance details

Defined in Sindre.X11

data SindreX11Conf Source #

The read-only configuration of the X11 backend, created during backend initialisation.

Instances

Instances details
MonadReader SindreX11Conf SindreX11M Source # 
Instance details

Defined in Sindre.X11

sindreX11override Source #

Arguments

:: String

The display string (usually the value of the environment variable $DISPLAY or :0)

-> SindreX11M ExitCode

The function returned by compileSindre after command line options have been given

-> IO ExitCode 

Execute Sindre in the X11 backend, grabbing control of the entire display and staying on top.

sindreX11dock Source #

Arguments

:: String

The display string (usually the value of the environment variable $DISPLAY or :0)

-> SindreX11M ExitCode

The function returned by compileSindre after command line options have been given

-> IO ExitCode 

Execute Sindre in the X11 backend as a dock/statusbar.

sindreX11 Source #

Arguments

:: String

The display string (usually the value of the environment variable $DISPLAY or :0)

-> SindreX11M ExitCode

The function returned by compileSindre after command line options have been given

-> IO ExitCode 

Execute Sindre in the X11 backend as an ordinary client visible to the window manager.

xopt Source #

Arguments

:: Param SindreX11M a 
=> Maybe String

Name of widget, using _ if Nothing is passed

-> String

Widget class

-> String

Property name

-> ConstructorM SindreX11M a 

Performs a lookup in the X resources database for a given property. The class used is Sindre.class.property and the name is progname.name.property, where progname is the value of getProgName.

data VisualOpts Source #

Options regarding visual appearance of widgets (colors and fonts).

visualOpts :: WidgetRef -> ConstructorM SindreX11M VisualOpts Source #

Read visual options from either widget parameters or the X resources database using xopt, or a combination. The following graphical components are read:

Foreground color
From fg parameter or foreground X property.
Background color
From bg parameter or background X property.
Focus foreground color
From ffg parameter or focusForeground X property.
Focus background color
From fbg parameter or focusBackground X property.

drawing Source #

Arguments

:: VisualOpts 
-> (Rectangle -> Drawer -> Drawer -> ObjectM a SindreX11M [Rectangle])

The body of the drawing call - this function is called with a rectangle representing the area of the widget, and Drawers for "foreground," "background", "focus foreground", and "focus background" respectively.

-> Rectangle 
-> ObjectM a SindreX11M SpaceUse 

Helper function that makes it easier it write consistent widgets in the X11 backend. The widget is automatically filled with its (nonfocus) background color. You are supposed to use this in the drawI method of a Widget instance definition. An example:

drawI = drawing myWidgetWin myWidgetVisual $ r fg bg ffg fbg -> do
  fg drawString 0 5 "foreground"
  bg drawString 0 15 "background"
  ffg drawString 0 25 "focus foreground"
  fbg drawString 0 35 "focus background"

drawing' :: VisualOpts -> (Rectangle -> Drawer -> Drawer -> ObjectM a SindreX11M ()) -> Rectangle -> ObjectM a SindreX11M SpaceUse Source #

Variant of drawing that assumes the entire rectangle is used.

data Drawer Source #

Constructors

Drawer 

Fields

drawText :: (Integral x, Integral y, Integral z) => Color -> Font -> x -> y -> z -> String -> SindreX11M () Source #

mkDial :: Constructor SindreX11M Source #

A simple dial using an arc segment to indicate the value compared to the max value. Accepts max and value parameters (both integers, default values 12 and 0), and a single field: value. n and p are used to increase and decrease the value.

mkLabel :: Constructor SindreX11M Source #

Label displaying the text contained in the field label, which is also accepted as a widget parameter (defaults to the empty string).

mkBlank :: Constructor SindreX11M Source #

A blank widget, showing only background color, that can use as much or as little room as necessary. Useful for constraining the layout of other widgets.

mkTextField :: Constructor SindreX11M Source #

Single-line text field, whose single field value (also a parameter, defaults to the empty string) is the contents of the editing buffer.

mkInStream :: Handle -> ObjectRef -> SindreX11M (NewObject SindreX11M) Source #

An input stream object wrapping the given Handle. Input is purely event-driven and line-oriented: the event lines is sent (roughly) for each sequence of lines that can be read without blocking, with the payload being a single string value containing the lines read since the last time the event was sent. When end of file is reached, the eof event (no payload) is sent.

mkHList :: Constructor SindreX11M Source #

Horizontal dmenu-style list containing a list of elements, one of which is the "selected" element. If the parameter i is given a true value, element matching will be case-insensitive. The following methods are supported:

insert(string)
Split string into lines and add each line as an element.
clear()
Delete all elements.
filter(string)
Only display those elements that contain string.
next()
Move selection right.
prev()
Move selection left.
first()
Move to leftmost element.
last()
Move to rightmost element.

The field selected is the selected element.

mkVList :: Constructor SindreX11M Source #

As mkHList, except the list is vertical. The parameter lines (default value 10) is the number of lines shown.

mkGraph :: Constructor SindreX11M Source #

A visual horisontal bar graph. Each data point is represented as a vertical bar. Accepts the following parameters:

size
The number of data points to remember (defaults to 10)
barWidth
The width (in pixels) of a single bar (defaults to 2).
bot
The lower bound of data points as an integer. If a point has this value (or below), it will be an empty bar.
bot
The upper bound of data points as an integer. If a point has this value (or above), it will be a full bar.

The following methods are supported:

insert(string)
Split string into lines and add each line as a data point. Each line must be an integer.