<div dir="ltr">Planton,<div>Thank you kindly!</div><div><br></div><div>I attempted to compile but with these results:</div><div><br></div><div>xmonad.hs:346:58: error:<br></div><div>    Ambiguous occurrence ‘stringColorizer’<br>    It could refer to<br>       either ‘XMonad.Actions.GridSelect.stringColorizer’,<br>              imported from ‘XMonad.Actions.GridSelect’ at xmonad.hs:46:1-32<br>           or ‘Main.stringColorizer’, defined at xmonad.hs:338:1<br>    |<br>346 | windowColorizer w active = runQuery className w >>= flip stringColorizer active<br>    |                                                          ^^^^^^^^^^^^^^^<br><br></div><div><br></div><div>So I updated that line to :</div><div><br></div><div><b>windowColorizer w active = runQuery className w >>= flip XMonad.Actions.GridSelect.stringColorizer active<br></b></div><div><br></div><div>but error:</div><div><br></div><div>xmonad.hs:331:25: error:<br>    • Variable not in scope:<br>        mix<br>          :: (Word8, Word8, Word8)<br>             -> (Word8, Word8, Word8) -> t0 -> (Word8, Word8, Word8)<br>    • Perhaps you meant one of these:<br>        ‘max’ (imported from Prelude), ‘min’ (imported from Prelude)<br>    |<br>331 |        else (rgbToHex $ mix startC endC<br>    |                         ^^^<br><br>xmonad.hs:332:16: error:<br>    Variable not in scope: stringToRatio :: Window -> t0<br>    |<br>332 |              $ stringToRatio str, rgbToHex inactiveT)<br>    |                ^^^^^^^^^^^^^<br><br>xmonad.hs:334:37: error:<br>    Variable not in scope: twodigitHex :: Word8 -> [Char]<br>    |<br>334 |            rgbToHex (r, g, b) = '#':twodigitHex r<br>    |                                     ^^^^^^^^^^^<br><br>xmonad.hs:335:35: error:<br>    Variable not in scope: twodigitHex :: Word8 -> [Char]<br>    |<br>335 |                                 ++twodigitHex g++twodigitHex b<br>    |                                   ^^^^^^^^^^^<br><br>xmonad.hs:335:50: error:<br>    Variable not in scope: twodigitHex :: Word8 -> [Char]<br>    |<br>335 |                                 ++twodigitHex g++twodigitHex b<br>    |                                                  ^^^^^^^^^^^<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 10, 2020 at 9:01 AM Platon Pronko <<a href="mailto:platon7pronko@gmail.com">platon7pronko@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi!<br>
<br>
You mean you want to reuse your `myColorizer` for spawnSelected, correct? Then you'll need to rewrite colorRangeFromClassName a bit, because that one expects Window and you have a String. Something like this may work (haven't compiled it, just copied&tweaked the source for colorRangeFromClassName):<br>
<br>
colorRangeFromString :: (Word8, Word8, Word8) -- ^ Beginning of the color range<br>
                      -> (Word8, Word8, Word8) -- ^ End of the color range<br>
                      -> (Word8, Word8, Word8) -- ^ Background of the active window<br>
                      -> (Word8, Word8, Word8) -- ^ Inactive text color<br>
                      -> (Word8, Word8, Word8) -- ^ Active text color<br>
                      -> Window -> Bool -> X (String, String)<br>
colorRangeFromString startC endC activeC inactiveT activeT str active =<br>
     if active<br>
       then (rgbToHex activeC, rgbToHex activeT)<br>
       else (rgbToHex $ mix startC endC<br>
             $ stringToRatio str, rgbToHex inactiveT)<br>
     where rgbToHex :: (Word8, Word8, Word8) -> String<br>
           rgbToHex (r, g, b) = '#':twodigitHex r<br>
                                ++twodigitHex g++twodigitHex b<br>
<br>
stringColorizer :: String -> Bool -> X (String, String)<br>
stringColorizer = colorRangeFromString<br>
                   (0x31,0x2e,0x39) -- lowest inactive bg<br>
                   (0x31,0x2e,0x39) -- highest inactive bg<br>
                   (0x78,0x3e,0x57) -- active bg<br>
                   (0xc0,0xa7,0x9a) -- inactive fg<br>
                   (0xff,0xff,0xff) -- active fg<br>
<br>
windowColorizer :: Window -> Bool -> X (String, String)<br>
windowColorizer w active = runQuery className w >>= flip stringColorizer active<br>
<br>
Best regards,<br>
Platon Pronko<br>
<br>
On 2020-08-10 15:13, Dave Macias wrote:<br>
> Thank you for the reply.<br>
> That helped me to figure it out.<br>
> But I had to create a separate *Colorizer*. (see below)<br>
> Is there a way to use the same colorizer as goToSelected?<br>
> Thanks!<br>
> <br>
> myGSFont            = "xft:Noto Sans CJK KR:bold:pixelsize=10"<br>
> myColorizer  :: Window -> Bool -> X (String, String)<br>
> myColorizer  = colorRangeFromClassName<br>
>                    (0x31,0x2e,0x39) -- lowest inactive bg<br>
>                    (0x31,0x2e,0x39) -- highest inactive bg<br>
>                    (0x78,0x3e,0x57) -- active bg<br>
>                    (0xc0,0xa7,0x9a) -- inactive fg<br>
>                    (0xff,0xff,0xff) -- active fg<br>
> <br>
> *gridColorizer :: a -> Bool -> X (String, String)<br>
> gridColorizer _ True = return ("#00aa00", "black")<br>
> gridColorizer _ False = return ("#333333", "#cccccc")*<br>
> <br>
> myGSConfig :: t -> GSConfig Window<br>
> myGSConfig colorizer = (buildDefaultGSConfig myColorizer)<br>
>      { gs_cellheight   = 30<br>
>      , gs_cellwidth    = 200<br>
>      , gs_cellpadding  = 6<br>
>      , gs_originFractX = 0.5<br>
>      , gs_originFractY = 0.5<br>
>      , gs_colorizer = myColorizer<br>
>      , gs_font         = myGSFont<br>
>      }<br>
> <br>
> -- spawnSelected Redefine<br>
> spawnSelected' :: [(String, String)] -> X ()<br>
> spawnSelected' lst = gridselect conf lst >>= flip whenJust spawn<br>
>      where conf = def<br>
>                     { gs_cellheight   = 30<br>
>                     , gs_cellwidth    = 200<br>
>                     , gs_cellpadding  = 6<br>
>                     , gs_originFractX = 0.5<br>
>                     , gs_originFractY = 0.5<br>
> *                  , gs_colorizer = gridColorizer<br>
> *                   , gs_font         = myGSFont<br>
>                    }<br>
> <br>
> <br>
>   , ((mod4Mask, xK_g), goToSelected  $ myGSConfig myColorizer)<br>
> * , ((mod4Mask, xK_y), spawnSelected' myAppGrid)<br>
> * , ((mod4Mask, xK_u), runSelectedAction (buildDefaultGSConfig gridColorizer)<br>
>                                          [ ("Chromium", spawnHere "chromium")<br>
>                                          , ("Hexchat", spawnHere "hexchat")<br>
> <br>
> On Sat, Aug 8, 2020 at 8:46 AM Platon Pronko <<a href="mailto:platon7pronko@gmail.com" target="_blank">platon7pronko@gmail.com</a> <mailto:<a href="mailto:platon7pronko@gmail.com" target="_blank">platon7pronko@gmail.com</a>>> wrote:<br>
> <br>
>     Hi!<br>
> <br>
>     Your spawnSelected' has one argument [(String, String)], but you try to invoke it with two - myAppGrid and winconfig. I'd remove winconfig argument and instead stick it into gs_colorizer field in your GSConfig constructor.<br>
> <br>
>     Best regards,<br>
>     Platon Pronko<br>
> <br>
>     On 2020-08-07 17:13, Dave Macias wrote:<br>
>      > Hello,<br>
>      ><br>
>      > Apologies for the repost....i had posted here: <a href="https://www.reddit.com/r/xmonad/comments/hvaug9/xagridselect_spawnselected_colorized/" rel="noreferrer" target="_blank">https://www.reddit.com/r/xmonad/comments/hvaug9/xagridselect_spawnselected_colorized/</a> but no response for some time now. So I want to try here.<br>
>      ><br>
>      > Basically, I am trying to custom colorize spawnSelected grid apps.<br>
>      > I was able to do this with goToSelected and I really like the color scheme.<br>
>      ><br>
>      > Was hoping to use the same color scheme that i use for goToSelected applied to spawnSelected.<br>
>      ><br>
>      > Any input is much appreciated!<br>
>      ><br>
>      > Stay safe.<br>
>      ><br>
>      > -Dave<br>
>      ><br>
>      > _______________________________________________<br>
>      > xmonad mailing list<br>
>      > <a href="mailto:xmonad@haskell.org" target="_blank">xmonad@haskell.org</a> <mailto:<a href="mailto:xmonad@haskell.org" target="_blank">xmonad@haskell.org</a>><br>
>      > <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad</a><br>
>      ><br>
>     _______________________________________________<br>
>     xmonad mailing list<br>
>     <a href="mailto:xmonad@haskell.org" target="_blank">xmonad@haskell.org</a> <mailto:<a href="mailto:xmonad@haskell.org" target="_blank">xmonad@haskell.org</a>><br>
>     <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad</a><br>
> <br>
</blockquote></div>