ϊΞγέέ‰[      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ&semi-portable (MPTC and type families) experimentalfelipe.lessa@gmail.com Transform is a specialization of Functor for DStrings. 5 This class is used for functions that may receive DString  or  Printer a* as an argument because they operate only A on their outputs and internal states (and not on the inputs). (So, whenever you see a function of type  / func :: Transform a => Blah -> Bleh -> a -> a it means that func can be used in two ways:  , func :: Blah -> Bleh -> DString -> DString J func :: Blah -> Bleh -> Printer a -> Printer a -- Printer of any input! 1Try to have this in mind when reading the types. #Note: There is also a non-exported  transformSt for < transforming the state in this class, otherwise it would * be meaningless to use a class only for  transform (it  would be better to make liftT :: (DString -> DString)  -> (Printer a -> Printer a)). This function is [ on DString and  modifies the output of a  Printer a. \<A printer is used when the output depends on an input, so a   Printer a generates a  based on some input of  type a- (and possibly updates some internal state). ]^A DString) is used for constant string output, see str.  The D on DString stands for dzen, as these strings . may change depending on the state (and that' s why you  shouldn' t rely on _", as it just uses an empty state) `a Our colours. b;The internal state we maintain. Currently it only contains ; the foreground and the background colours and if we are # ignoring the background or not. #This state is passed around like a Reader monad, each ; function receives it and does whatever it want, and not  like a State monad! cdefg Empty state. h Converts a String into a DString without escaping anything.  You really don't need to use this, trust me!  Converts a DString back into a String . Note that  (toString . rawStr) is not id , otherwise toString ! would not work in some cases.  Probably you don'$t need to use this, unless you want 1 something like a static bar and nothing else. -Tries to get the number of characters of the DString.  May return Nothing# when there are graphical objects.  Probably you don't need to use this function. imkCmd graph cmd arg creates a command string like  " ^cmd(arg)". If graph is False then we give length zero  to the resulting DString, otherwise we don't give a length C (which propagates for strings concatenated to this). You should  use False whenever possible. 3Apply a printer to an appropriate input, returning * the output string and the new printer. \]^`abcdefi\\]^]^`a`abcdefcdefi&semi-portable (MPTC and type families) experimentalfelipe.lessa@gmail.com Class used for combining DStrings and Printers  exactly like j. Note that we don't lift DString to  Printer () and use a  plain function of type Printer a -> Printer b  -> Printer (a,b)) because that would create types such as  Printer ((),(a,((),(b,())))) instead of   Printer (a,b). "The type of the combined input of a with b. Combine a into b". Their outputs are concatenated.  Converts a String into a DString, escaping characters if $ needed. This function is used in k from l,  so DString s created by OverloadedStrings extension will  be escaped. mUsed internally, use j. parens open close d is equivalent to mconcat [open, d, close]. A Printer is a cofunctor.  Constructs a Printer! that depends only on the input. Like  , but using Strings.  Constructs a Printer that depends on the current  and on the previous inputs. Like  , but with Strings.  Works like  &, but uses the input instead of being ' constant. In fact, it is defined as  simple str. Same as simple' show. 7Sometimes you want two printers having the same input,  but p1 +++ p2 :: Printer (a,a) is not convenient. So  p1 +=+ p2 :: Printer a works like   but gives % the same input for both printers.  Works like  but the second printer's input is a tuple. While you may say p1 +=+ (ds1 +++ ds2 +++ p2),  where p1,p2 :: Printer a and ds1,ds2 :: DString,  you can't say p1 +=+ (po +++ p2) nor  (p1 +++ po) +=+ p2 where po :: Printer b. This operator works like   but shifts the  tuple, giving you  Printer (b,a) instead of   Printer (a,b). In the example above you may  write  p1 +>+ po +/+ p2. This operator works like  but the second  printer' s input is a tuple. Use it like  ; pA1 +-+ pB +<+ pC +<+ pD +/+ pA2 :: Printer (a,(b,(c,d)))  where both pA1 and pA2 are of type  Printer a. 'This is a general combine function for Printers. 7 The outputs are always concatenated, but the inputs ' are given by the supplied function. .The combining operators above are defined as:  1 (+++) = combine id -- restricted to Printers $ (+=+) = combine (\x -> ( x, x)) $ (+-+) = combine (\x -> (fst x, x)) ' (+/+) = combine (\(a,b) -> (b,a)) + (+<+) = combine (\(b,(a,c)) -> (a,(b,c))) Note also the resamblence with  . In fact,  if we have (+++) and comap we may define  6 combine f a b = comap f (a +++ b) -- pointwise 6 combine = flip (.) (+++) . (.) . comap -- pointfree  and with combine and simple we may define J comap f = combine (\i -> ((), f i)) (simple $ const mempty) -- pointwise J comap = flip combine (simple $ const mempty) . ((,) () .) -- pointfree 4Apply a printer many times in sequence. Most of the 1 time you would ignore the final printer using  +, but it can be used to continue applying. Like ! but ignoring the final printer. 9Apply a printer forever inside a monad. The first action 9 is used as a supply of inputs while the second action ; receives the output before the next input is requested. 4Note that your supply may be anything. For example,  inside IO you may use  threadDelay: E applyForever (threadDelay 100000 >> getInfo) (hPutStrLn dzenHandle)       +semi-portable (uses MPTC and type families) experimentalfelipe.lessa@gmail.com 4Set the foreground colour. Note that the foreground 1 colour is changed only inside the transformed DString  or Printer, unlike using "^fg" which may affect  subsequent strings. So you may write  fg black (fg lime (str "lime" ) +++ str "black") ' and it works like you expect it to. Like !, but set the background colour. 1Set the foreground colour to be the default one, 6 which is specified as a parameter to dzen (outside ! the control of the printers). Like !, but for the background colour. !*Set the foreground to be a specified one (Just c) or  the dzen' s default (Nothing). Both  and  ) are specializations of this function. "Like !!, but for the background colour. n  with steroids. oChange the foreground colour. pChange the background colour. qLift r.  !" !" !"+semi-portable (uses MPTC and type families) experimentalfelipe.lessa@gmail.com #$%&Draws an icon. 'rect w h& draws and fills a rectangle of width w  and height h'. The rectangle is vertically centered  (that is, if h == 1 then it is a centered line,  something like ----). (Like rect*, but only draws and does not fills (i.e.  draws an outline). s Internal. )circ r# draws and fils a circle of radius r, also  vertically centered. *Like circ, but does not fills. +pos p& moves the position of the next input p pixels  to the right. Note that p may be negative, effectively  moving to the right. ,absPos p, moves the position of the next input to be  exactly p. pixels to the right of the initial position. " This should be used with care. -If True, the transformed DString or Printer will = ignore the background colour (i.e. it will draw over what & was already drawn). The default is False, the background  colour is used. #$%&'()*+,- %$#&'()*+,- #$%&'()*+,-+semi-portable (uses MPTC and type families) experimentalfelipe.lessa@gmail.com .%Where to add the padding characters. /012Pads the given DString or Printer output  with spaces to be at least n chars in length 3Same as 20, but insert spaces on the right of the string. 4Same as 2#, but insert spaces on both sides, 7 trying to keep the original contents in the middle. 51Generic pad function, padding with any character  and in any place. 6Automatic padding for 2. 7Automatic padding for 3. 8Automatic padding for 4. 9.Generic automatic padding function, analog to 5. ./0123456789 2345.10/6789 .10//0123456789+semi-portable (uses MPTC and type families) experimentalfelipe.lessa@gmail.com#:How to draw the bar text. AtLeft and AtRight are used to ? specify if the text is at the left or the right of the bar,  and None% means that no text will be written. ;<=> The type of text to be written. ?@A!The type of the bar to be drawn. B0Draws a filled graphical bar with a surrounding  border. CColour of the border, or Nothing to use  the default  foreground colour. D#Draws a filled graphical bar, like gdbar would. ESame as  grpFilled above. FSame as  grpBackground above. G*Size of the whole bar (including border). H*Draws a text bar. Note, however, that the  DString"s below can be anything, not just , text. For example, they may have colours (),  shapes ('s and )s) or & s, you may  even simulate both D and B using just  H- (although performance would be suboptimal). IText written at the start. J%Text written for each filled square. K)Text written for the last filled square.  If Nothing , the same as the filled square - is used, but more fairly than if you used / the same value for filled and middle chars. L'Text written for the unfilled squares. MText written at the end. N!How many squares there should be 3 (i.e. does not count the open and close parts). tHelper function used below. O"Mimics the dbar utility. Uses the Q. If True$, write the percentage on the left. Width of the bar interior. Minimum and maximum values. Actual value. P=Mimics the dbar utility while getting the input dinamically. Q(The style produced by the dbar utility. R#Mimics the gdbar utility. Uses the T. If True$, write the percentage on the left. (Size of the whole bar (excluding text). Filled colour (see E).  Background/border colour  (see F and C). True to mimic -o option (outline). Minimum and maximum values. Actual value. S>Mimics the gdbar utility while getting the input dinamically. T.The style of gdbar (or something very close). U>Draws a bar and optionally some text describing some quantity + in relation to some range. For example,  I bar (AtLeft Percentage) (Text "[" "=" (Just ">") " " "]" 20) (-10,10) i produces the bars  1 " 2% [ ]" where i = -9.6 1 " 2% [> ]" where i = -9.5 . " 50% [=========> ]" where i = 0 0 " 96% [==================> ]" where i = 9.4 1 " 99% [===================>]" where i = 9.99 / "100% [====================]" where i = 10 ?Note that the text is always padded to four characters. If the  first bar above had AtRight Percentage the result would be   "[ ] 2% " 9so the padding always inserts the spaces on the outside. VU wrapped with  so that the value is  taken from an input. u Draws the text part of the bar. vDraws the bar itself. w.Simulates transparency by not drawing at all. x;Function used for rounding. It always rounds towards minus 9 infinity, so only the maximum value gives a full bar. > Values outside the range are clamped. The boolean returned  is True/ iff the value would be one more if we rounded  half-up. y:;<=>?@ABCDEFGHIJKLMNOPQRSTUV OPRSUVAHDBIJKLMNEFGEFCG>@?:=<;QT:=<;;<=>@??@AHDBIJKLMNEFGEFCGBCDEFGHIJKLMNOPQRSTUV+semi-portable (uses MPTC and type families) experimentalfelipe.lessa@gmail.comWPipes a  to a fresh instance of dzen . It runs  the following commands:   Start dzen- with the supplied executable and arguments. " Call the supply to get an input. ! Apply the input to the printer.  Write the printer' s output to dzen's standard input. & Sleeps for the specified delay using z.  Go back to step 2. +You may want to use this function inside a { if,  for example, you' re inside xmonad. Path to dzen executable, probably "dzen2" Arguments for dzen. 4Delay between suplies in milliseconds. May be zero. Printer to be used. Supply of inputs. XThis is the same as  liftM2 (,), but with as a convenient - operator with right infixity (the same as  ). For example,  suppose you have printers   prA :: Printer a  prB :: Printer b  prC :: Printer c and supply functions   getA :: m a  getB :: m b  getC :: m c for some monad m. The final printer   prFinal = prA +++ prB +++ prC will be of type Printer (a,(b,c)), so you may use  as its supply function  ! getFinal = getA ## getB ## getC which is of type  m (a,(b,c)). YRuns a dzen instance and returns its stdin pipe.  Both stdout and stderr of the new process will  be the same as this process'. The pipe returned is  already line buffered. 3The first string is interpreted as a shell command  to start dzen. Some examples of usage: ( createDzen (RawCommand "dzen2" ["-p"]) 4 createDzen (ShellCommand "dzen2 -l 8 -bg #331100") ZLike  createDzen*, but never uses a shell (which is good). dzen executable, likely "dzen2"  Arguments to dzen. WXYZWXYZWXYZ+semi-portable (uses MPTC and type families) experimentalfelipe.lessa@gmail.com[  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ|      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghidjklmnopqrstudvwdxydxz{|}~€‚ƒ„…†‡ˆ‰dŠ‹dŒŽdzen-utils-0.1System.Dzen.BaseSystem.Dzen.ColourSystem.Dzen.GraphicsSystem.Dzen.PaddingSystem.Dzen.BarsSystem.Dzen.ProcessSystem.Dzen.Internal System.Dzen Transform transformPrinterDStringDColourrawStrtoStringsizeapplyCombineCombined+++strparenscomapsimplesimple' inputPrinter inputPrinter'cstrcshow+=++-++/++<+combine applyMany applyMany_ applyForeverfgbgdefFgdefBgchangeFgchangeBgRadiusHeightWidthiconrectrectOcirccircOposabsPosignoreBgPadWhere PadCenterPadRightPadLeftpadLpadRpadCpadautoPadLautoPadRautoPadCautoPadBarTextNoneAtRightAtLeft BarTextTypeAbsolute PercentageBarTypeHollow grpBorderFilled grpFilled grpBackgroundgrpSizeTexttxtOpen txtFilled txtMiddle txtBackgroundtxtClosetxtWidthdbarcdbar dbar_stylegdbarcgdbar gdbar_stylebarcbarrunDzen## createDzen createDzen'baseGHC.Baseid transformStPunPGHC.ShowShowDSunDSDStSsFgsBg sIgnoreBg emptyStateescapemkCmd Data.Monoidmappend Data.String fromStringIsString++parensFshowFgshowBg fromColour colour-2.3.1Data.Colour.SRGB sRGB24showsmkCmdX maybeLeftbarTextbarDraw transpRectbarRound barRound' GHC.Conc.IO threadDelay GHC.Conc.SyncforkIO