[xmonad] X.A.GridSelect spawnSelected colorized
Dave Macias
davama at gmail.com
Mon Aug 10 13:14:54 UTC 2020
Planton,
Thank you kindly!
I attempted to compile but with these results:
xmonad.hs:346:58: error:
Ambiguous occurrence ‘stringColorizer’
It could refer to
either ‘XMonad.Actions.GridSelect.stringColorizer’,
imported from ‘XMonad.Actions.GridSelect’ at xmonad.hs:46:1-32
or ‘Main.stringColorizer’, defined at xmonad.hs:338:1
|
346 | windowColorizer w active = runQuery className w >>= flip
stringColorizer active
|
^^^^^^^^^^^^^^^
So I updated that line to :
*windowColorizer w active = runQuery className w >>= flip
XMonad.Actions.GridSelect.stringColorizer active*
but error:
xmonad.hs:331:25: error:
• Variable not in scope:
mix
:: (Word8, Word8, Word8)
-> (Word8, Word8, Word8) -> t0 -> (Word8, Word8, Word8)
• Perhaps you meant one of these:
‘max’ (imported from Prelude), ‘min’ (imported from Prelude)
|
331 | else (rgbToHex $ mix startC endC
| ^^^
xmonad.hs:332:16: error:
Variable not in scope: stringToRatio :: Window -> t0
|
332 | $ stringToRatio str, rgbToHex inactiveT)
| ^^^^^^^^^^^^^
xmonad.hs:334:37: error:
Variable not in scope: twodigitHex :: Word8 -> [Char]
|
334 | rgbToHex (r, g, b) = '#':twodigitHex r
| ^^^^^^^^^^^
xmonad.hs:335:35: error:
Variable not in scope: twodigitHex :: Word8 -> [Char]
|
335 | ++twodigitHex g++twodigitHex b
| ^^^^^^^^^^^
xmonad.hs:335:50: error:
Variable not in scope: twodigitHex :: Word8 -> [Char]
|
335 | ++twodigitHex g++twodigitHex b
| ^^^^^^^^^^^
On Mon, Aug 10, 2020 at 9:01 AM Platon Pronko <platon7pronko at gmail.com>
wrote:
> Hi!
>
> 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):
>
> colorRangeFromString :: (Word8, Word8, Word8) -- ^ Beginning of the color
> range
> -> (Word8, Word8, Word8) -- ^ End of the color range
> -> (Word8, Word8, Word8) -- ^ Background of the
> active window
> -> (Word8, Word8, Word8) -- ^ Inactive text color
> -> (Word8, Word8, Word8) -- ^ Active text color
> -> Window -> Bool -> X (String, String)
> colorRangeFromString startC endC activeC inactiveT activeT str active =
> if active
> then (rgbToHex activeC, rgbToHex activeT)
> else (rgbToHex $ mix startC endC
> $ stringToRatio str, rgbToHex inactiveT)
> where rgbToHex :: (Word8, Word8, Word8) -> String
> rgbToHex (r, g, b) = '#':twodigitHex r
> ++twodigitHex g++twodigitHex b
>
> stringColorizer :: String -> Bool -> X (String, String)
> stringColorizer = colorRangeFromString
> (0x31,0x2e,0x39) -- lowest inactive bg
> (0x31,0x2e,0x39) -- highest inactive bg
> (0x78,0x3e,0x57) -- active bg
> (0xc0,0xa7,0x9a) -- inactive fg
> (0xff,0xff,0xff) -- active fg
>
> windowColorizer :: Window -> Bool -> X (String, String)
> windowColorizer w active = runQuery className w >>= flip stringColorizer
> active
>
> Best regards,
> Platon Pronko
>
> On 2020-08-10 15:13, Dave Macias wrote:
> > Thank you for the reply.
> > That helped me to figure it out.
> > But I had to create a separate *Colorizer*. (see below)
> > Is there a way to use the same colorizer as goToSelected?
> > Thanks!
> >
> > myGSFont = "xft:Noto Sans CJK KR:bold:pixelsize=10"
> > myColorizer :: Window -> Bool -> X (String, String)
> > myColorizer = colorRangeFromClassName
> > (0x31,0x2e,0x39) -- lowest inactive bg
> > (0x31,0x2e,0x39) -- highest inactive bg
> > (0x78,0x3e,0x57) -- active bg
> > (0xc0,0xa7,0x9a) -- inactive fg
> > (0xff,0xff,0xff) -- active fg
> >
> > *gridColorizer :: a -> Bool -> X (String, String)
> > gridColorizer _ True = return ("#00aa00", "black")
> > gridColorizer _ False = return ("#333333", "#cccccc")*
> >
> > myGSConfig :: t -> GSConfig Window
> > myGSConfig colorizer = (buildDefaultGSConfig myColorizer)
> > { gs_cellheight = 30
> > , gs_cellwidth = 200
> > , gs_cellpadding = 6
> > , gs_originFractX = 0.5
> > , gs_originFractY = 0.5
> > , gs_colorizer = myColorizer
> > , gs_font = myGSFont
> > }
> >
> > -- spawnSelected Redefine
> > spawnSelected' :: [(String, String)] -> X ()
> > spawnSelected' lst = gridselect conf lst >>= flip whenJust spawn
> > where conf = def
> > { gs_cellheight = 30
> > , gs_cellwidth = 200
> > , gs_cellpadding = 6
> > , gs_originFractX = 0.5
> > , gs_originFractY = 0.5
> > * , gs_colorizer = gridColorizer
> > * , gs_font = myGSFont
> > }
> >
> >
> > , ((mod4Mask, xK_g), goToSelected $ myGSConfig myColorizer)
> > * , ((mod4Mask, xK_y), spawnSelected' myAppGrid)
> > * , ((mod4Mask, xK_u), runSelectedAction (buildDefaultGSConfig
> gridColorizer)
> > [ ("Chromium", spawnHere
> "chromium")
> > , ("Hexchat", spawnHere
> "hexchat")
> >
> > On Sat, Aug 8, 2020 at 8:46 AM Platon Pronko <platon7pronko at gmail.com
> <mailto:platon7pronko at gmail.com>> wrote:
> >
> > Hi!
> >
> > 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.
> >
> > Best regards,
> > Platon Pronko
> >
> > On 2020-08-07 17:13, Dave Macias wrote:
> > > Hello,
> > >
> > > Apologies for the repost....i had posted here:
> https://www.reddit.com/r/xmonad/comments/hvaug9/xagridselect_spawnselected_colorized/ but
> no response for some time now. So I want to try here.
> > >
> > > Basically, I am trying to custom colorize spawnSelected grid apps.
> > > I was able to do this with goToSelected and I really like the
> color scheme.
> > >
> > > Was hoping to use the same color scheme that i use for
> goToSelected applied to spawnSelected.
> > >
> > > Any input is much appreciated!
> > >
> > > Stay safe.
> > >
> > > -Dave
> > >
> > > _______________________________________________
> > > xmonad mailing list
> > > xmonad at haskell.org <mailto:xmonad at haskell.org>
> > > http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
> > >
> > _______________________________________________
> > xmonad mailing list
> > xmonad at haskell.org <mailto:xmonad at haskell.org>
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/xmonad/attachments/20200810/72b9340e/attachment-0001.html>
More information about the xmonad
mailing list