You are not logged in.
Hello im trying to Highlight workspaces containing copies in logHook
I was following this: http://xmonad.org/xmonad-docs/xmonad-co … indow.html
But i cant seem to figure out how to implement it with my loghook.
This is what i have so far:
(note "--<< FROM THE HAKEL..." lines)
myDzenStatus = myDzenbar1
myDzenLogHook h = dynamicLogWithPP $ myDzenPP h
copies <- wsContainingCopies --<< FROM THE HASKELL PAGE
myDzenPP h = dzenPP {
ppOutput = hPutStrLn h
, ppTitle = dzenColor (colorLook Green 0) "" . wrap "^ca(2,xdotool key super+shift+c)" "^ca()" . shorten 50
, ppCurrent = dzenColor (colorLook Green 1) "" . wrap "[" "]" . wrap "^ca(2,xdotool key alt+shift+c)" "^ca()"
, ppVisible = dzenColor (colorLook White 0) "" . wrap "(" ")"
-- , ppHidden = dzenColor (colorLook White 1) "" . wrap "" "" . noScratch
, ppHidden = check --<< FROM THE HASKEL PAGE
, ppOutput = hPutStrLn h --<< FROM THE HASKEL PAGE
, ppHiddenNoWindows = noScratchPad
, ppUrgent = dzenColor (colorLook Black 0) (colorLook Red 0) . wrap ">" "<" . dzenStrip
, ppLayout = dzenColor (colorLook Orange 0) "" . wrap "^ca(1,xdotool key super+space)^ca(3,xdotool key super+shift+space)" "^ca()^ca()"
, ppSep = " : "
, ppWsSep = " "
}
where
noScratch ws = if ws == "NSP" then "" else ws
noScratchPad ws = if ws == "NSP" then "" else ""
let check ws | ws `elem` copies = pad . dzenColor "red" "black" $ ws | otherwise = pad ws --<< FROM THE HASKEL PAGEWhen i restart xmonad, i receive this error:
xmonad.hs:328:8: parse error on input â<-â
Which is the line "copy <- wsContainingCopies". Please help.
This is my main
xmproc <- spawnPipe myDzenStatus
...
, logHook = myDzenLogHook xmprocAny input is apprecieated.
Thanks
Dave
Last edited by davama (2015-03-16 00:52:32)
Offline
The reason that you are getting the error is that you missed a line when you were copying it over.
sampleLogHook h = do
copies <- wsContainingCopiesThese lines are necessary in this order. Haskell is simply telling you that it has no effing idea what you want it to do with your copies line or where to put it.
Knute
Offline
These lines are necessary in this order. Haskell is simply telling you that it has no effing idea what you want it to do with your copies line or where to put it.
Thank you for replying.
A simple copy of that line does not do the trick. I had already tried that. Since i already have a working logHook, "myDzenLogHook", i was trying to implement it there.
How would i tell haskell to run that line with my current setup?
Thanks again
Offline
You would need to put your copies line up in your declarations at the beginning of the file.
After your import statements you may have a line similar to mine:
main = do
nScreens <- countScreens
dzen <- spawnPipe myStatusBarI believe that you would need to add your copies line after main = do where mine are.
As I have no formal training in haskell this is my best guess.
Knute
Offline
You would need to put your copies line up in your declarations at the beginning of the file.
I tried that here:
main = do
copies <- wsContainingCopies
....
, logHook = myDzenLogHook xmprocUnfortunately i can't figure where to place my "check" line
let check ws | ws `elem` copies = pad . dzenColor "red" "black" $ ws | otherwise = pad wsI tried placing it inside main after the copies line but "check" is not in scope.
As I have no formal training in haskell this is my best guess.
I appreciate the quick responses. Thank you.
Offline
It spells it out on the page:
sampleLogHook h = do
copies <- wsContainingCopies
let check ws | ws `elem` copies = pad . xmobarColor "red" "black" $ ws
| otherwise = pad ws
dynamicLogWithPP myPP {ppHidden = check, ppOutput = hPutStrLn h}
main = do
h <- spawnPipe "xmobar"
xmonad defaultConfig { logHook = sampleLogHook h }You will need to modify the above code to use both your sampleLogHook (that you are about to create) and your myDzenLogHook h.
So you would change the defaultConfig line to read something like:
xmonad defaultConfig { logHook = sampleLogHook h <+> myDzenLogHook h}I'm not sure if that's right or not, but you need to join them so that both will work with your logHook. It's either the <+> or the $. Haskell has so many different ways to join things I can't keep them all straight without looking it up. ![]()
HTH
Knute
Offline
It spells it out on the page:
You will need to modify the above code to use both your sampleLogHook (that you are about to create) and your myDzenLogHook h.
So you would change the defaultConfig line to read something like:
xmonad defaultConfig { logHook = sampleLogHook h <+> myDzenLogHook h}I'm not sure if that's right or not, but you need to join them so that both will work with your logHook. It's either the <+> or the $. Haskell has so many different ways to join things I can't keep them all straight without looking it up.
HTH
you sir, are a GENIUS!!
So that work but i didn't like the fact of having two separate loghooks. So i move into the new one. Here is the code:
myDzenStatus = myDzenbar1
myDzenLogHook h = do
copies <- wsContainingCopies
let check ws | ws `elem` copies = pad . dzenColor (colorLook Yellow 0) "" $ ws
| otherwise = pad ws
dynamicLogWithPP dzenPP {
ppOutput = hPutStrLn h
, ppTitle = dzenColor (colorLook Green 0) "" . wrap "^ca(2,xdotool key super+shift+c)" "^ca()" . shorten 50
, ppCurrent = dzenColor (colorLook Green 1) "" . wrap "[" "]" . wrap "^ca(2,xdotool key alt+shift+c)" "^ca()"
, ppVisible = dzenColor (colorLook White 0) "" . wrap "(" ")"
, ppHidden = dzenColor (colorLook White 1) "" . wrap "" "" . check . noScratch
, ppHiddenNoWindows = noScratchPad
, ppUrgent = dzenColor (colorLook Black 0) (colorLook Red 0) . wrap ">" "<" . dzenStrip
, ppLayout = dzenColor (colorLook Orange 0) "" . wrap "^ca(1,xdotool key super+space)^ca(3,xdotool key super+shift+space)" "^ca()^ca()"
, ppSep = " : "
, ppWsSep = " "
}
where
noScratch ws = if ws == "NSP" then "" else ws
noScratchPad ws = if ws == "NSP" then "" else ""My Main stayed the same:
main = do
xmproc <- spawnPipe myDzenStatus -- Dzenbar
, logHook = myDzenLogHook xmprocThanks Knute for your input.
Marking as Solved
Offline
You are most welcome.
And just so that you know, I suggested 2 hooks so that you could keep them separate. It's also why haskell has so many ways of linking things. ![]()
Anyway, I'm glad you got it fixed.
Knute
Offline