You are not logged in.

#1 2012-12-28 00:46:41

helloworld1
Member
Registered: 2010-12-26
Posts: 72

Let dzen and trayer handle resolution change in Xmonad

I am using XMonad on my laptop and I also have a monitor for the laptop. The monitor has higher resolution than my laptop so when I connect my laptop to the monitor, the dzen bar and trayer will still stay the same size so there will be a big gap between the right side of the bar and the right side of the screen.

If I reload XMonad, trayer will go to the right place but dzen will stay the same size.
Is there a way to specify the trayer size dynamically using percentage?

-- Command to launch the bar.
myBar = "dzen2 -bg black -fg white -ta l -w 1352 -x 0"
conkyBar = "conky -c ~/.xmonad/conkyrc | dzen2 -bg black -fg white -ta r -w 432 -x 1352"
myTrayer = "killall trayer; trayer --edge top --align right --widthtype request --SetDockType true --SetPartialStrut true --transparent true --alpha 0 --tint 0x000000 --expand true --heighttype pixel --height 16"

-- Custom PP, configure it as you like. It determines what's being written to the bar.
myPP = dzenPP {
    ppCurrent  = dzenColor "white" "#00cc00" . pad
    , ppHiddenNoWindows = dzenColor "#efefef" "#2f2f2f" . pad
    , ppTitle    = ("^fg(#00ff00) " ++) . dzenEscape
    }

........
myLogHook :: Handle -> X ()
myLogHook h = dynamicLogWithPP $ myPP { ppOutput = hPutStrLn h }
main = do
    myStatusBarPipe <- spawnPipe myBar
    conkyBarProc <- spawnPipe conkyBar
    trayproc <- spawnPipe myTrayer
    xmonad $ withUrgencyHook NoUrgencyHook $ defaultConfig {
        terminal = "urxvt"
        , manageHook = manageDocks <+> myManageHook <+> manageHook defaultConfig
        --, manageHook = myManageHook
        --, layoutHook = avoidStruts  $  layoutHook defaultConfig
        , layoutHook = avoidStruts $ myLayout
        , logHook = myLogHook myStatusBarPipe
        , modMask = mod4Mask
        , startupHook = ewmhDesktopsStartup >> setWMName "LG3D"
        , handleEventHook = ewmhDesktopsEventHook
        , keys = myKeys
    }

Normally
normally

On larger monitor:
larger

Last edited by helloworld1 (2012-12-29 04:17:04)

Offline

#2 2012-12-28 02:18:36

Multimoon
Member
From: /usr/share/zoneinfo/US/Eastern
Registered: 2012-09-30
Posts: 170

Re: Let dzen and trayer handle resolution change in Xmonad

I'm not a pro with Desktop Enviornments, but my best guess would be to google how bigger giants such as Gnome or KDE manage that, then look for alternatives.


It always makes me laugh when people complain and rage over any distro's management ideal, when this is a linux community, and you could always make your own distro and experience the pains yourself.

Offline

#3 2012-12-28 18:39:26

helloworld1
Member
Registered: 2010-12-26
Posts: 72

Re: Let dzen and trayer handle resolution change in Xmonad

Multimoon wrote:

I'm not a pro with Desktop Enviornments, but my best guess would be to google how bigger giants such as Gnome or KDE manage that, then look for alternatives.

Well they have dedicated status bar instead of separate bar for workspace information, system information and system tray.

Offline

#4 2012-12-29 15:57:38

nsl
Member
Registered: 2012-09-09
Posts: 3

Re: Let dzen and trayer handle resolution change in Xmonad

Hello,
I have simmilar setup, but i don't call dzen directly, instead i call simple bash wrapper that computes screen offsets, based on screen resolution (via xrandr).
Here it is:

#!/bin/bash
# Get monitor width and height for proper Layout
SCREEN_WIDTH=$(xrandr | grep -Po --color=never "(?<=\ connected )[\d]+(?=x[\d]+)")
SCREEN_HEIGHT=$(xrandr | grep -Po --color=never "(?<=\ connected )[\d]+x[\d]+" | sed -r "s/[0-9]+x//")
# Layout
HEIGHT=16
WIDTH=700
Y_POS=$(echo "$SCREEN_HEIGHT - $HEIGHT" | bc)

# Colors and font
FONT="-*-montecarlo-medium-r-normal-*-11-*-*-*-*-*-*-*"
DZEN_BG="#020202"
DZEN_FG="#9d9d9d"

dzen2 -x 0 -y $Y_POS -h $HEIGHT -w $WIDTH -ta l -fg $DZEN_FG -bg $DZEN_BG -fn $FONT -p -e ''

Last edited by nsl (2012-12-29 16:57:02)

Offline

#5 2016-11-25 08:47:20

reddhawk
Member
Registered: 2012-07-02
Posts: 28

Re: Let dzen and trayer handle resolution change in Xmonad

Here is what OP wanted. Unfortunately, answer came too late I guess.

http://xmonad.org/xmonad-docs/xmonad-co … -Dzen.html

EDIT: actually, this still isn't what op wanted.

Last edited by reddhawk (2016-11-25 08:52:50)

Offline

#6 2016-11-26 00:19:53

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,858
Website

Re: Let dzen and trayer handle resolution change in Xmonad

Thanks for sharing, but OP hasn't been back in over two years. I think we can put this topic to rest now.

Closing.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB