License | MIT-style (see LICENSE) |
---|---|
Stability | provisional |
Portability | unportable |
Safe Haskell | None |
Language | Haskell2010 |
X11 backend for Sindre. For internationalised keyboard input to work, make sure the locale is correctly set.
Synopsis
- data SindreX11M a
- data SindreX11Conf
- sindreX11override :: String -> SindreX11M ExitCode -> IO ExitCode
- sindreX11dock :: String -> SindreX11M ExitCode -> IO ExitCode
- sindreX11 :: String -> SindreX11M ExitCode -> IO ExitCode
- xopt :: Param SindreX11M a => Maybe String -> String -> String -> ConstructorM SindreX11M a
- data VisualOpts = VisualOpts {
- foreground :: Color
- background :: Color
- focusForeground :: Color
- focusBackground :: Color
- font :: Font
- visualOpts :: WidgetRef -> ConstructorM SindreX11M VisualOpts
- allocColor :: (MonadIO m, MonadFail m) => XftMgr -> String -> m Color
- drawing :: VisualOpts -> (Rectangle -> Drawer -> Drawer -> ObjectM a SindreX11M [Rectangle]) -> Rectangle -> ObjectM a SindreX11M SpaceUse
- drawing' :: VisualOpts -> (Rectangle -> Drawer -> Drawer -> ObjectM a SindreX11M ()) -> Rectangle -> ObjectM a SindreX11M SpaceUse
- type X11Field s = FieldDesc s SindreX11M
- data Drawer = Drawer {
- fg :: forall f. CoreDrawer f
- bg :: forall f. CoreDrawer f
- drawerFont :: Font
- drawerFgColor :: Color
- drawerBgColor :: Color
- setFgColor :: Drawer -> Color -> IO Drawer
- setBgColor :: Drawer -> Color -> IO Drawer
- textExtents :: Font -> String -> SindreX11M (Int, Int)
- drawText :: (Integral x, Integral y, Integral z) => Color -> Font -> x -> y -> z -> String -> SindreX11M ()
- mkDial :: Constructor SindreX11M
- mkLabel :: Constructor SindreX11M
- mkBlank :: Constructor SindreX11M
- mkTextField :: Constructor SindreX11M
- mkInStream :: Handle -> ObjectRef -> SindreX11M (NewObject SindreX11M)
- mkHList :: Constructor SindreX11M
- mkVList :: Constructor SindreX11M
- mkGraph :: Constructor SindreX11M
Documentation
data SindreX11M a Source #
Sindre backend using Xlib.
Instances
data SindreX11Conf Source #
The read-only configuration of the X11 backend, created during backend initialisation.
Instances
MonadReader SindreX11Conf SindreX11M Source # | |
Defined in Sindre.X11 ask :: SindreX11M SindreX11Conf # local :: (SindreX11Conf -> SindreX11Conf) -> SindreX11M a -> SindreX11M a # reader :: (SindreX11Conf -> a) -> SindreX11M a # |
:: String | The display string (usually the value of the
environment variable |
-> SindreX11M ExitCode | The function returned by
|
-> IO ExitCode |
Execute Sindre in the X11 backend, grabbing control of the entire display and staying on top.
:: String | The display string (usually the value of the
environment variable |
-> SindreX11M ExitCode | The function returned by
|
-> IO ExitCode |
Execute Sindre in the X11 backend as a dock/statusbar.
:: String | The display string (usually the value of the
environment variable |
-> SindreX11M ExitCode | The function returned by
|
-> IO ExitCode |
Execute Sindre in the X11 backend as an ordinary client visible to the window manager.
:: Param SindreX11M a | |
=> Maybe String | Name of widget, using |
-> 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 | |
|
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 orforeground
X property. Background color
- From
bg
parameter orbackground
X property. Focus foreground color
- From
ffg
parameter orfocusForeground
X property. Focus background color
- From
fbg
parameter orfocusBackground
X property.
:: VisualOpts | |
-> (Rectangle -> Drawer -> Drawer -> ObjectM a SindreX11M [Rectangle]) | The body of the |
-> 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.
type X11Field s = FieldDesc s SindreX11M Source #
Drawer | |
|
textExtents :: Font -> String -> SindreX11M (Int, Int) Source #
drawText :: (Integral x, Integral y, Integral z) => Color -> Font -> x -> y -> z -> String -> SindreX11M () Source #
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.