You are not logged in.
Just for curiosity, it may be a little offtopic and I know I may be flamed but, as a functional programming language, which avoids side effects, doesn't Xmonad go against Haskell style?
Just for curiosity.
I'm also known as zmv on IRC.
Offline
Just for curiosity, it may be a little offtopic and I know I may be flamed but, as a functional programming language, which avoids side effects, doesn't Xmonad go against Haskell style?
Just for curiosity.
Why would it? The whole point of haskell being a purely functional language is that there aren't any side effects. The things peceived as side effects are handled in some kind of functional way (one that I don't grok yet—monads and their relatives, probably).
Edit: By the way, count—I came up with the exact same way to switch workspaces entirely in xmonad.hs, and man, was I ever proud of it… Until I recompiled and got some weird kind of type error I couldn't resolve for the life of me. I guess I'll just copypaste.
Edit2: Thanks for the socat idea. *rubs hands with glee*
Last edited by Runiq (2010-07-28 15:54:51)
Offline
Edit: By the way, count—I came up with the exact same way to switch workspaces entirely in xmonad.hs, and man, was I ever proud of it… Until I recompiled and got some weird kind of type error I couldn't resolve for the life of me. I guess I'll just copypaste.
It's pretty sensitive to where you apply the mapping of keys. I started using code from the actual PP module to insert the mapping way up the tree but it resulted in nonsense because the workspaces hadn't been sorted yet.
Edit2: Thanks for the socat idea. *rubs hands with glee*
No problem. If you're gaining on that, please let us know. I'm pretty sure it won't take more than an afternoon to figure out the details but everytime I remember I wanted to do it, I have like 15mins of time
I never felt comfortable with running shell scripts for all the data I need displayed. And running multiple instances of conky defeats the whole purpose of conky. Socat seems an elegant way to solve this and add the possibility to create cool submenus in dzen.
I also had this strange idea last night about dzen and trayer. What if we integrated trayer's behavior into dzen? I imagine a ^tray() command that just catches systray icons and dynamically expands from 0px width to whatever space necessary. Shouldn't be too hard to do. Gotmor? I haven't yet found a clever way to handle a tray within xmonad and dzen.
Offline
Take a look at this
data ThinkLightUrgencyHook = ThinkLightUrgencyHook
{ blinks :: Int -- ^ number of times to blink the thinklight
}
deriving (Read, Show)
instance UrgencyHook ThinkLightUrgencyHook where
urgencyHook ThinkLightUrgencyHook { blinks = d } w = do
spawn ("thinkalert " ++ show d)
return ()
myUrgencyHook = withUrgencyHook ThinkLightUrgencyHook
{ blinks = 2 }
It's an urgenthook that flashes the thinklight of Thinkpad laptops (thinkalert has to be installed of course). In my case, the LED flashes two times whenever something urgent happens. It should be easy to adapt this to other laptops or systems.
Last edited by count-corrupt (2010-07-28 19:07:26)
Offline
Just for curiosity, it may be a little offtopic and I know I may be flamed but, as a functional programming language, which avoids side effects, doesn't Xmonad go against Haskell style?
Just for curiosity.
No way! I definitely won't flame you though, as that's a very good question.
A simple way to think about how Haskell handles state and IO is that it takes an initial "world"(in XMonad this is the empty screen you encounter when you log in) and passes it as an argument to functions that include a new "world" in their output(in XMonad these functions would be opening a new window, closing a window, shifting windows, etc). After a world is 'used'(had a function applied to it), it disappears, never to be seen/heard from again, and only the new world remains. This new world is then in turn fed as the input to those same functions and the process repeats. This way, the content of any particular world cannot change once it is created and functions always produce the same output given the same input(a core idea behind Haskell). One of the many things the infamous Monad provides is a framework to encapsulate IO so the programmer doesn't have to explicitely keep passing these worlds around their functions themselves. Hopefully that made sense.
Oh yeah, and in a last ditch attempt to stay on topic, here's my xmonad.hs.
http://pastebin.com/eJe7KpsA
Offline
Oh yeah, and in a last ditch attempt to stay on topic, here's my xmonad.hs. :Phttp://pastebin.com/eJe7KpsA
Those list generators in your manageHook are pretty cool. I'll adapt my config to that.
Offline
splittercode wrote:Oh yeah, and in a last ditch attempt to stay on topic, here's my xmonad.hs. :Phttp://pastebin.com/eJe7KpsA
Those list generators in your manageHook are pretty cool. I'll adapt my config to that.
All credit to brisbin33 on that one, I never would have thought to do that had I not seen his config.
http://pbrisbin.com:8080/pages/dots.htm … _xmonad.hs
Offline
Runiq wrote:Edit: By the way, count—I came up with the exact same way to switch workspaces entirely in xmonad.hs, and man, was I ever proud of it… Until I recompiled and got some weird kind of type error I couldn't resolve for the life of me. I guess I'll just copypaste.
It's pretty sensitive to where you apply the mapping of keys. I started using code from the actual PP module to insert the mapping way up the tree but it resulted in nonsense because the workspaces hadn't been sorted yet.
I finally figured it out. Thanks again!
Offline
count-corrupt wrote:splittercode wrote:Oh yeah, and in a last ditch attempt to stay on topic, here's my xmonad.hs. :Phttp://pastebin.com/eJe7KpsA
Those list generators in your manageHook are pretty cool. I'll adapt my config to that.
All credit to brisbin33 on that one, I never would have thought to do that had I not seen his config.
http://pbrisbin.com:8080/pages/dots.htm … _xmonad.hs
hey thanks for that callout!
i also like this one from yours:
[ ((0, x), namedScratchpadAction genScratchPads y) | (x,y) <- zip [xK_F12, xK_F11..xK_F1] myScratchPadNames ]
one note though, X.U.NamedScratchPad also exports the free accessor function 'name' because the NS datatype is defined in record syntax. this means you could use it in myScratchPadNames (or place it directly in the above)
myScratchPadNames = map name myScratchPads
(i hope that's all accurate -- bit of a haskell noob myself)
Last edited by brisbin33 (2010-07-29 14:10:54)
//github/
Offline
one note though, X.U.NamedScratchPad also exports the free accessor function 'name' because the NS datatype is defined in record syntax. this means you could use it in myScratchPadNames (or place it directly in the above)
myScratchPadNames = map name myScratchPads
Nice idea! I just added it directly to the key binding, works like a charm.
(i hope that's all accurate -- bit of a haskell noob myself)
Yeah, me too. Haskell makes everyone feel like a noob I think
Offline
brisbin33 wrote:(i hope that's all accurate -- bit of a haskell noob myself)
Yeah, me too. Haskell makes everyone feel like a noob I think
It's not even that much feeling as a noob as it is forgetting the details of the language. Haskell can do so many things in so many ways that almost everytime there's an even cleaner or more elegant solution to a problem. I've heard a whole lecture about it and still feel like I'm just touching the surface.
Anyway, I've adapted my Managehook and it now looks like this
myManageHook = (composeAll . concat $
[ [className =? c --> doF (W.shift "web") | c <- myWebs]
, [className =? c --> doF (W.shift "img") | c <- myImgs]
, [className =? c --> doF (W.shift "IM") | c <- myIms]
, [className =? c --> doF (W.shift "fm") | c <- myFms]
, [className =? c --> doF (W.shift "laut") | c <- myLauts]
, [className =? c --> doF (W.swapDown) | c <- mySwapDowns]
, [className =? c --> doFloat | c <- myFloats]
]) <+> mySpecialHooks
where
myWebs = ["Firefox"]
myImgs = ["Gimp","Gimp-2.6"]
myIms = ["Pidgin","Skype"]
myFms = ["pcmanfm","Krusader","Dolphin"]
myLauts = ["Amarok"]
mySwapDowns = ["Skype","Pidgin"]
myFloats = ["Truecrypt","."]
mySpecialHooks = composeAll
[ (role =? "gimp-toolbox" <||> role =? "gimp-image-window" <||> role =? "gimp-dock") --> (ask >>= doF . W.sink)
, name =? "Copying" --> doCenterFloat -- Krusader copy dialog
, isFullscreen --> doFullFloat -- fullscreen flash and stuff
, transience' -- focus parent windows of transient ones
]
role = stringProperty "WM_WINDOW_ROLE"
name = stringProperty "WM_NAME"
Which is way more elegant than my previous approach.
Offline
Hi,
I've been using XMonad on arch for a few months now, and i really love it, but i've been seeing quite a lot of latency (almost half a second!) when doing anything with windows (switching,reordering etc). After a bit of playing, i traced it back to the dock manager (XMonad.Hooks.ManageDocks), and specifically avoidStruts, for example, the following minimal config shows the problem:
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import System.IO
myDock = "killall trayer; trayer --SetPartialStrut true --height 8 --widthtype request --align right --edge top --transparent true --tint 0x000000"
myTerminal = "xterm -bg black -fg white"
myModMask = mod4Mask
main = do
xmproc <- spawnPipe "xmobar"
spawn myDock
xmonad $ defaultConfig
{ manageHook = manageDocks <+> manageHook defaultConfig
, layoutHook = avoidStruts $ layoutHook defaultConfig
, logHook = dynamicLogWithPP $ xmobarPP
{ ppOutput = hPutStrLn xmproc
, ppTitle = xmobarColor "green" "" . shorten 50
, ppUrgent = xmobarColor "yellow" "red" . xmobarStrip
}
, modMask = myModMask
, terminal = myTerminal
}
The problem goes away if i remove "avoidStruts", and is worse with a larger screen area (worse with an external screen on my netbook than without.)
Has anyone else experienced anything like this, or am i just doing something daft?
Thanks in advance
Offline
I've been using XMonad on arch for a few months now, and i really love it, but i've been seeing quite a lot of latency (almost half a second!) when doing anything with windows (switching,reordering etc). After a bit of playing, i traced it back to the dock manager (XMonad.Hooks.ManageDocks), and specifically avoidStruts, for example, the following minimal config shows the problem:
Given how basic your xmonad.hs is, I'm pretty baffled by this as well. Trayer might be interacting funny with avoidStruts, though unfortunately I sort of doubt the solution is that simple. You might have already tried it, but see if it still lags if you start XMonad without trayer. Also, are you using anything like xcompmgr?
If you're up to it, you could try removing the standard repo versions of xmonad, xmonad-contrib, and xmobar and get the darcs versions from the AUR. Perhaps it's a bug that's been fixed already(XMonad has pretty active development). If that still doesn't help and no one else can help you here, I'd highly suggest visiting the XMonad IRC channel, as I'm sure the devs would want to hear about this.
Offline
Nice thread!
Does anyone know how to make focus move to the window above when a window is automatically killed?
Offline
I do not, try asking in the xmonad irc channel.
I'm also known as zmv on IRC.
Offline
I do not, try asking in the xmonad irc channel.
Yeah tried that already but no go.
Right now im using xmonad.insertPosistion to make new windows appear below rather than above the focused one. But I cannot get my head around how to make the focus work in "reverse" order. Oh well I will continue my hunt!
Offline
Does anybody know what class or resource name MS Word has [in xmonad] when used with wine? I'm using fade inactive and I would like to add it as an exception....
Offline
@abijr
You should be able to find it by running 'xprop' in a terminal and clicking on MS Word. You can try xprop | grep CLASS to get just the class.
Offline
@abijr
You should be able to find it by running 'xprop' in a terminal and clicking on MS Word. You can try xprop | grep CLASS to get just the class.
Nice..... thanks!
Offline
I've been trying to find a xmonad config that uses the cross layout. If someone have it I would really appreciate if you could share it with me.
Offline
I've been trying to find a xmonad config that uses the cross layout. If someone have it I would really appreciate if you could share it with me.
While strickly speaking, layoutHints is pointless for Cross, it was sort of lumped in when I still had a more complex set up. Here's the relevant bits:
xmonad $ defaultConfig
{ terminal = "urxvtc"
, modMask = mod4Mask
, borderWidth = 2
, focusedBorderColor = "#0000ff"
, normalBorderColor = "#000000"
, keys = keys'
, manageHook = manageHook'
, layoutHook = avoidStruts
$ toggleLayouts (noBorders Full)
$ smartBorders
$ windowNavigation ( layoutHints ( Cross (3/5) (1/20) ||| ResizableTall 1 (3/100) (1/2) [] ))
... snip ...
Offline
soderstrom wrote:I've been trying to find a xmonad config that uses the cross layout. If someone have it I would really appreciate if you could share it with me.
While strickly speaking, layoutHints is pointless for Cross, it was sort of lumped in when I still had a more complex set up. Here's the relevant bits:
xmonad $ defaultConfig { terminal = "urxvtc" , modMask = mod4Mask , borderWidth = 2 , focusedBorderColor = "#0000ff" , normalBorderColor = "#000000" , keys = keys' , manageHook = manageHook' , layoutHook = avoidStruts $ toggleLayouts (noBorders Full) $ smartBorders $ windowNavigation ( layoutHints ( Cross (3/5) (1/20) ||| ResizableTall 1 (3/100) (1/2) [] )) ... snip ...
Thanks for the reply, but I have no idea where to add this in the xmonad.hs file? I've been tinkering with my Arch installation now for more than 12 hours (haha!, yeah I am a noob) and just got things working with wifi and gnome
I was watching this clip on youtube http://www.youtube.com/watch?v=kesRhuTctWk and loved what I saw there, but the guy don't wanna share his configuration and I've been trying to find something similar so ended up reading about the cross layout wich is similar to the circle layout but makes the windows stay in one possition just like the ones posted on you tube video.
If I could just get that style on my xmonad.hs my search for a Linux distro I feel good with is finaly over and I can decide to erase OSX for good Arch Linux is brilliant ones all the configuration is done. Never been so easy and fast to install applications with pacman and great support at this forum.
Offline
Your xmonad.hs file would be located in your home directory: /home/user/.xmonad
replace the italics with the user name that you used to login with.
I'm not sure where you are in the learning curve that comes with linux, so if you don't have an xmonad.hs file inside the hidden directory .xmonad in your home directory, then you can just copy and paste what was posted as the xmonad.hs file then compile it with xmonad --recompile.
Knute
Offline
Your xmonad.hs file would be located in your home directory: /home/user/.xmonad
replace the italics with the user name that you used to login with.I'm not sure where you are in the learning curve that comes with linux, so if you don't have an xmonad.hs file inside the hidden directory .xmonad in your home directory, then you can just copy and paste what was posted as the xmonad.hs file then compile it with xmonad --recompile.
I have been learning allot the past few days and already managed to get a working xmonad.hs and xmobarrc running. Just got confused by the lack of code he posted compared to the downloaded configuration from Arch wiki I was testing. Will try it and see if I can get it to work.
Thanks for helping out!
Edit: I edited the xmonad.hs file with the code posted above saved it and did xmonad --recompile. I got this error message
Error detected while loading xmonad configuration file: /home/soderstrom/.xmonad/xmonad.hs
xmonad.hs:15:0: parse error (possibly incorrect indentation)
Please check the file for errors.
Last edited by soderstrom (2010-09-01 13:43:48)
Offline
Haskell is pickier than other languages about white space.
That's saying that line 15 space zero of your xmonad.hs file is not indented correctly.
From my experience it could be even a line before that or after it, but it is helpful. All you need to do is go in and check your indenting. If all you did was a cut and paste, then you may need to go back in and adjust indenting so that it looks like what was posted.
(Indenting and such is also why we use code tags when we post code, because some languages are picky about indenting, like haskell, and some, like perl and awk, don't care if you have extra spaces or not.)
HTH
Knute
Offline