You are not logged in.

#1 2009-06-28 16:07:47

lifeafter2am
Member
From: 127.0.0.1
Registered: 2009-06-10
Posts: 1,332

XMonad, RandR, dzen2 and other dual screen stuff

Through my mutiple experiments and playing around, it SEEMS that using Twinview and RandR is the better option than using Xinerama (mostly because Xinerama kills my transparent terminals).  The only problem I am finding is that I can either get my top dzen bar to show, or the bottom dzen bar to show .... but not both.  Is there any way to fix this?

dzen launching commands from Xmonad:

-- dzen config
sBarCmd = "dzen2 -fn '-*-times-*-r-*-*-12-*-*-*-*-*-*-*' -bg '#000000' -fg '#3a6b7a' -h 16 -w 720 -ta l"
topBarCmd = "conky -c ~/.conkyrc | dzen2 -fn '-*-times-*-r-*-*-12-*-*-*-*-*-*-*' -bg '#000000' -fg '#f0f0f0' -h 16 -w 650 -x 720 -ta r"
botBarCmd = "conky -c ~/.conky_bottom_dzen | dzen2 -fn '-*-times-*-r-*-*-12-*-*-*-*-*-*-*' -bg '#000000' -fg '#f0f0f0' -h '16' -y 884 -w 1440 -ta 'c'"

My second question has to do with setting different wallpapers to each screen.  First I read on another forum that this was not possible, then I just read in this topic that it is.


#binarii @ irc.binarii.net
Matrix Server: https://matrix.binarii.net
-------------
Allan -> ArchBang is not supported because it is stupid.

Offline

#2 2009-06-28 18:47:09

BurntSushi
Member
From: Massachusetts
Registered: 2009-06-28
Posts: 362
Website

Re: XMonad, RandR, dzen2 and other dual screen stuff

I'm running the very same setup- I've been researching all weekend the very same problems here, so I'll share what I've found out so far. (Therefore, some tidbits here may not be relevant, but I'm going on the assumption that you may hit the same problems I did.)

First and foremost, while feh can set a wallpaper fairly easily, nitrogen is absolutely fantastic for dual screens. It's available on pacman, and it provides a GUI utility to easily set wallpapers, one for each screen. (Alternatively, you could use feh and manually create an image merging two wallpapers that is the size of your dual screen total resolution using GIMP or something.) Once you have your wallpapers set with nitrogen, put this in your .xinitrc to restore the wallpaper each time you start X:

nitrogen --restore &

The caveat here is that it will only do a proper restore if you start X with dual screens. So if you start X with just one screen, it isn't going to reload your wallpaper correctly. (As of right now, my default Xorg starts up with dual screen and I run a monitor detecting script I wrote to reconfigure the resolutions properly.) So my logic is like this:

Start X with dual screen configuration even if one monitor is connected -->
Restore wallpaper using nitrogen -->
Detect if only one monitor is plugged in and change resolution

This way, it restores the wallpaper first and preserves it even after the resolution is changed. Here is my monitor detection script:

#!/bin/sh

LIDSTATUS=`cat /proc/acpi/button/lid/LID/state | grep "closed"`
SECONDMON=`disper -l | grep "DFP-1"`

if [ -n "$LIDSTATUS" ] && [ -n "$SECONDMON" ]; then
    disper -d DFP-1 -r "1280x720" -s
elif [ -z "$LIDSTATUS" ] && [ -n "$SECONDMON" ]; then
    disper -d DFP-0,DFP-1 -r "1280x960","1280x720" -t "top" -e
#elif [ -z "$LIDSTATUS" ] && [ -z "$SECONDMON" ]; then
else
    disper -d DFP-0 -r "1280x960" -s
fi

The above requires the disper utility (http://willem.engen.nl/projects/disper/), and I'm also using a laptop so your script might be a bit different if you're running a desktop. (You'll also need to change resolutions and possibly the monitor names, but you can find that info from running "disper -l")

I know I'm answering a bit more here than you asked, but I found the disper utility to be extremely helpful. It took me forever to find it. (It was literally the only way I could find that would detect that an external monitor had been connected- but not necessarily enabled. Note: I am using nVidia.)

As for dzen, have you tried using the "-p" flag? I found that without this, my second dzen bar wasn't being displayed. (See http://dzen.geekmode.org/dwiki/doku.php … ption-list.)

Also, do please let me know if you are successful in configuring it with XMonad. It seems I can only use avoidStruts to show a dzen status bar properly only once on each screen. (Meaning, otherwise it still shows up, but the windows cover it.) My hacked solution was to use XMonad.Layout.Gaps to create a forced gap at the bottom of one of my screens, and then positioned dzen there. Unfortunately, this creates a gap on both screens. To hack this even more, I created a toggle switch that allows me to show/hide the bottom gap. (Similarly to how Mod+b shows/hides the top gap by default.) This isn't ideal, but I'm still in pursuit of a better solution. (It appears as though what I'm looking for will be in XMonad 0.9: From the XMonad.Layout.Gaps docs: "To configure gaps differently per-screen, use XMonad.Layout.PerScreen (coming soon)." - Which links to a 404. See: http://www.xmonad.org/xmonad-docs/xmona … -Gaps.html. I've also seen numerous references to XMonad.Layout.Monitor that appears in 0.9.)

Oh, and I'd highly recommend grabbing the latest dzen2 from SVN and compiling it with Xinerama support (edit the config.mk). It allows you to position dzen on either screen and supports negative Y values to easily move it to the bottom. (It also has a "dock" flag, which I thought might help it with XMonad, as it seems the second dzen status bar isn't sending the right flags to XMonad so that it knows to treat it as a dock, but it didn't work. My attempts to edit the dzen source failed miserably.)

*EDIT*
Now that I think about it a little more, when the second dzen status bar was successfully loaded, it *is* being treated as a dock (meaning XMonad isn't tiling it), however it is simply being hidden by XMonad. I tried using avoidStrutsOn to manually force gap at the bottom, but that didn't work. So maybe there is a way to simply make a window "always on top"? Just thinking out loud...


Note: I've only just recently installed Arch (and still kind of new to linux), and have only been tinkering with XMonad for a couple weeks, so I apologize if I've been unclear, but let me know, and I'll try to help out anyway I can. I'm an Arch convert from Fedora- the installation process was extremely rewarding.

Last edited by BurntSushi (2009-06-28 18:52:32)


Education is favorable to liberty. Freedom can exist only in a society of knowledge. Without learning, men are incapable of knowing their rights, and where learning is confined to a few people, liberty can be neither equal nor universal.

Tu ne cede malis sed contra audentior ito

Offline

#3 2009-06-28 22:58:42

lifeafter2am
Member
From: 127.0.0.1
Registered: 2009-06-10
Posts: 1,332

Re: XMonad, RandR, dzen2 and other dual screen stuff

Wow .... BurntSushi nice post!  big_smile

I have copied your script and modified it with my resolutions and have also installed the packages.  So on that front we are good to go.

Now, I found the same as you, that when dzen loads on the bottom it is covered by other windows; UNTIL I reload the config (killall conky then META-q) and then it is on top of the other windows.  To tell you the truth, its pretty annoying with it just sitting on top and blocking part of the terminals (normally where you type commands).  I am going to continue searching, but also will likely be in the #xmonad channel on freenode tonight asking around as well.  Besides that the only thing left for me to fix is trayer, which is now aligned all the way to the right of my second monitor, instead of stopping at the first one, which leaves a huge blank gap at the top of my second screen.


#binarii @ irc.binarii.net
Matrix Server: https://matrix.binarii.net
-------------
Allan -> ArchBang is not supported because it is stupid.

Offline

#4 2009-06-28 23:20:29

BurntSushi
Member
From: Massachusetts
Registered: 2009-06-28
Posts: 362
Website

Re: XMonad, RandR, dzen2 and other dual screen stuff

lifeafter2am wrote:

Wow .... BurntSushi nice post!  big_smile

I have copied your script and modified it with my resolutions and have also installed the packages.  So on that front we are good to go.

Now, I found the same as you, that when dzen loads on the bottom it is covered by other windows; UNTIL I reload the config (killall conky then META-q) and then it is on top of the other windows.  To tell you the truth, its pretty annoying with it just sitting on top and blocking part of the terminals (normally where you type commands).  I am going to continue searching, but also will likely be in the #xmonad channel on freenode tonight asking around as well.  Besides that the only thing left for me to fix is trayer, which is now aligned all the way to the right of my second monitor, instead of stopping at the first one, which leaves a huge blank gap at the top of my second screen.

Great!

I do have a minor correction, though. It turns out that if you use nitrogen to refresh the wallpaper, then switch the resolution, it could still be a bit messed up. (It was working fine when I had my laptop screen disabled and my external monitor on. However, the opposite wasn't so hot.) My solution was to use the mon_detect.sh script in my previous post, and refresh it with nitrogen when it detects dual monitors, and then use "feh --bg-scale /path/to/img" when only one monitor is detected.

In other news, when I wrote the post above, I was loading the dzen stuff outside of XMonad. The first was my normal status bar that defaults to the top of the screen (and works beautifully), and the second was called in this way at the end of .xinitrc (showing workspace info):

exec xmonad | dzen2 ...

Doing it this way, it was always hidden.

After a bit of experimenting, I moved my two dzen bars into xmonad.hs, and I get the behavior you're describing. (Which seems to be the standard way of doing it here at the Arch forums- after searching and looking through config files posted here all day.) That is, when I reload XMonad, the bottom status bar is visible, but like you said, the tiling manager doesn't see it, and the windows disappear below it. Additionally, when I open up a new window, it will cover up the status bar at the bottom. So that's pretty strange.

Also, another little tip- I've added spawn lines to my xmonad.hs to destroy all instances of dzen before xmonad loads back up. While reloading XMonad a gagillion times, I realized that I have a crapload of dzen processes running. (Probably do this for conky too. I'm not running conky or trayer- although I might check out trayer. Which programs do you use it for?)

kill <- spawn "pkill dzen2"

I'll log on to #xmonad tonight and see if we can figure something out.

Oh, I have another note as well. While I think it is absolutely ugly, it does seem quite feasible to get two status bars running on the same screen if they are right on top of each other. Essentially, you could do something like the following:

1. Set the height of the first status bar to be equal to the combined height of both
2. Move the second status bar down using the "-y" option equal to the height of just the first status bar.
3. Use the "-e 'onstart=raise'" (or "-e 'onstart=lower'") event flag to move the second status bar above the first (or move the first status bar below the second).
4. Position content of the first status bar appropriately. (Probably using ^pa() or something. See the dzen command line option page I linked to in my first post.)

Ugly. Real ugly.

Thinking to the future: automagically moving the second status bar to the other monitor when one is disabled... I'm already thinking separate XMonad config files combined with the monitor detect script above. Or something a bit more elegant. (This is the advantage of loading dzen through XMonad instead of .xinitrc- with the former, dzen can be moved around on a simple XMonad restart, while the latter is probably a bit tricky to do without an X restart.)

Last edited by BurntSushi (2009-06-28 23:32:21)


Education is favorable to liberty. Freedom can exist only in a society of knowledge. Without learning, men are incapable of knowing their rights, and where learning is confined to a few people, liberty can be neither equal nor universal.

Tu ne cede malis sed contra audentior ito

Offline

#5 2011-02-05 03:12:16

btwthieves
Member
Registered: 2011-02-01
Posts: 2

Re: XMonad, RandR, dzen2 and other dual screen stuff

BurntSushi wrote:

Start X with dual screen configuration even if one monitor is connected -->
Restore wallpaper using nitrogen -->
Detect if only one monitor is plugged in and change resolution

This way, it restores the wallpaper first and preserves it even after the resolution is changed. Here is my monitor detection script:

Thank you SO much for posting about nitrogen and disper -- I've been searching for a way to make autodetect // autoconfigure my multihead setup with my Macbook running xmonad and this is exactly what I needed.

Offline

#6 2011-02-05 04:22:12

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: XMonad, RandR, dzen2 and other dual screen stuff

This thread is more than a year old, please don't bump old threads. https://wiki.archlinux.org/index.php/Fo … Bumping.27

Closing.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

Board footer

Powered by FluxBB