You are not logged in.

#101 2008-01-15 07:54:38

redbeard0531
Member
Registered: 2007-12-28
Posts: 12

Re: dzen & xmobar Hacking Thread

I've been getting a lot of PM's asking me to upload my full configs (thanks for the complements btw). I'd prefer to put them on a server somewhere, so I can always link to the latest one, so if anyone wants to loan me some space I'll be grateful. But in the meantime here is the latest config for my (1440x900) laptop. My desktop at work is dual 16x12 so some parts of the configs differ, but I try to keep them as merged as possible.

Note: the notes from http://bbs.archlinux.org/viewtopic.php? … 78#p311378 still applies including the killall issue. If anyone has some ideas on how to avoid it, I'm all ears(eyes?).
Note2: I am picky with how I handle multiple displays, so it will behave a bit differently form any standard config.
Note3: I switched from iwl3945 to ipw3945 so wlan0 became eth1

New features:
blinking "NEW IM" message if pidgin uses the led-notification plug-in from extra/purple-plugin-pack
safer key_simulator (sorry if the old caused problems)

dzonky:

#!/bin/sh

FG='#aaaaaa'
BG='black'
FONT='-*-terminus-*-r-normal-*-*-120-*-*-*-*-iso8859-*'
BIGFONT='-*-terminus-*-r-normal-*-*-140-*-*-*-*-iso8859-*'
ICONPATH=/home/mstearn/bin/dzen_bitmaps

EVENTS="entertitle=scrollend,uncollapse;leavetitle=collapse;button4=scrollup;button5=scrolldown"
EVENTSCLEARABLE="entertitle=uncollapse;leavetitle=collapse"

WIFI=eth1

logger (){
while true
do
    read line
    echo "$line"
done \
  | awk 'BEGIN {print "^fg(white)|^fg()'$1'^fg(white)|^fg()";fflush()}; {print ;fflush()}' \
  | sed -re 's/(([^ ]* +){3})/^fg(white)\1^fg()/' #Highlight datetimes

}

key_symulator(){
key="primer"
while [ $key ]
do
    read key
    xte 'keydown Alt_L' "key $key" 'keyup Alt_L'
done
}

alias my_dzen='dzen2 -xs 1 -h 18 -x $BASE -tw $WIDTH -fg $FG -bg $BG'

set_pos (){ # set_pos width_in_pixels
    BASE=$(echo $BASE + $WIDTH | bc)
    WIDTH=$1
}

BASE=0
WIDTH=0

set_pos 155
watchfile ~/.xmonad-status \
  | awk -F '|' '{print $1;fflush()}' \
  | my_dzen  -e 'button1=menuprint' -ta c -w 160 -m h -l 9 \
  | key_symulator &

set_pos 240
watchfile ~/.xmonad-status \
  | awk -F '|' '/\|/ {print $3 "\n" $3;fflush()}' \
  | my_dzen -fn $FONT -e $EVENTSCLEARABLE -ta l -l 1 -u &

set_pos 75
gcpubar -h 18 -w 50 -gs 0 -gw 1 -i 2  -s g -l "^i(${ICONPATH}/cpu.xbm)^fg(#222222)" \
  | my_dzen -fn $FONT -e '' -ta l&

set_pos 60
inotail -f -n 50 /var/log/kernel.log \
  | logger KERNEL \
  | my_dzen -fn $FONT -e $EVENTS -ta c -l 20 &

set_pos 50
inotail -f -n 50 /var/log/messages.log \
  | logger MAIN \
  | my_dzen -fn $FONT -e $EVENTS -ta c -l 20 &

set_pos 60
inotail -f -n 50 /var/log/daemon.log \
  | logger DAEMON \
  | my_dzen -fn $FONT -e $EVENTS -ta c -l 20 &


set_pos 100
while [ $? -ne 1  -a  $? -ge 0  ]  && echo -n '^fg()'
do
    if (amixer sget Master | grep -qF '[off]')
    then
        color='#3C55A6'
        icon=${ICONPATH}/vol-mute.xbm
    else
        color='#7CA655'
        icon=${ICONPATH}/vol-hi.xbm
    fi

    percentage=$(amixer sget Master | sed -ne 's/^.*Front Left: .*\[\([0-9]*\)%\].*$/\1/p')

    echo $percentage | gdbar -fg $color -bg darkred -h 18 -w 50 -l "^fg(lightblue)^i($icon)^p(2)^fg()"
    inotifywait -t 30 /dev/snd/controlC0 -qq
done \
  | my_dzen -fn $FONT -ta l -e \
       'button1=exec:amixer sset Master toggle -q;button4=exec:amixer sset Master 1+ -q;button5=exec:amixer sset Master 1- -q;' &


set_pos 45
while echo -n ' ' 
do
    ~/bin/dzenWeather/dzen_weather.pl
    sleep 300 # 5 min
done \
  | my_dzen -fn $FONT -ta l -w 145 -l 2 -u -e $EVENTSCLEARABLE &


set_pos 60
while sleep 1
do
    line='0'
    if (exit $(echo `date '+%S'` % 2 | bc)); then #odd seconds
        line=$(cat /tmp/chat-notify)
    fi
    echo $line
done \
  | awk -F '|' '/0/ {print ""; fflush()}; /1/ {print "^fg(yellow)NEW IM"; fflush()};' \
  | my_dzen -fn $FONT -ta c &

 
set_pos 413
CONKY1='^cs()
^tw()^i('$ICONPATH'/temp.xbm)$acpitemp^p(3)${exec if (acpitool -a |grep -qF on-line) ; then echo -n "^fg(green)^i('$ICONPATH'/power-ac.xbm)^fg()"; else echo -n "^fg(red)^i('$ICONPATH'/power-bat.xbm)^fg()"; fi}$battery $battery_time ^fg(white)^i('$ICONPATH'/net-wifi.xbm)(${wireless_essid '$WIFI'} ${wireless_link_qual_perc '$WIFI'} ^fg(#BA9093)${addr '$WIFI'}^fg(#80AA83)^p(3)^i('${ICONPATH}'/arr_up.xbm)${upspeedf '$WIFI'}^p(3)^i('${ICONPATH}'/arr_down.xbm)${downspeedf '$WIFI'}^fg(white))  
LOADS: ^fg(#ff0000)${loadavg 1 2 3}
UPTIME: $uptime
fs
'
conky -t "$CONKY1" \
  | my_dzen -fn $FONT -e $EVENTSCLEARABLE -ta r -l 10 -w 300&


set_pos 182
CONKY2='^tw()${time %a %b %d ^fg(white)%I:%M^fg():%S%P}^p(5)
${execi 3600  (cal -3 | awk "BEGIN {print \\"^cs()\\"}; {print \\"^p(15)\\", \\$0}")}'
conky -t "$CONKY2" \
  | my_dzen -fn $BIGFONT -e $EVENTSCLEARABLE -ta r -w 550 -l 8 &

# vim:set nospell ts=4 sts=4 sw=4:

xmonad.hs:

{-# OPTIONS_GHC -fglasgow-exts #-}
--
-- xmonad example config file.
--
-- A template showing all available configuration hooks,
-- and how to override the defaults in your own xmonad.hs conf file.
--
-- Normally, you'd only override those defaults you care about.
--
 
import XMonad
import System.Exit
 
import XMonad.Actions.CopyWindow
import XMonad.Actions.DwmPromote
import XMonad.Actions.WindowBringer
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.UrgencyHook
import XMonad.Layout.Tabbed
import XMonad.Layout.Magnifier
import XMonad.Layout.Maximize
import XMonad.Layout.NoBorders
import XMonad.Layout.ResizableTile

import XMonad.Prompt
import XMonad.Prompt.Shell

import qualified XMonad.StackSet as W
import qualified Data.Map        as M
import qualified Data.Set        as S
import qualified Data.List as L (deleteBy,find,splitAt,filter,nub)
import Control.Monad (when)
 
-- The preferred terminal program, which is used in a binding below and by
-- certain contrib modules.
--
myTerminal      = "roxterm"
 
-- Width of the window border in pixels.
--
myBorderWidth   = 1
 
-- modMask lets you specify which modkey you want to use. The default
-- is mod1Mask ("left alt").  You may also consider using mod3Mask
-- ("right alt"), which does not conflict with emacs keybindings. The
-- "windows key" is usually mod4Mask.
--
myModMask       = mod1Mask
 
-- The mask for the numlock key. Numlock status is "masked" from the
-- current modifier status, so the keybindings will work with numlock on or
-- off. You may need to change this on some systems.
--
-- You can find the numlock modifier by running "xmodmap" and looking for a
-- modifier with Num_Lock bound to it:
--
-- > $ xmodmap | grep Num
-- > mod2        Num_Lock (0x4d)
--
-- Set numlockMask = 0 if you don't have a numlock key, or want to treat
-- numlock status separately.
--
myNumlockMask   = mod2Mask
 
-- The default number of workspaces (virtual screens) and their names.
-- By default we use numeric strings, but any string may be used as a
-- workspace name. The number of workspaces is determined by the length
-- of this list.
--
-- A tagging example:
--
-- > workspaces = ["web", "irc", "code" ] ++ map show [4..9]
--
myWorkspaces    = ["1","2","3","4","5","6","7","8","9"]
 
-- Border colors for unfocused and focused windows, respectively.
--
myNormalBorderColor  = "#222233"
myFocusedBorderColor = "#ff0000"
 
-- Default offset of drawable screen boundaries from each physical
-- screen. Anything non-zero here will leave a gap of that many pixels
-- on the given edge, on the that screen. A useful gap at top of screen
-- for a menu bar (e.g. 15)
--
-- An example, to set a top gap on monitor 1, and a gap on the bottom of
-- monitor 2, you'd use a list of geometries like so:
--
-- > defaultGaps = [(18,0,0,0),(0,18,0,0)] -- 2 gaps on 2 monitors
--
-- Fields are: top, bottom, left, right.
--
myDefaultGaps   = [(18,0,0,0)]
 
------------------------------------------------------------------------
-- Key bindings. Add, modify or remove key bindings here.
--
myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
 
    -- launch a terminal
    [ ((modMask .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
 
    -- launch dmenu
    , ((modMask,               xK_p     ), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"")

    -- mod-shift-g goto window menu
    -- mod-shift-g bring me window menu
    , ((modMask, xK_g     ), gotoMenu)
    , ((modMask .|. shiftMask, xK_b     ), bringMenu)

    -- mod-shift-d (re)launch dzen
    , ((modMask .|. shiftMask, xK_d     ), spawn "killall dzonky dzen2 inotail inotifywatch watchfile ;  sleep 1; exec /home/mstearn/bin/dzonky")
    , ((modMask .|. shiftMask .|. controlMask, xK_d     ), spawn "dzonky")

    , ((modMask .|. controlMask, xK_Escape     ), spawn "xkill")

    -- mod-\ toggle maximizedness
    , ((modMask, xK_backslash), withFocused (sendMessage . maximizeRestore))
    , ((modMask, xK_x), shellPrompt $ defaultXPConfig  )
 
    -- launch gmrun
    , ((modMask .|. shiftMask, xK_p     ), spawn "gmrun")
 
    -- amarok
    , ((0, 0x1008ff14    ), spawn "amarok -t")
    , ((shiftMask, 0x1008ff1d    ), spawn "amarok -r")
    , ((0, 0x1008ff1d    ), spawn "amarok -f")

    -- reset modifiers if i hit Web/Home
    , ((0, 0x1008ff18   ), spawn "xmodmap ~/.xmodmap")

    -- close focused window 
    -- , ((modMask .|. shiftMask, xK_c     ), kill)
    , ((modMask .|. shiftMask, xK_c     ), kill1)

     -- Rotate through the available layout algorithms
    , ((modMask,               xK_space ), sendMessage NextLayout)
 
    --  Reset the layouts on the current workspace to default
    , ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
 
    -- Resize viewed windows to the correct size
    , ((modMask,               xK_n     ), refresh)
 
    -- Move focus to the next window
    , ((modMask,               xK_j     ), windows W.focusDown)
    , ((modMask,               xK_Tab   ), windows W.focusDown)
 
    -- Move focus to the previous window
    , ((modMask,               xK_k     ), windows W.focusUp)
    , ((modMask .|. shiftMask, xK_Tab   ), windows W.focusUp)
 
    -- Move focus to the master window
    , ((modMask,               xK_m     ), windows W.focusMaster  )
 
    -- Swap the focused window and the master window
    , ((modMask,               xK_Return), dwmpromote)
 
    -- Swap the focused window with the next window
    , ((modMask .|. shiftMask, xK_j     ), windows W.swapDown  )
 
    -- Swap the focused window with the previous window
    , ((modMask .|. shiftMask, xK_k     ), windows W.swapUp    )
 
    -- Shrink the master area
    , ((modMask,               xK_h     ), sendMessage Shrink)
 
    -- Expand the master area
    , ((modMask,               xK_l     ), sendMessage Expand)
 
    -- Push window back into tiling
    , ((modMask,               xK_t     ), withFocused $ windows . W.sink)
 
    -- Increment the number of windows in the master area
    , ((modMask              , xK_comma ), sendMessage (IncMasterN 1))
 
    -- Deincrement the number of windows in the master area
    , ((modMask              , xK_period), sendMessage (IncMasterN (-1)))
 
    -- toggle the status bar gap
    , ((modMask              , xK_b     ),
          modifyGap (\i n -> let x = (XMonad.defaultGaps conf ++ repeat (0,0,0,0)) !! i
                             in if n == x then (0,0,0,0) else x))
 
    -- Quit xmonad
    , ((modMask .|. shiftMask, xK_q     ), io (exitWith ExitSuccess))
 
    -- Restart xmonad
    , ((modMask              , xK_q     ),
          broadcastMessage ReleaseResources >> restart (Just "xmonad") True)
    ]
    ++
    -- mod-[1..9] @@ Switch to workspace N
    -- mod-shift-[1..9] @@ Move client to workspace N
    -- mod-control-shift-[1..9] @@ Copy client to workspace N
    [((m .|. modMask, k), windows $ f i)
        | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
        , (f, m) <- [(ungreedyView, 0), (W.shift, shiftMask), (copy, controlMask .|. shiftMask)]] 
 
    --
    -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
    -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
    --
    ++
    [((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f))
        | (key, sc) <-  take (length myDefaultGaps - 1) $ zip [xK_w, xK_e] [0..]
        , (f, m) <- [(W.view, 0), (W.shift, shiftMask), (W.greedyView, controlMask)]]
 
-- like view, but do nothing if is visible
ungreedyView i s  =
    if i `elem` (map (W.tag . W.workspace) $ W.visible s)
         then s
         else W.view i s
 
------------------------------------------------------------------------
-- Mouse bindings: default actions bound to mouse events
--
myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
 
    -- mod-button1, Set the window to floating mode and move by dragging
    [ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w))

 
    -- mod-button2, Raise the window to the top of the stack
    , ((modMask, button2), (\w -> focus w >> windows W.swapMaster))
 
    -- mod-button3, Set the window to floating mode and resize by dragging
    , ((modMask, button3), (\w -> focus w >> mouseResizeWindow w))
 
    -- you may also bind events to the mouse scroll wheel (button4 and button5)
    -- resize the windows in tiled mode
    , ((modMask, button4), (\w -> focus w >> sendMessage MirrorExpand))
    , ((modMask, button5), (\w -> focus w >> sendMessage MirrorShrink))
    ]
 
------------------------------------------------------------------------
-- Layouts:
 
-- You can specify and transform your layouts by modifying these values.
-- If you change layout bindings be sure to use 'mod-shift-space' after
-- restarting (with 'mod-q') to reset your layout state to the new
-- defaults, as xmonad preserves your old layout settings by default.
--
-- The available layouts.  Note that each layout is separated by |||,
-- which denotes layout choice.
--
myLayout = maximize (tiled ||| Mirror tiled ||| noBorders (tabbed shrinkText defaultTConf) )
  where
     -- default tiling algorithm partitions the screen into two panes
     tiled   = ResizableTall nmaster delta ratio []
 
     -- The default number of windows in the master pane
     nmaster = 1
 
     -- Default proportion of screen occupied by master pane
     ratio   = 1/2
 
     -- Percent of screen to increment by when resizing panes
     delta   = 3/100
 
------------------------------------------------------------------------
-- Window rules:
 
-- Execute arbitrary actions and WindowSet manipulations when managing
-- a new window. You can use this to, for example, always float a
-- particular program, or have a client always appear on a particular
-- workspace.
--
-- To find the property name associated with a program, use
-- > xprop | grep WM_CLASS
-- and click on the client you're interested in.
--
-- To match on the WM_NAME, you can use 'title' in the same way that
-- 'className' and 'resource' are used below.
--
myManageHook = composeAll
    [ className =? "MPlayer"        --> doFloat
    , className =? "Gimp"           --> doFloat
    , resource  =? "pidgin"         --> doF (W.shift "9")
    , resource  =? "desktop_window" --> doIgnore
    , resource  =? "kdesktop"       --> doIgnore
    , resource  =? "kicker"         --> doIgnore 
    , resource  =? "stalonetray"    --> doIgnore 
    , title     =? "panel"          --> doIgnore 
    ]


 
 
------------------------------------------------------------------------
-- Status bars and logging
 
-- Perform an arbitrary action on each internal state change or X event.
-- See the 'DynamicLog' extension for examples.
--
-- To emulate dwm's status bar
--
-- > logHook = dynamicLogDzen
-- 
redbeardPP = defaultPP { ppHiddenNoWindows = dzenColor "#33FF00"  ""
                      , ppHidden  = dzenColor "white"  ""
                      , ppCurrent = dzenColor "yellow" ""
                      , ppVisible = dzenColor "#FF2222" ""
                    --, ppUrgent  = dzenColor "red"    "yellow"
                      , ppSep     = " | "
                      , ppWsSep   = "\n"
                      , ppTitle   = id
                      , ppLayout  = \s -> " "
                      , ppOutput  = writeFile "/home/mstearn/.xmonad-status" 
                                        . ("^cs()\n"++)
                      } 

myLogHook = do ewmhDesktopsLogHook
               dynamicLogWithPP redbeardPP
               return ()
 

myUrgencyHook = withUrgencyHook dzenUrgencyHook 
        { args = ["-bg", "yellow", "-fg", "black" ,"-p", "3", "-xs", "1"] }

------------------------------------------------------------------------
-- Now run xmonad with all the defaults we set up.
 
-- Run xmonad with the settings you specify. No need to modify this.
--
main = xmonad $ myUrgencyHook defaults
 
-- A structure containing your configuration settings, overriding
-- fields in the default config. Any you don't override, will 
-- use the defaults defined in xmonad/XMonad/Config.hs
-- 
-- No need to modify this.
--
defaults = defaultConfig {
      -- simple stuff
        terminal           = myTerminal,
        borderWidth        = myBorderWidth,
        modMask            = myModMask,
        numlockMask        = myNumlockMask,
        workspaces         = myWorkspaces,
        normalBorderColor  = myNormalBorderColor,
        focusedBorderColor = myFocusedBorderColor,
        defaultGaps        = myDefaultGaps,
 
      -- key bindings
        keys               = myKeys,
        mouseBindings      = myMouseBindings,
 
      -- hooks, layouts
        layoutHook         = myLayout,
        manageHook         = myManageHook,
        logHook            = myLogHook
    }


-- vim:nospell:

Offline

#102 2008-01-15 10:43:16

Evanlec
Member
From: NH, USA
Registered: 2007-12-16
Posts: 140
Website

Re: dzen & xmobar Hacking Thread

thanks very much redbeard...

also see your pm's smile

gonna try to get this working tomorrow

Offline

#103 2008-01-18 22:46:31

colbert
Member
Registered: 2007-12-16
Posts: 809

Re: dzen & xmobar Hacking Thread

Hey guys, I am just new to xmonad and dzen2, and I installed both. I would like to get them going but don't quite know the right starting point and browsing this thread has given some great inspiration for possibilities! How would I make a log-in session in GDM for xmonad + dzen2? And what are some basic/important shortcuts? I'd like to spend some of this weekend setting it up smile

Offline

#104 2008-01-18 23:07:10

redbeard0531
Member
Registered: 2007-12-28
Posts: 12

Re: dzen & xmobar Hacking Thread

Welcome colbert!

create ~/.xmonad and ~/bin directories and add ~/bin to your $PATH. Put xmonad.hs into .xmonad and dzonky into bin. Many dzen scripts (including mine) require the svn version of dzen and the dzen gadgets. The default key bindings are listed in man xmonad. dzen doesn't have a place for tray applications, so if you need them I'd suggest running stalonetray.

The default xmonad config: http://haskell.org/haskellwiki/Xmonad/C … _Config.hs

The guide for *dm: http://haskell.org/haskellwiki/Xmonad/F … .2C_gdm.29

My configs: http://gstiles.hypermart.net/redbeard/


PS- thanks for the server space Evanlec

Offline

#105 2008-01-19 01:36:11

Evanlec
Member
From: NH, USA
Registered: 2007-12-16
Posts: 140
Website

Re: dzen & xmobar Hacking Thread

You're very welcome!

And glad that it also makes it easier for everyone to access these great configs...

Now finally to get mine setup the way I REALLY want it smile

btw, redbeard has your setup been added to the xmonad/dzen setups page? if not, it should be.

Offline

#106 2008-01-19 03:29:18

colbert
Member
Registered: 2007-12-16
Posts: 809

Re: dzen & xmobar Hacking Thread

I can't get dzen to show anything, I put that dzonky in /home/user/bin.  Is there more to it ?

Offline

#107 2008-01-19 17:21:15

thayer
Fellow
From: Vancouver, BC
Registered: 2007-05-20
Posts: 1,560
Website

Re: dzen & xmobar Hacking Thread

colbert wrote:

I can't get dzen to show anything, I put that dzonky in /home/user/bin.  Is there more to it ?

dzonky is just a script that executes conky-cli and dzen. If you don't already have them, you'll need to install both dzen and conky-cli (from AUR) and then execute the dzonky script, either in your .xinitrc or however you like.

Last edited by thayer (2008-01-19 17:21:51)


thayer williams ~ cinderwick.ca

Offline

#108 2008-01-21 19:34:30

colbert
Member
Registered: 2007-12-16
Posts: 809

Re: dzen & xmobar Hacking Thread

Okay I grabbed conky-cli from AUR and did makepkg fine, but on -U I get:

bobby@dabox:~/installs/conky-cli$ pacaur conky-cli-1.4.9-2-i686.pkg.tar.gz 
loading package data... done.
checking dependencies...
error: replacing packages with -A and -U is not supported yet
error: you can replace packages manually using -Rd and -U
error: failed to prepare transaction (conflicting dependencies)
:: conky-cli: conflicts with conky

Do I remove conky first, or?

Offline

#109 2008-01-22 01:51:01

peets
Member
From: Montreal
Registered: 2007-01-11
Posts: 936
Website

Re: dzen & xmobar Hacking Thread

Yes, you must first remove conky.

Offline

#110 2008-01-22 13:58:30

gotmor
Member
From: Germany
Registered: 2007-09-03
Posts: 84
Website

Re: dzen & xmobar Hacking Thread

Just writing to inform you about a new bit that you can use with dzen:  dmplex a simple multiplexer.
dmplex is useful if you want to combine multiple input sources into a single dzen instance.

Basically we split the dzen window up into numbered sections and let dmplex handle the layout of the sections, you just supply the value of the section you want to alter.

Usage example:

# First we create a named pipe
$ mkfifo dmpipe

# Listen on the pipe and multiplex the input to dzen
$ tail -f dmpipe | dmplex | dzen2

# Now we can asynchronously write to the pipe and have dmplex handle the layout for us
$ echo "2 second section " > dmpipe
$ echo "1 first section ^r(100x5)" > dmpipe
$ echo "29 29th section" > dmpipe
$ echo "1 first section changed" > dmpipe

The syntax is: section number<space>actual dzen input
You get the trick..


Have fun, Rob.

Last edited by gotmor (2008-01-22 14:03:26)

Offline

#111 2008-01-23 06:05:25

Xilon
Member
Registered: 2007-01-01
Posts: 243

Re: dzen & xmobar Hacking Thread

Will this be included in dzen2 gadgets or should I make a package for it? wink
I don't see it in SVN so I'll package it.

Last edited by Xilon (2008-01-23 06:10:07)

Offline

#112 2008-01-23 08:48:58

gotmor
Member
From: Germany
Registered: 2007-09-03
Posts: 84
Website

Re: dzen & xmobar Hacking Thread

Xilon wrote:

Will this be included in dzen2 gadgets or should I make a package for it? wink
I don't see it in SVN so I'll package it.

Yes, it will be included in dzen2.

I just wanted to hear some oppions/suggestions before the inclusion, so that I can make sure everything works fine.

Offline

#113 2008-01-23 13:39:05

peets
Member
From: Montreal
Registered: 2007-01-11
Posts: 936
Website

Re: dzen & xmobar Hacking Thread

The multiplexer is a very good idea. As a way of learning Python, I'm writing a multi-threaded script that prints dzen strings --if I needed it, I guess other people will need that functionality too. A good thing about this program is that it can be expanded to manage how the different sections are placed / spaced (instead of having to guess-and-check ^p(), users could e.g. tell dmplex to space out the sections evenly). ...hmm I could even write that part myself!

Keep up the good work.

Edit: after thinking about this, I see that "automatic spacing" is not feasible. To get proper spacing, the input would have to be interpreted, and that requires dzen. So maybe the multiplexer should be integrated into the main dzen2 program to allow these features.

Edit2: what if a process is not finished writing to the pipe, and another process begins to write to it?

Last edited by peets (2008-01-26 18:51:46)

Offline

#114 2008-02-01 15:29:00

gotmor
Member
From: Germany
Registered: 2007-09-03
Posts: 84
Website

Re: dzen & xmobar Hacking Thread

Building complex widgets with dzen:

dzonata.png
Further details on the Wiki.

Offline

#115 2008-02-01 18:00:44

sm4tik
Member
From: Finland, Jyväskylä
Registered: 2006-11-05
Posts: 248
Website

Re: dzen & xmobar Hacking Thread

gotmor wrote:

Building complex widgets with dzen:

http://dzen.geekmode.org/img/dzonata.png
Further details on the Wiki.

That *IS* nice! I've been messing around with dzen again for the past two days and actually I had a thought if something like that was possible, but I guess the thought came in reality just now! The actual thought was something like "a dzen based mpd client" or something alike.
I was about to ask something but can't remember it anymore, your sample just messed up my mind wink

..btw.. still working on those 8x8 xbm icons. I reinstalled arch on my new (or.. "new" as in "new to me") laptop and there's been a lot of other stuff I've had to do first, but now I' back on track.
Actually this brings up one more question:
What icons should there at least be in a dzen icon set? Maybe if there was an "universal naming list" of some sort to all the common icons, that'd also help much, both the users and the one's who are drawing or converting icons from already available sets. Any ideas, suggestions, thoughts on that one?
And now I remember the original question also:
From what I read in these post, there are good, better and different ways to fetch info to parse to dzen. What do you use.. or let me make this clearer.. what would you make your alias look like if it was to fetch info on XYZ?
An example (I just came up with) to get cpu usage:

vmstat | tail -1 | awk '{print 100-$15}'

Sakari

Offline

#116 2008-02-01 18:03:29

buttons
Member
From: NJ, USA
Registered: 2007-08-04
Posts: 618

Re: dzen & xmobar Hacking Thread

@sm4tik

Just wanted to say, looking forward to your icon package smile


Cthulhu For President!

Offline

#117 2008-02-01 19:47:59

sm4tik
Member
From: Finland, Jyväskylä
Registered: 2006-11-05
Posts: 248
Website

Re: dzen & xmobar Hacking Thread

Buttons' compliment just gave me the guts to give you all an "as it is" version of the icons. It's my first ever "public release" on anything, so I'm a bit on a thin ice here.. but please ANY comments are important! If it's "good enough" *maybe* I'll add it to the wiki too wink

Thanks,
Sakari

Offline

#118 2008-02-01 20:30:39

peets
Member
From: Montreal
Registered: 2007-01-11
Posts: 936
Website

Re: dzen & xmobar Hacking Thread

Holy harmonium gotmor! I'm having fun already. Keep it up!

Offline

#119 2008-02-01 21:40:12

buttons
Member
From: NJ, USA
Registered: 2007-08-04
Posts: 618

Re: dzen & xmobar Hacking Thread

sm4tik wrote:

Buttons' compliment just gave me the guts to give you all an "as it is" version of the icons. It's my first ever "public release" on anything, so I'm a bit on a thin ice here.. but please ANY comments are important! If it's "good enough" *maybe* I'll add it to the wiki too wink

Thanks,
Sakari

Those fanspeed icons are fantastic!  Too bad I don't use fanspeeds in my monitors tongue

At the moment, here's how they look on my machine:

new_icons542.png

At first I was a bit doubtful at the tiny (8x8) size, but they look magnificent.


Cthulhu For President!

Offline

#120 2008-02-01 22:14:38

sm4tik
Member
From: Finland, Jyväskylä
Registered: 2006-11-05
Posts: 248
Website

Re: dzen & xmobar Hacking Thread

buttons wrote:

Those fanspeed icons are fantastic!  Too bad I don't use fanspeeds in my monitors tongue

At the moment, here's how they look on my machine:

http://xs124.xs.to/xs124/08055/new_icons542.png

At first I was a bit doubtful at the tiny (8x8) size, but they look magnificent.

Heh.. it's FileSystem really, but now that you mentioned it, I'll have to come up with something totally different for that one. The filesystem icon was and is actually the one with most headache. I don't know what it's supposed to look like (in 8x8)?! So, back to drawing board.
8x8 is actually a lot.. hmm.. it's (8x8)^2.. so.. the possibilities are ..almost infinite wink
Anyway, glad you ( < buttons ) like them and I'm very glad to see a shot like that, and also if you (and that is all of you!) have any improvements you'd like to propose, please read the README or use the email form of this forum to contact me directly.

Thanks,
Sakari

ps. I'm not using xmonad myself, so I _must_ be missing an icon or two..

EDIT: @ buttons
Thanks for inspiration! I think I'll add a fanspeed monitor to my upcoming bar just because of you big_smile
(though I can hear the speed without a monitor.. sad )

Last edited by sm4tik (2008-02-01 22:32:34)

Offline

#121 2008-02-02 11:18:33

tch
Member
From: Slovakia
Registered: 2007-10-07
Posts: 31

Re: dzen & xmobar Hacking Thread

Hey guys, can I have a little bit of help ? I dont understand how the menuexec thing is working. I am trying to do a wallpaper change script, not like change my wallpaper a lot, just thought it may be useful for someone.

# background changer script

. ~/.dzen2/dzen.conf

# direcory with images
DIR='/home/tch/images'
COUNT=`ls -l $DIR | wc -l`
COUNT=`expr $COUNT - 1`
# commad to set the background
SETBG="feh --bg-scale $DIR/"

# menu title
echo "V" > file

for i in $(ls $DIR); do
    echo $i >> file
done

dzen2 -fn $FONT -x 800 -y 0 -tw 30 -ta c -sa l -w 400 -p -l $COUNT -m < file -e "entertitle=uncollapse;leaveslave=collapse"

Can someone explain how to execute a command ( SETBG ) with the selected menu option as an argument ? I hope it is clear.

Offline

#122 2008-02-03 00:22:03

sm4tik
Member
From: Finland, Jyväskylä
Registered: 2006-11-05
Posts: 248
Website

Re: dzen & xmobar Hacking Thread

I'm working on a "dzonata" script for mpd and I'm almost finished, but one thing I'm missing is a way to convert seconds into minutes.

echo "obase=60;${current_seconds}/1" | bc

is the closest one so far, but if current position is less than a minute, I haven't found a way to make the "0 minutes" show up. I know I could use mpc's output with sed to get the "position:total", but I was inspired by bashmp and found netcat (which bashmp is "based" on) to be a very useful tool when messing around with mpd.

Offline

#123 2008-02-03 02:13:59

dax965
Member
Registered: 2007-09-09
Posts: 35

Re: dzen & xmobar Hacking Thread

How do I get different sleep timers for different things?  I want a 1 second timer on my eth0 monitor, and a 60 second timer on my Gmail notifier.

Offline

#124 2008-02-03 12:09:38

sm4tik
Member
From: Finland, Jyväskylä
Registered: 2006-11-05
Posts: 248
Website

Re: dzen & xmobar Hacking Thread

@ dax965
quarks has a nice setup nice setup which does just that.

Last edited by sm4tik (2008-02-03 12:10:51)

Offline

#125 2008-02-03 20:50:39

peets
Member
From: Montreal
Registered: 2007-01-11
Posts: 936
Website

Re: dzen & xmobar Hacking Thread

dax965 wrote:

How do I get different sleep timers for different things?  I want a 1 second timer on my eth0 monitor, and a 60 second timer on my Gmail notifier.

dzen is scriptable in any language, so there are many many ways this can be done.

Probably the best way is to use two instances of dzen, each getting updated at different intervals.

Offline

Board footer

Powered by FluxBB