You are not logged in.

#151 2008-06-21 16:11:32

scj
Member
From: Sweden
Registered: 2007-09-23
Posts: 158

Re: dzen & xmobar Hacking Thread

gotmor wrote:

Can you provide some sample input that you feed to dmplex?

I looked into what got written to the fifo file and I found out that the pidgin plugin simply didn't write a newline character. I fixed it and now things are working perfectly!

Last edited by scj (2008-06-21 16:25:51)

Offline

#152 2008-08-01 15:17:47

ukognos
Member
Registered: 2008-07-18
Posts: 41

Re: dzen & xmobar Hacking Thread

hello,

how can i show workspaces on the top left of the screen like here:

http://gotmor.googlepages.com/Xmonad_sc … n-full.jpg

and how can i install fonts like -*-terminus-*-r-normal-*-*-120-*-*-*-*-iso8859-*?

Last edited by ukognos (2008-08-01 15:18:09)

Offline

#153 2008-08-02 10:48:31

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,080

Re: dzen & xmobar Hacking Thread

ukognos wrote:

hello,

how can i show workspaces on the top left of the screen like here:

http://gotmor.googlepages.com/Xmonad_sc … n-full.jpg

and how can i install fonts like -*-terminus-*-r-normal-*-*-120-*-*-*-*-iso8859-*?

1. Asuming you are using xmonad: XMonad.Hooks.DynamicLog is what you want.

2. Search before you ask tongue

[oh@Alice][~]%pacman -Ss terminus
community/terminus-font 4.26-1
    A superb, monospace bitmap font (for X11 and console)

Edit: make sure you got /usr/share/fonts/local in the fontpath in xorg.conf, else it won't show up in xfontsel.

Last edited by Mr.Elendig (2008-08-02 10:49:50)


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#154 2008-08-03 11:24:39

ukognos
Member
Registered: 2008-07-18
Posts: 41

Re: dzen & xmobar Hacking Thread

thanks for your help smile

Offline

#155 2008-08-10 11:06:37

ukognos
Member
Registered: 2008-07-18
Posts: 41

Re: dzen & xmobar Hacking Thread

I've created a small pidgin plugin which writes your current status in a pipe. And a dzen bar script which reads it and shows it on the bar wink
It is not finished but it is useable smile

You can download it and read more on the project homepage: http://code.google.com/p/pipe-notification/

so long ukognos

Offline

#156 2008-08-11 01:01:37

Vintendo
Member
From: Netherlands
Registered: 2008-04-21
Posts: 375
Website

Re: dzen & xmobar Hacking Thread

I gave a dzen setup with conky and i have a problem with fs-bar, does fs-bar work in conky-cli?

Last edited by Vintendo (2008-08-11 01:02:10)

Offline

#157 2008-08-11 02:31:51

Berticus
Member
Registered: 2008-06-11
Posts: 731

Re: dzen & xmobar Hacking Thread

ukognos wrote:

I've created a small pidgin plugin which writes your current status in a pipe. And a dzen bar script which reads it and shows it on the bar wink
It is not finished but it is useable smile

You can download it and read more on the project homepage: http://code.google.com/p/pipe-notification/

so long ukognos

Sweet, now I won't need trayer!

Offline

#158 2008-09-01 16:15:39

Berticus
Member
Registered: 2008-06-11
Posts: 731

Re: dzen & xmobar Hacking Thread

$ dzen2 -h
dzen-0.8.5, (C)opyright 2007 Robert Manea

So I have the latest version, but I can't seem to get xpm's to work. I triple checked to make sure the xpm it's using exists and is in the location I'm using. But it won't show up.

Offline

#159 2008-09-01 16:35:21

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

Re: dzen & xmobar Hacking Thread

You have to compile it yourself with XPM support.

I posted a PKGBUILD earlier in this thread for 0.8.5 that should hopefully still work...

PKGBUILD


Cthulhu For President!

Offline

#160 2008-09-01 18:28:24

Berticus
Member
Registered: 2008-06-11
Posts: 731

Re: dzen & xmobar Hacking Thread

sort of... It gets rid of the gadgets (want gcpubar). I tried to install dzen2-gadgets through aur, but it complained about replacing packages. Is there a way to get the gadgets back? Or will I just have to make it myself?

Offline

#161 2008-09-01 20:37:56

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

Re: dzen & xmobar Hacking Thread

Try this one:

pkgname=dzen2
pkgver=0.8.5
pkgrel=1
arch=(i686 x86_64)
pkgdesc="X notification utility"
url="http://gotmor.googlepages.com/dzen"
license=("MIT")
depends=('libx11')
makedepends=('gcc')
source=(http://gotmor.googlepages.com/$pkgname-$pkgver.tar.gz)
md5sums=('5978620c2124c8a8ad52d7f17ce94fd7')

build()
{
  cd $startdir/src/$pkgname-$pkgver

  patch config.mk <<EOF
7,8c7,8
< PREFIX = /usr/local
< MANPREFIX = \${PREFIX}/share/man
---
> PREFIX = /usr
> MANPREFIX = \${PREFIX}/man
10,11c10,11
< X11INC = /usr/X11R6/include
< X11LIB = /usr/X11R6/lib
---
> X11INC = /usr/include
> X11LIB = /usr/lib
22,23c22,23
< LIBS = -L/usr/lib -lc -L\${X11LIB} -lX11
< CFLAGS = -Os \${INCS} -DVERSION=\"\${VERSION}\"
---
> #LIBS = -L/usr/lib -lc -L\${X11LIB} -lX11
> #CFLAGS = -Os \${INCS} -DVERSION=\"\${VERSION}\"
26,27c26,27
< #LIBS = -L/usr/lib -lc -L\${X11LIB} -lX11 -lXpm
< #CFLAGS = -Os \${INCS} -DVERSION=\"\${VERSION}\" -DDZEN_XPM
---
> LIBS = -L/usr/lib -lc -L\${X11LIB} -lX11 -lXpm
> CFLAGS = -Os \${INCS} -DVERSION=\"\${VERSION}\" -DDZEN_XPM
EOF

  make || return 1
  mkdir -p $startdir/pkg/usr/share/licenses/$pkgname
  cp $startdir/src/$pkgname-$pkgver/LICENSE $startdir/pkg/usr/share/licenses/$pkgname/license
  chmod 644 $startdir/pkg/usr/share/licenses/$pkgname/license
  make DESTDIR=$startdir/pkg install

  cd $startdir/src/$pkgname-$pkgver/gadgets
  make || return 1
  make DESTDIR=$startdir/pkg install
}

It's the same thing, with gadgets tacked on at the end.  Let me know if it works.


Cthulhu For President!

Offline

#162 2008-09-01 21:27:05

Berticus
Member
Registered: 2008-06-11
Posts: 731

Re: dzen & xmobar Hacking Thread

yeah, this works. Thanks

Offline

#163 2008-09-25 18:59:56

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,226
Website

Re: dzen & xmobar Hacking Thread

Lately I've been thinking a lot about a another solution for the "left click ws tab => go to selected ws" (dwm behaviour) problem. I know that redbeards solution does work, but I wanted to create my own - just for the fun of it I guess. Below is what I came up with. You'll need xdotool (http://aur.archlinux.org/packages.php?ID=14789) and getcurpos (http://dzen.geekmode.org/dwiki/doku.php … e-position) for it to work. Here's the script:

#!/bin/bash
# 
# WSSW
# By REJ/Ashren
# 
# Workspace switcher for Xmonad using cursor position to determine which
# workspace to switch to.
#
# Get cursor position:
 
XP=$(getcurpos | cut -d" " -f1)

YP=$(getcurpos | cut -d" " -f2)

# Set your workspace tab min/max values on the x-axis.

w1l=44

w2l=45
w2h=79

w3l=80
w3h=117

w4l=118
w4h=155

w5l=119
w5h=206

# Have the script exit if Y value is outside the dzen window.

if [ $YP -gt "16" ]; then

exit 0

fi

# Have a loop that checks cursor position and executes virtual keystrokes.

while true; do
    

if [ $XP -le "$w1l" ]; then

    xdotool key alt+1

elif [[ $XP -ge "$w2l" && $XP -le "$w2h" ]]; then

    xdotool key alt+2

elif [[ $XP -ge "$w3l" && $XP -le "$w3h" ]]; then

    xdotool key alt+3

elif [[ $XP -ge "$w4l" && $XP -le "$w4h" ]]; then

    xdotool key alt+4

elif [[ $XP -ge "$w5l" && $XP -le "$w5h" ]]; then

    xdotool key alt+5
fi

break 

done

You'll have to adjust the variables w*l to your own ws tab sizes, which you can get with getcurpos, and adjust the script for the number of workspaces as well. Any corrections are welcome. I'm still learning to bash.

It works as aspected directly from the command line also if I test it with dzen2 i.e. "dzen2 -w 230 -e 'button1=wssw'", but as once as I enter it into my xmonad.hs it will not work. Like so:

import XMonad
import System.Exit
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run (spawnPipe)
import System.IO (hPutStrLn)
import XMonad.Util.Loggers

import qualified XMonad.StackSet as W
import qualified Data.Map        as M

myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
    [ ((modMask,               xK_Return), spawn $ XMonad.terminal conf)
    , ((modMask,               xK_g     ), spawn "gmrun")
    , ((modMask,               xK_f     ), spawn "firefox")
    , ((modMask .|. shiftMask, xK_m     ), spawn "sudo shutdown -h now")
    , ((modMask .|. shiftMask, xK_c     ), kill)
    , ((modMask,               xK_space ), sendMessage NextLayout)
    , ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
    , ((modMask,               xK_n     ), refresh)
    , ((modMask,               xK_Tab   ), windows W.focusDown)
    , ((modMask,               xK_j     ), windows W.focusDown)
    , ((modMask,               xK_e     ), windows W.focusDown)
    , ((modMask,               xK_Right ), windows W.focusDown)
    , ((modMask,               xK_k     ), windows W.focusUp  )
    , ((modMask,               xK_Left  ), windows W.focusUp  )
    , ((modMask,               xK_m     ), windows W.focusMaster  )
    , ((modMask .|. shiftMask, xK_Return), windows W.swapMaster)
    , ((modMask .|. shiftMask, xK_e     ), windows W.swapDown  )
    , ((modMask .|. shiftMask, xK_j     ), windows W.swapDown  )
    , ((modMask .|. shiftMask, xK_k     ), windows W.swapUp    )
    , ((modMask,               xK_h     ), sendMessage Shrink)
    , ((modMask,               xK_l     ), sendMessage Expand)
    , ((modMask,               xK_t     ), withFocused $ windows . W.sink)
    , ((modMask              , xK_b     ), sendMessage ToggleStruts)
    , ((modMask .|. shiftMask, xK_q     ), io (exitWith ExitSuccess))
    , ((modMask              , xK_q     ), spawn "killall dzen2 && killall conky" >> restart "xmonad" True)
    ]
    ++
    [((m .|. modMask, k), windows $ f i)
        | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
        , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]

myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
    [ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w))    
    , ((modMask, button2), (\w -> focus w >> windows W.swapMaster))
    , ((modMask, button3), (\w -> focus w >> mouseResizeWindow w))
    ]
 
myLayout = avoidStruts (tall ||| Mirror tall ||| Full)
  where
     tall   = Tall nmaster delta ratio
     nmaster = 1
     ratio   = 1/2
     delta   = 2/100
 
myManageHook = composeAll
    [ className =? "MPlayer"        --> doFloat
    , className =? "Gimp"           --> doFloat
    , className =? "Gran Paradiso"  --> doF (W.shift "web")
    , resource  =? "desktop_window" --> doIgnore]
 
myLogHook h = dynamicLogWithPP $ defaultPP {
              ppCurrent  = dzenColor "#222222" "white" . pad
            , ppVisible  = dzenColor "white" "black" . pad
            , ppHidden   = dzenColor "lightblue" "#222222" . pad 
            , ppHiddenNoWindows = dzenColor "#777777"  "#222222" . pad
            , ppUrgent   = dzenColor "red" "yellow"
            , ppWsSep    = "^r(2x17)"
            , ppSep      = "^fg(white)^r(2x17)"
            , ppLayout   = dzenColor "lightblue" "#222222" .
                           (\ x -> fill (case x of
                                           "Tall"               -> icon "tall.xbm"
                                           "Mirror Tall"        -> icon "mtall.xbm"
                                           "Full"               -> icon "full.xbm"
                                           _                    -> pad x) 4)
            , ppTitle    = ("^fg(white) ^ib(1)^ro(593x16)^pa(235)^fg(orange)^ib(1) " ++) . dzenEscape  
            , ppOutput   = hPutStrLn h
            }
    where
      icon h = "^i(/home/edgar/dzen_bitmaps/" ++ h ++ ")"
      fill :: String -> Int -> String
      fill h i = "^p(" ++ show i ++ ")" ++ h ++ "^p(" ++ show i ++ ")"
      square h = "^ib(1)^fg(black)^ro(43x16)"
      ib h = "^ib(1)"
 
myStatusBar = "dzen2 -fn '-*-dina-*-r-*-*-14-*-*-*-*-*-*-*' -bg '#222222' -fg '#777777' -h 16 -ta l -sa c -w 830 -e 'button1=exec:wssw'"
secondDzenCommand = "conky -c ~/.xdzenconky | dzen2 -expand c -fn '-*-dina-*-r-*-*-14-*-*-*-*-*-*-*' -bg '#222222' -h 16 -w 1210 -e '' -x 830" 
main = do din <- spawnPipe myStatusBar
      spawnPipe secondDzenCommand

          xmonad $ defaultConfig {
                       
                       terminal           = "urxvtc",
                       focusFollowsMouse  = True,
                       borderWidth        = 1,
                       modMask            = mod1Mask,
                       numlockMask        = mod2Mask,
                       workspaces         = ["main","web","dev","fun","music"],
                       normalBorderColor  = "#000000",
                       focusedBorderColor = "white", 
 
                       -- key bindings
                       keys               = myKeys,
                       mouseBindings      = myMouseBindings,
 
                       -- hooks, layouts
                       layoutHook         = myLayout,
                       manageHook         = myManageHook,
                       logHook            = myLogHook din
                     }

I guess that the dzen2 event never gets out of xmonad? Any ideas and explanations are welcome.

I have found one shoddy solution which is to place a transparent dzen title window on top of my workspaces. Which I did the following way (if someones interested):

dzen2 -w 207 -p -e 'button1=exec:wssw' & transset .0 & sleep1 ; xdotool mousemove 5 5 ; xdotool click 1

It's just too dirty to be content with, though.

Ashren

Last edited by Ashren (2008-10-01 13:29:52)

Offline

#164 2008-10-01 12:45:39

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,226
Website

Re: dzen & xmobar Hacking Thread

HAH! It works now! The reason why it did not work was because Xmonad's startup script was not a Xsession script - duh! I was using GDM with a non-xession startup script.

Well, now I have a working dwmstyle WS switcher. YAY!

Offline

#165 2008-10-19 09:54:47

PandaMine
Member
Registered: 2008-10-06
Posts: 25

Re: dzen & xmobar Hacking Thread

I am also having troubles using the multiplexer for dzen, for some weird reason when using dmplex with xmonad outputting with stdo xmonad won't display. I have the workspace info which is printed out by the PP and more info that is printed out by conky which I wan't to be fed into the single bar

EDIT:

Currently my only problem is figuring out how to concat the "1 " before the output of logHook and unfortunatly this needs to be done before it is written

Assuming you have the dyanamicLogWithPP constructor as so

    myLogHook = dynamicLogWithPP $ defaultPP {
          ppCurrent = dzenColor "#ffffff" "#000000" . pad
            , ppVisible = dzenColor "#888888" "#000000" . pad
            , ppHidden = dzenColor "#888888" "#000000" . pad 
            , ppHiddenNoWindows = dzenColor "#888888"  "#000000" . pad
            , ppOutput = writeFile "dmpipe"  
        }

What would you do so it writes what it currently does with a "1 " infront of it so it works with dmplex?

Last edited by PandaMine (2008-10-19 13:21:37)

Offline

#166 2008-10-22 10:35:01

Zariel
Member
Registered: 2008-10-07
Posts: 446

Re: dzen & xmobar Hacking Thread

I wrote an mpd-np program in C to print the nowplaying info to stdout, i can run it from terminal fine but when i use Run Com "mpdnp" [] "mpdnp" 10 in xmobarrc it gives the error Could Not Execute Command mpdnp.

The file in /usr/bin

Offline

#167 2008-11-22 01:04:40

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

Re: dzen & xmobar Hacking Thread

file print-test.c

#include <unistd.h>
#include <stdio.h>
int main() {
  while(1) {
    printf("1\n");
    /* adding a call to fflush(stdout) here fixes my problem */
    sleep(1);
  }
  return 0;
}

It prints a '1' and a newline every second or so. When I pipe it into dzen (./print-test | dzen2), dzen displays nothing. Why?

Hmmm... this has nothing to do with dzen. './print-test | grep 1' produces no output. Neither does './print-test | perl -e'while(<>){print}'. Must have to do with me not understanding how pipes work fully.

I can only vaguely understand why this works, but calling fflush(3) fixes my problem. Mefinds talking to oneself is often useful.

Last edited by peets (2008-11-22 04:13:18)

Offline

#168 2008-12-27 16:01:11

Gigamo
Member
Registered: 2008-01-19
Posts: 394

Re: dzen & xmobar Hacking Thread

Hi. Sorry if this has been asked/answered before, but is there an easy way to show battery percentage in xmobar? smile

Thanks.

Offline

#169 2008-12-31 05:54:53

goll
Member
From: Croatia
Registered: 2007-10-29
Posts: 50

Re: dzen & xmobar Hacking Thread

Well, as far as i can see, you already have it configured in your .xmobarrc at your github smile The line is:

, Run Battery ["-t","Bat: <left>"] 10

Offline

#170 2009-01-13 16:18:29

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: dzen & xmobar Hacking Thread

i'm using the rx_bytes and tx_bytes info to calculate transfer speeds, yet while download speeds seem to be about right (about 10% too high, but i guess that's overhead), upload speeds are shown roughly 2-3 times higher than they actually are; they even exceed my line capacity with about a factor 2.

does anyone know why this happens?

just in case, this is the relevant part of the script:

#!/bin/zsh

WIFIVAL=2
WIFICOUNTER=$WIFIVAL

TRANSFER='/sys/class/net/wlan0/statistics'
BASEDOWN="$(<$TRANSFER/rx_bytes)"
BASEUP="$(<$TRANSFER/tx_bytes)"

while true; do

if [ $WIFICOUNTER -ge $WIFIVAL ]; then

   currentdown="$(<$TRANSFER/rx_bytes)"
   currentup="$(<$TRANSFER/tx_bytes)"

   (( kbdown = ($currentdown-$BASEDOWN) / 1024 / $WIFIVAL ))
   (( kbup = ($currentup-$BASEUP) / 1024 / $WIFIVAL ))

   PRINTWIFI=$(print -n $kbdown"k/s down" $kbup"k/s up")

   BASEDOWN=$currentdown
   BASEUP=$currentup

   WIFICOUNTER=0
fi

WIFICOUNTER=$((WIFICOUNTER+1))

done

ᶘ ᵒᴥᵒᶅ

Offline

#171 2009-02-13 18:24:52

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

Re: dzen & xmobar Hacking Thread

Dzen has undergone some changes lately and now supports, besides XFT fonts, clickable areas.

See HERE for further details.

Comments and possible bug/testing reports welcome.

Offline

#172 2009-02-13 19:25:51

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,226
Website

Re: dzen & xmobar Hacking Thread

With Dzen's new functionality my script for changing workspaces is now redundant.

Here is what to do get the same functionality:

1. Checkout and install the newest dzen svn.
2. Install xdotool
3. Create as many scripts as you have workspaces, i.e. calling them ws1-5, with the following content

#!/bin/bash
xdotool key alt+1

where the number changes corresponding to your workspace. Put these scripts in your PATH.
4. Add the following to your workspace list in your xmonad.hs:

workspaces         = "^ca(1,ws1)main^ca()":"^ca(1,ws2)web^ca()":"^ca(1,ws3)code^ca()":"^ca(1,ws4)fun^ca()":"^ca(1,ws5)misc^ca()":[],

The reason for creating the scripts is that the ^ca switch does not execute stacked commands.

Last edited by Ashren (2009-02-13 19:50:43)

Offline

#173 2009-02-13 19:47:26

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

Re: dzen & xmobar Hacking Thread

I think that's

xdotool key <key>+1

Where <key> is alt, super, whatever


Cthulhu For President!

Offline

#174 2009-02-13 19:50:20

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,226
Website

Re: dzen & xmobar Hacking Thread

Thanks for pointing it out. Post corrected.

Offline

#175 2009-02-13 21:55:28

Paul-S
Member
From: Wales
Registered: 2008-02-04
Posts: 353

Re: dzen & xmobar Hacking Thread

Cool stuff Ashren smile

Offline

Board footer

Powered by FluxBB